Skip to content

Commit 06d7838

Browse files
committed
further checks on documentation and cuda
1 parent d20490a commit 06d7838

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
name: Testing using pytest
2020
runs-on: ubuntu-latest
2121
container:
22-
image: nvidia/cuda:12.1.0-devel-ubuntu22.04
22+
image: nvidia/cuda:12.1.1-devel-ubuntu22.04
2323

2424
steps:
2525
- uses: actions/checkout@v3

src/pyclassify/eigenvalues.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def eigenvalues_np(A, symmetric=True):
2121
"""
2222
Compute the eigenvalues of a square matrix using NumPy's `eig` or `eigh` function.
2323
24-
This function checks if the input matrix is square (and is actually a matrix) using 'check_square_matrix', and then computes its eigenvalues.
24+
This function checks if the input matrix is square (and is actually a matrix) using
25+
'check_square_matrix', and then computes its eigenvalues.
2526
If the matrix is symmetric, it uses `eigh` (which is more efficient for symmetric matrices).
2627
Otherwise, it uses `eig`.
2728
@@ -80,13 +81,13 @@ def eigenvalues_cp(A):
8081
8182
This function checks if the input matrix is square and symmetric, then computes its eigenvalues using
8283
CuPy's sparse linear algebra solvers. It uses `eigsh` for more efficient computation.
83-
IMPORTANT: it important to underline a couple of things regarding this function:
84-
- installing using the command 'python -m pip install cupy-cuda12x' does not allow, for some reason,
85-
to import cupyx.scipy.sparse.linalg, and it necessary to import the
86-
function manually form the source code. The problem can be observed using python3.10, while for
87-
python3.12 things seem to work.
88-
- the eighs function in this case does not allow to compute *all* the eigenvalues, but only a number
89-
$m<n$, so here just a reduced portion is computed (starting form the ones which are greater in magnitude).
84+
IMPORTANT: it important to underline a couple of things regarding this function. The first one is that,
85+
installing using the command 'python -m pip install cupy-cuda12x', does not allow, for some reason,
86+
to import cupyx.scipy.sparse.linalg, and it necessary to import the function manually form the source
87+
code. The problem can be observed using python3.10, while for python3.12 things seem to work.
88+
The second one is that the 'eighs' function in this case does not allow to compute *all* the eigenvalues,
89+
but only a number $m<n$, so here just a reduced portion is computed (starting form the ones which are
90+
greater in magnitude).
9091
9192
Args:
9293
A (cpsp.spmatrix): A square sparse matrix whose eigenvalues are to be computed.
@@ -99,7 +100,7 @@ def eigenvalues_cp(A):
99100
ValueError: If number of rows != number of columns.
100101
"""
101102
check_symm_square(A)
102-
k = 5 if A.shape[0] > 5 else A.shape[0] - 2
103+
k = 6 if A.shape[0] > 5 else A.shape[0] - 2
103104
eigenvalues, _ = cp_eigsh(A, k=k)
104105
return eigenvalues
105106

0 commit comments

Comments
 (0)