class

LA::Sparse::COOMatrix(T)

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

Constructors

new(nrows, ncolumns, rows : Array(Int32), columns : Array(Int32), values : Array(T), flags = MatrixFlags::None, *, dont_clone : Bool = false, dont_check : Bool = false, dictionary = nil)
Source
new(nrows, ncolumns, capacity = 0)
Source
new(matrix : COOMatrix(T))
Source
new(matrix : COOMatrix)
Source
new(matrix : LA::Matrix)
Source

Class methods

diag(nrows, ncolumns, values)

Returns diagonal matrix of given size with diagonal elements taken from array values

Raises if values.size > {nrows, ncolumns}.min

Source
diag(nrows, ncolumns, &)

Returns diagonal matrix of given size with diagonal elements equal to block value

Source
rand(nrows, ncolumns, *, nonzero_elements, rng : Random = Random::DEFAULT)
Source
rand(nrows, ncolumns, *, fill_factor, rng : Random = Random::DEFAULT)
Source

Instance methods

add!(k : Number | Complex, m : Sparse::Matrix)
Source
clear
Source
conjtranspose

Returns conjurgate transposed matrix

result is same as #transpose for real matrices

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
each_with_index(*, all = false, &)

Yields every element of matrix with corresponding row and column

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

Source
map_with_index

Returns result of appliyng block to every element with index

Source
map_with_index!

Yields each element with index and replace it with returned value

Source
map_with_index_complex
Source
map_with_index_f64

TODO - macro magic?

Source
nonzeros
Source
resize!(anrows, ancolumns)
Source
select!
Source
select_index!
Source
select_with_index!
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