6.3.90.900
Semi-persistent Matrices
(require data/spmatrix) | package: spmatrix |
This package defines matrices using semi-persistent vectors from data/spvector
procedure
(build-matrix rows cols cell-f) → matrix?
rows : exact-positive-integer? cols : exact-positive-integer? cell-f : (exact-nonnegative-integer? exact-nonnegative-integer? . -> . any/c)
Determines if v is a valid matrix.
procedure
m : matrix?
Returns how many rows m has.
procedure
m : matrix?
Returns how many cols m has.
procedure
(matrix-valid-ref? m ri ci) → boolean?
m : matrix? ri : exact-nonnegative-integer? ci : exact-nonnegative-integer?
procedure
(matrix-ref m ri ci) → any/c
m : matrix? ri : exact-nonnegative-integer? ci : exact-nonnegative-integer?
Extracts the value of a cell in the matrix.
procedure
(matrix-set m ri ci v) → matrix?
m : matrix? ri : exact-nonnegative-integer? ci : exact-nonnegative-integer? v : any/c
Semi-persistently modifies m.
procedure
(matrix-set! m ri ci v) → void
m : matrix? ri : exact-nonnegative-integer? ci : exact-nonnegative-integer? v : any/c
Destructively modifies m.
procedure
(matrix-fold m row-f cell-f acc) → any/c
m : matrix? row-f : (exact-nonnegative-integer? any/c . -> . any/c) cell-f : (exact-nonnegative-integer? exact-nonnegative-integer? any/c any/c . -> . any/c) acc : any/c
Like foldr but for matrices. row-f is called with the result of cell-f from the last column in the row.
cell-f is called from left to right.
procedure
(display-matrix m) → void
m : matrix?