pub fn eigsh_generalized<T>(
a_matrix: &SymCsrMatrix<T>,
b_matrix: &SymCsrMatrix<T>,
k: Option<usize>,
which: Option<&str>,
options: Option<LanczosOptions>,
) -> SparseResult<EigenResult<T>>where
T: Float + Debug + Copy + Add<Output = T> + Sub<Output = T> + Mul<Output = T> + Div<Output = T> + Sum + SimdUnifiedOps + SparseElement + PartialOrd + Send + Sync + 'static,Expand description
Solve the generalized symmetric eigenvalue problem Ax = λBx
This function computes eigenvalues and eigenvectors for the generalized eigenvalue problem where both A and B are symmetric sparse matrices.
§Arguments
a_matrix- The A matrix (left-hand side)b_matrix- The B matrix (right-hand side, usually mass matrix)k- Number of eigenvalues to compute (optional, defaults to 6)which- Which eigenvalues to compute (“LA”, “SA”, “LM”, “SM”)options- Additional options for the solver
§Returns
Eigenvalue computation result where λ values satisfy Ax = λBx
§Examples
use scirs2_sparse::linalg::eigsh_generalized;
use scirs2_sparse::sym_csr::SymCsrMatrix;
// Create matrices A and B
// Symmetric 2x2 A stored as lower: (0,0)=4, (1,0)=2, (1,1)=3
let a_data = vec![4.0, 2.0, 3.0];
let a_indptr = vec![0, 1, 3];
let a_indices = vec![0, 0, 1];
let amatrix = SymCsrMatrix::new(a_data, a_indptr, a_indices, (2, 2)).unwrap();
// Symmetric 2x2 B stored as lower: (0,0)=2, (1,0)=1, (1,1)=2
let b_data = vec![2.0, 1.0, 2.0];
let b_indptr = vec![0, 1, 3];
let b_indices = vec![0, 0, 1];
let bmatrix = SymCsrMatrix::new(b_data, b_indptr, b_indices, (2, 2)).unwrap();
// Solve Ax = λBx
let result = eigsh_generalized(&amatrix, &bmatrix, Some(2), None, None).unwrap();