You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For two sparse matrices uploaded above (in the form of csc), the following code takes about 9 seconds to run in python
evals_np, evecs_np = sla.eigsh(L_eigsh, k=k_eig, M=Mmat, sigma=eigs_sigma)
where L_eigsh is read from clTripletSet.txt and Mmat is read from bTripletSet.txt using the folloiwng code. K_eig is set to be 128, and eigs_sigma is set to be 1e-8.
def read_sparse_matrix_from_file(file_path):
rows = []
cols = []
values = []
with open(file_path, 'r') as file:
for line in file:
row, col, value = line.strip().split()
rows.append(int(row))
cols.append(int(col))
values.append(float(value))
num_rows = max(rows) + 1
num_cols = max(cols) + 1
matrix = scipy.sparse.coo_matrix((values, (rows, cols)), shape=(num_rows, num_cols))
return matrix
Using the same two matrices and trying to solve the same general eigenvalue problem takes much longer - I stopped the process after waiting for 10 minutes. The code below is used for this purpose, after sparseA and sparseB are formulated from the same two files above where sparseA was formulated from clTripletSet.txt and sparseB was formulated from bTripletSet.txt.
Any advise on how to make Spectra performance into par with scipy.sparse.linalg.eigsh (with arpack as its underlying implementation), or is such performance gap expected?
The text was updated successfully, but these errors were encountered:
bTripletSet.txt
clTripletSet.txt
For two sparse matrices uploaded above (in the form of csc), the following code takes about 9 seconds to run in python
evals_np, evecs_np = sla.eigsh(L_eigsh, k=k_eig, M=Mmat, sigma=eigs_sigma)
where L_eigsh is read from clTripletSet.txt and Mmat is read from bTripletSet.txt using the folloiwng code. K_eig is set to be 128, and eigs_sigma is set to be 1e-8.
def read_sparse_matrix_from_file(file_path):
rows = []
cols = []
values = []
with open(file_path, 'r') as file:
for line in file:
row, col, value = line.strip().split()
rows.append(int(row))
cols.append(int(col))
values.append(float(value))
num_rows = max(rows) + 1
num_cols = max(cols) + 1
matrix = scipy.sparse.coo_matrix((values, (rows, cols)), shape=(num_rows, num_cols))
return matrix
Using the same two matrices and trying to solve the same general eigenvalue problem takes much longer - I stopped the process after waiting for 10 minutes. The code below is used for this purpose, after sparseA and sparseB are formulated from the same two files above where sparseA was formulated from clTripletSet.txt and sparseB was formulated from bTripletSet.txt.
template std::tuple<Vec, Vec<Vec<std::tuple<int32_t, T>>>>
ComputeSymmetricGeneralEigenSparse(
const Eigen::SparseMatrix& sparseA,
const Eigen::SparseMatrix& sparseB,
int32_t nEigenValuesRequested)
{
int32_t matrixDim = static_cast<int32_t>(sparseA.rows());
}
Any advise on how to make Spectra performance into par with scipy.sparse.linalg.eigsh (with arpack as its underlying implementation), or is such performance gap expected?
The text was updated successfully, but these errors were encountered: