Class: Ignis::Solver::LUSolver
- Inherits:
-
Object
- Object
- Ignis::Solver::LUSolver
- Defined in:
- lib/nvruby/solver/lu.rb
Overview
LU Solver plan for repeated solves with the same matrix Caches the LU factorization for efficiency
Instance Attribute Summary collapse
-
#lu ⇒ NvArray
readonly
LU factored matrix.
-
#matrix ⇒ NvArray
readonly
Original matrix.
-
#n ⇒ Integer
readonly
Matrix dimension.
-
#pivot ⇒ FFI::Pointer
readonly
Pivot indices.
Instance Method Summary collapse
-
#destroy! ⇒ void
Release resources.
-
#initialize(matrix) ⇒ LUSolver
constructor
Create an LU solver for the given matrix.
-
#solve(b, trans: :none) ⇒ NvArray
Solve Ax = b using the cached factorization.
Constructor Details
#initialize(matrix) ⇒ LUSolver
Create an LU solver for the given matrix
227 228 229 230 231 232 |
# File 'lib/nvruby/solver/lu.rb', line 227 def initialize(matrix) @matrix = matrix validate! @n = matrix.shape[0] factorize! end |
Instance Attribute Details
#lu ⇒ NvArray (readonly)
Returns LU factored matrix.
217 218 219 |
# File 'lib/nvruby/solver/lu.rb', line 217 def lu @lu end |
#matrix ⇒ NvArray (readonly)
Returns Original matrix.
214 215 216 |
# File 'lib/nvruby/solver/lu.rb', line 214 def matrix @matrix end |
#n ⇒ Integer (readonly)
Returns Matrix dimension.
223 224 225 |
# File 'lib/nvruby/solver/lu.rb', line 223 def n @n end |
#pivot ⇒ FFI::Pointer (readonly)
Returns Pivot indices.
220 221 222 |
# File 'lib/nvruby/solver/lu.rb', line 220 def pivot @pivot end |
Instance Method Details
#destroy! ⇒ void
This method returns an undefined value.
Release resources
244 245 246 247 248 |
# File 'lib/nvruby/solver/lu.rb', line 244 def destroy! @pivot&.free! @pivot = nil @factorized = false end |