Class PackedSparseMatrix
This is a sparse matrix where each row is an array of (column,value) pairs
This is more efficient for Matrix*Vector multiply.
Inheritance
PackedSparseMatrix
Namespace: g3
Assembly: cs.temp.dll.dll
Syntax
public class PackedSparseMatrix
Constructors
PackedSparseMatrix(DVector<matrix_entry>, Int32, Int32, Boolean)
Declaration
public PackedSparseMatrix(DVector<matrix_entry> entries, int numRows, int numCols, bool bSymmetric = true)
Parameters
PackedSparseMatrix(PackedSparseMatrix)
Declaration
public PackedSparseMatrix(PackedSparseMatrix copy)
Parameters
PackedSparseMatrix(SymmetricSparseMatrix, Boolean)
Declaration
public PackedSparseMatrix(SymmetricSparseMatrix m, bool bTranspose = false)
Parameters
Fields
Columns
Declaration
Field Value
IsSymmetric
Declaration
Field Value
NumNonZeros
Declaration
Field Value
Rows
Declaration
public PackedSparseMatrix.nonzero[][] Rows
Field Value
Sorted
Declaration
Field Value
StorageMode
Declaration
public PackedSparseMatrix.StorageModes StorageMode
Field Value
Properties
FrobeniusNorm
Declaration
public double FrobeniusNorm { get; }
Property Value
Item[Int32, Int32]
Declaration
public double this[int r, int c] { get; set; }
Parameters
Property Value
MaxNorm
Declaration
public double MaxNorm { get; }
Property Value
Trace
Declaration
public double Trace { get; }
Property Value
Methods
DotColumnVector(Int32, Double[], Int32, Int32)
Compute dot product of this.row[r1] and this.row[r2], up to N elements
Declaration
public double DotColumnVector(int c, double[] vec, int start_row = 0, int end_row = 2147483647)
Parameters
Returns
DotRowAllColumns(Int32, Double[], Int32[], PackedSparseMatrix)
Compute dot product of this.row[r] with all columns of M,
where columns are stored in MTranspose rows.
In theory more efficient than doing DotRowColumn(r,c) for each c,
however so far the difference is negligible...perhaps because
there are quite a few more branches in the inner loop
Declaration
public void DotRowAllColumns(int r, double[] sums, int[] col_indices, PackedSparseMatrix MTranspose)
Parameters
DotRowColumn(Int32, Int32, PackedSparseMatrix)
Compute dot product of this.row[r] and M.col[c], where the
column is stored as MTranspose.row[c]
Declaration
public double DotRowColumn(int r, int c, PackedSparseMatrix MTranspose)
Parameters
Returns
DotRows(Int32, Int32, Int32)
Compute dot product of this.row[r1] and this.row[r2], up to N elements
Declaration
public double DotRows(int r1, int r2, int MaxCol = 2147483647)
Parameters
Returns
DotRowSelf(Int32)
Dot product of this.row[r] with itself
Declaration
public double DotRowSelf(int r)
Parameters
Type |
Name |
Description |
Int32 |
r |
|
Returns
DotRowVector(Int32, Double[], Int32)
Compute dot product of this.row[r] and vec, up to N elements
Declaration
public double DotRowVector(int r, double[] vec, int MaxCol = 2147483647)
Parameters
Returns
FromDense(DenseMatrix, Boolean)
Declaration
public static PackedSparseMatrix FromDense(DenseMatrix m, bool bSymmetric)
Parameters
Returns
MatrixInfo(Boolean)
Declaration
public string MatrixInfo(bool bExtended = false)
Parameters
Type |
Name |
Description |
Boolean |
bExtended |
|
Returns
Multiply(Double[], Double[])
Declaration
public void Multiply(double[] X, double[] Result)
Parameters
Multiply_Parallel(Double[], Double[])
Declaration
public void Multiply_Parallel(double[] X, double[] Result)
Parameters
Multiply_Parallel_3(Double[][], Double[][])
Hardcoded variant for 3 RHS vectors, much faster
Declaration
public void Multiply_Parallel_3(double[][] X, double[][] Result)
Parameters
NonZeroIndicesByRow(Boolean)
Declaration
public IEnumerable<Vector2i> NonZeroIndicesByRow(bool bWantSorted = true)
Parameters
Type |
Name |
Description |
Boolean |
bWantSorted |
|
Returns
NonZeroIndicesForRow(Int32, Boolean)
Declaration
public IEnumerable<Vector2i> NonZeroIndicesForRow(int r, bool bWantSorted = true)
Parameters
Returns
NonZerosRange(Int32)
For row r, find interval that nonzeros lie in
Declaration
public Interval1i NonZerosRange(int r)
Parameters
Type |
Name |
Description |
Int32 |
r |
|
Returns
Sort(Boolean)
Declaration
public void Sort(bool bParallel = true)
Parameters
Type |
Name |
Description |
Boolean |
bParallel |
|
Square()
Declaration
public PackedSparseMatrix Square()
Returns