class

LA::BandedMatrix(T)

Inherits LA::Matrix / LA::LapackHelper / Enumerable / Reference / Object

banded matrix, heap-allocated

Constructors

new(nrows : Int32, ncolumns : Int32, upper_band : Int32, lower_band : Int32, values : Indexable)
Source
new(nrows, ncolumns, upper_band, values : Indexable)
Source
new(nrows : Int32, ncolumns : Int32, upper_band : Int32, lower_band : Int32 = upper_band, flags : LA::MatrixFlags = MatrixFlags::None)
Source
new(nrows : Int32, ncolumns : Int32, upper_band : Int32, lower_band : Int32 = upper_band, flags : LA::MatrixFlags = MatrixFlags::None, &)
Source
new(matrix : BandedMatrix)
Source
new(matrix : Matrix, tolerance = matrix.tolerance)
Source

Class methods

diag(nrows, ncolumns, values)
Source
estimate(matrix : Matrix(T), tolerance = matrix.tolerance)
Source
rand(nrows, ncolumns, upper_band : Int32, lower_band : Int32, rng : Random = Random::DEFAULT)
Source
rand(nrows, ncolumns, upper_band : Int32, rng : Random = Random::DEFAULT)
Source

Instance methods

+(m : BandedMatrix(T))

returns element-wise sum

Source
-(m : BandedMatrix(T))

returns element-wise subtract

Source
==(other : BandedMatrix(T))
Source
add!(k : Number, m : BandedMatrix)
Source
add!(k : Number, m : Matrix)

Perform inplace addition with matrix m multiplied to scalar k

a.add!(k, b) is equal to a = a + k * b, but faster as no new matrix is allocated

Source
clone
Source
conjtranspose

returns conjtransposed matrix

Source
det(*, overwrite_a = false)

Calculates determinant for a square matrix

if overwrite_a is true, a will be overriden in process of calculation

Uses getrf LAPACK routine

Source
dup

Returns a shallow copy of this object.

This allocates a new object and copies the contents of self into it.

Source
each_index(*, all = false, &)

Yields every index

all argument controls whether to yield all or non-empty elements for banded\sparse matrices Example: m.each_index { |i, j| m[i, j] = -m[i, j] }

Source
flags

Returns flags of matrix (see MatrixFlags)

Source
flags=(flags : MatrixFlags)

Returns flags of matrix (see MatrixFlags)

Source
lower_band
Source
lower_band=(value)
Source
map_with_index

Returns result of appliyng block to every element with index

Source
map_with_index_complex
Source
map_with_index_f64

TODO - macro magic?

Source
ncolumns

Returns number of columns in matrix

Source
norm(kind : MatrixNorm = MatrixNorm::Frobenius)

returns matrix norm

Source
nrows

Returns number of rows in matrix

Source
set_bands(aupper, alower) : Nil
Source
solve(b : GeneralMatrix(T), *, overwrite_a = false, overwrite_b = false)
Source
to_unsafe

Returns pointer to underlying data

Storage format depends of matrix type This method raises at runtime if matrix doesn't have raw pointer

Source
transpose

returns transposed matrix

Source
transpose!
Source
tril(k = 0)

Same as tril in scipy - returns lower triangular or trapezoidal part of matrix

Returns a matrix with all elements above k-th diagonal zeroed

Source
tril!(k = 0)

Works like a tril in scipy - remove all elements above k-diagonal

Source
triu(k = 0)

Same as triu in scipy - returns upper triangular or trapezoidal part of matrix

Returns a matrix with all elements below k-th diagonal zeroed

Source
triu!(k = 0)

Works like a triu in scipy - remove all elements below k-diagonal

Source
unsafe_fetch(i, j)
Source
unsafe_set(i, j, value)
Source
upper_band
Source
upper_band=(value)
Source