package spurs
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module Spurs.Cstri
Source
type 'a t = {
rows : int;
cols : int;
row_inds : int Common.Dynarray.t;
col_inds : int Common.Dynarray.t;
data : 'a Common.Dynarray.t;
}
Sparse matrix in the triplet format.
Sparse matrices in the triplet format use three arrays of equal sizes (accessible through the methods `row_inds`
, `col_inds`
, `data`
), the first one storing the row indices of non-zero values, the second storing the corresponding column indices and the last array storing the corresponding scalar value. If a non-zero location is repeated in the arrays, the non-zero value is taken as the sum of the corresponding scalar entries.
This format is useful for iteratively building a sparse matrix, since the various non-zero entries can be specified in any order, or even partially as is common in physics with partial derivatives equations.
This format cannot be used for arithmetic operations. Arithmetic operations are more efficient in the compressed format. A matrix in the triplet format can be converted to the compressed format using the functions `to_csc`
and `to_csr`
.
val pp :
'a. (Ppx_deriving_runtime.Format.formatter ->
'a ->
Ppx_deriving_runtime.unit) ->
Ppx_deriving_runtime.Format.formatter ->
'a t ->
Ppx_deriving_runtime.unit
val show :
'a. (Ppx_deriving_runtime.Format.formatter ->
'a ->
Ppx_deriving_runtime.unit) ->
'a t ->
Ppx_deriving_runtime.string
val equal :
'a. ('a -> 'a -> Ppx_deriving_runtime.bool) ->
'a t ->
'a t ->
Ppx_deriving_runtime.bool