Module: Ignis::Solver
- Defined in:
- lib/nvruby/solver.rb,
lib/nvruby/solver/lu.rb,
lib/nvruby/solver/svd.rb,
lib/nvruby/solver/eigen.rb,
lib/nvruby/solver/amgx_config.rb,
lib/nvruby/solver/amgx_solver.rb,
lib/nvruby/solver/amgx_bindings.rb,
lib/nvruby/solver/sparse_solver.rb,
lib/nvruby/solver/cudss_bindings.rb,
lib/nvruby/solver/cusolver_bindings.rb
Defined Under Namespace
Modules: AMGXBindings, CuDSSBindings, CuSolverBindings, Eigen, LU, SVD Classes: AMGXConfig, AMGXError, AMGXSolver, CuDSSError, LUSolver, SparseSolver, StateError
Class Method Summary collapse
-
.available? ⇒ Boolean
Check if cuSOLVER is available.
-
.cond(matrix) ⇒ Float
Condition number via SVD.
-
.eig(matrix) ⇒ Hash
Eigenvalue decomposition of general matrix.
-
.eigh(matrix, eigenvectors: true) ⇒ Hash
Eigenvalue decomposition of symmetric/Hermitian matrix.
-
.eigvalsh(matrix) ⇒ NvArray
Eigenvalues of symmetric/Hermitian matrix.
-
.finalize! ⇒ void
Finalize cuSOLVER (release resources).
-
.lu(matrix) ⇒ Hash
LU decomposition with partial pivoting.
-
.lu_solver(matrix) ⇒ LUSolver
Create an LU solver for repeated solves.
-
.matrix_rank(matrix, tol: nil) ⇒ Integer
Matrix rank via SVD.
-
.solve(a, b) ⇒ NvArray
Solve linear system Ax = b.
-
.sparse_solve(sparse_matrix, b, matrix_type: :general) ⇒ NvArray
Solve sparse linear system Ax = b using cuDSS.
-
.sparse_solver(sparse_matrix, matrix_type: :general) ⇒ SparseSolver
Create a sparse solver for repeated solves with same sparsity pattern.
-
.svd(matrix, full_matrices: false) ⇒ Hash
Singular Value Decomposition.
-
.svdvals(matrix) ⇒ NvArray
Compute singular values only.
Class Method Details
.available? ⇒ Boolean
Check if cuSOLVER is available
108 109 110 111 112 113 |
# File 'lib/nvruby/solver.rb', line 108 def available? CuSolverBindings.ensure_loaded! true rescue StandardError false end |
.cond(matrix) ⇒ Float
Condition number via SVD
78 79 80 |
# File 'lib/nvruby/solver.rb', line 78 def cond(matrix) SVD.cond(matrix) end |
.eig(matrix) ⇒ Hash
Eigenvalue decomposition of general matrix
63 64 65 |
# File 'lib/nvruby/solver.rb', line 63 def eig(matrix) Eigen.eig(matrix) end |
.eigh(matrix, eigenvectors: true) ⇒ Hash
Eigenvalue decomposition of symmetric/Hermitian matrix
49 50 51 |
# File 'lib/nvruby/solver.rb', line 49 def eigh(matrix, eigenvectors: true) Eigen.eigh(matrix, eigenvectors: eigenvectors) end |
.eigvalsh(matrix) ⇒ NvArray
Eigenvalues of symmetric/Hermitian matrix
56 57 58 |
# File 'lib/nvruby/solver.rb', line 56 def eigvalsh(matrix) Eigen.eigvalsh(matrix) end |
.finalize! ⇒ void
This method returns an undefined value.
Finalize cuSOLVER (release resources)
117 118 119 |
# File 'lib/nvruby/solver.rb', line 117 def finalize! CuSolverBindings.finalize! end |
.lu(matrix) ⇒ Hash
LU decomposition with partial pivoting
26 27 28 |
# File 'lib/nvruby/solver.rb', line 26 def lu(matrix) LU.getrf(matrix) end |
.lu_solver(matrix) ⇒ LUSolver
Create an LU solver for repeated solves
85 86 87 |
# File 'lib/nvruby/solver.rb', line 85 def lu_solver(matrix) LUSolver.new(matrix) end |
.matrix_rank(matrix, tol: nil) ⇒ Integer
Matrix rank via SVD
71 72 73 |
# File 'lib/nvruby/solver.rb', line 71 def matrix_rank(matrix, tol: nil) SVD.rank(matrix, tol: tol) end |
.solve(a, b) ⇒ NvArray
Solve linear system Ax = b
19 20 21 |
# File 'lib/nvruby/solver.rb', line 19 def solve(a, b) LU.solve(a, b) end |
.sparse_solve(sparse_matrix, b, matrix_type: :general) ⇒ NvArray
Solve sparse linear system Ax = b using cuDSS
94 95 96 |
# File 'lib/nvruby/solver.rb', line 94 def sparse_solve(sparse_matrix, b, matrix_type: :general) SparseSolver.solve(sparse_matrix, b, matrix_type: matrix_type) end |
.sparse_solver(sparse_matrix, matrix_type: :general) ⇒ SparseSolver
Create a sparse solver for repeated solves with same sparsity pattern
102 103 104 |
# File 'lib/nvruby/solver.rb', line 102 def sparse_solver(sparse_matrix, matrix_type: :general) SparseSolver.new(sparse_matrix, matrix_type: matrix_type) end |
.svd(matrix, full_matrices: false) ⇒ Hash
Singular Value Decomposition
34 35 36 |
# File 'lib/nvruby/solver.rb', line 34 def svd(matrix, full_matrices: false) SVD.gesvd(matrix, full_matrices: full_matrices) end |
.svdvals(matrix) ⇒ NvArray
Compute singular values only
41 42 43 |
# File 'lib/nvruby/solver.rb', line 41 def svdvals(matrix) SVD.singular_values(matrix) end |