SparseMatrix
01 Syntax
Microsoft.VisualBasic.Math.LinearAlgebra.Matrix.SparseMatrix
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| .ctor | 1 | |
| MultiplyTranspose | 1 | 计算转置矩阵与向量的乘积:result = Aᵀ·y |
| Get | 1 | |
| ArrayPack | 1 | convert to real [m,n] matrix |
| UnpackData | 1 |
03 Properties
| Name | Overloads | Summary |
|---|---|---|
| nnz | 1 | 非零元素个数(即内部字典存储的 (row, col, value) 三元组数量)。 |
04 Fields
| Name | Overloads | Summary |
|---|---|---|
| rows | 1 | just store the non-zero element index and the element value, all missing index is ZERO |
05 Members
#ctor(
Int32, Int32)Parameters
| Name | Type | Description |
|---|---|---|
m | Int32 | nrows |
n | Int32 | ncols |
MultiplyTranspose(
Double())计算转置矩阵与向量的乘积:result = Aᵀ·y
Remarks
直接遍历内部按行存储的非零元素字典完成计算,复杂度为 O(nnz), 不会将稀疏矩阵转置或稠密化。适用于随机化 SVD 等只依赖 稀疏矩阵-向量乘法黑盒接口的迭代算法。
Parameters
| Name | Type | Description |
|---|---|---|
y | Double() | 长度必须等于矩阵行数 m 的输入向量 |
Returns
长度为 n(列数)的结果向量
Get(
UInt32, UInt32)Parameters
| Name | Type | Description |
|---|---|---|
i | UInt32 | - |
j | UInt32 | - |
Returns
value of missing index is ZERO
ArrayPack(
Boolean)convert to real [m,n] matrix
Parameters
| Name | Type | Description |
|---|---|---|
deepcopy | Boolean | - |
Returns
A dense matrix data
UnpackData(
Single(), Int32(), Int32(), Int32)Parameters
| Name | Type | Description |
|---|---|---|
xdata | Single() | - |
xindices | Int32() | the corresponding index value of the xdata, this vector size of this parameter must be equals to the xdata! |
xindptr | Int32() | - |
nnz
非零元素个数(即内部字典存储的 (row, col, value) 三元组数量)。
rows
just store the non-zero element index and the element value, all missing index is ZERO