Constructor
new Matrix(summary, path, fetch_range)
Parameters:
Name | Type | Description |
---|---|---|
summary |
object | A summary of the matrix contents, according to the wobbegong specifications. |
path |
string | Path to the matrix directory. This may be a relative or absolute path, depending on how the files are hosted. |
fetch_range |
function | A function that accepts |
Classes
Methods
numberOfColumns() → {number}
Returns:
Number of columns.
- Type
- number
numberOfRows() → {number}
Returns:
Number of rows.
- Type
- number
(async) row(i, optionsopt) → {object|Array|Int32Array|Float64Array}
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
i |
number | Row index. |
|||||||||||||||||
options |
object |
<optional> |
{}
|
Further options. Properties
|
Returns:
If asDense = true
or sparse
is false, an array of length equal to the number of columns is returned, containing the contents of row i
in dense form.
Otherwise, an object is returned containing value
, an array of the values of the structural non-zero elements of row i
; and index
, a Int32Array of column indices for each entry of value
.
All indices are guaranteed to be sorted and unique.
- Type
- object | Array | Int32Array | Float64Array
sparse() → {boolean}
Returns:
Whether this matrix is sparse.
- Type
- boolean
statistic(name, optionsopt) → {object|Array|Int32Array|Float64Array}
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
string | Name of the statistic, as described in |
|||||||||||||||||
options |
object |
<optional> |
{}
|
Further options. Properties
|
Returns:
If type = false
, an array containing the statistic i
.
If type = true
, this is instead an object containing type
, a string with the statistic's type; and value
, an array with the statistic itself.
- Type
- object | Array | Int32Array | Float64Array
statisticNames(optionsopt) → {Array}
- Description:
List available statistics. Each matrix is guaranteed to have at least:
row_sum
, the summed value within each row.column_sum
, the summed value within each column.row_nonzero
, the number of non-zero entries within each row.column_nonzero
, the number of non-zero entries within each column.
- Source:
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
{}
|
Further options. Properties
|
Returns:
Names of the available statistics.
If types = true
, each entry is an object specifying the name
and type
of the column;
otherwise, each entry is a string.
- Type
- Array
type() → {string}
Returns:
Type of the matrix, typically either boolean
, integer
or double
.
- Type
- string