Class Sparse
Inheritance
System.Object
Sparse
Assembly: Mars.Numerics.dll
Syntax
public static class Sparse : object
Methods
Columns<T>(Sparse<T>[])
Gets the maximum number of columns (dimensions)
that can be inferred from the given sparse vectors.
Declaration
public static int Columns<T>(this Sparse<T>[] inputs)
where T : IEquatable<T>
Parameters
Type |
Name |
Description |
Sparse<T>[] |
inputs |
|
Returns
Type |
Description |
System.Int32 |
|
Type Parameters
FromDense<T>(T[], Boolean)
Creates a sparse vector from a dense array.
Declaration
public static Sparse<T> FromDense<T>(T[] dense, bool removeZeros = true)
where T : IEquatable<T>
Parameters
Type |
Name |
Description |
T[] |
dense |
|
System.Boolean |
removeZeros |
|
Returns
Type Parameters
FromDense<T>(T[][], Boolean)
Creates sparse vectors from dense arrays.
Declaration
public static Sparse<T>[] FromDense<T>(T[][] dense, bool removeZeros = true)
where T : IEquatable<T>
Parameters
Type |
Name |
Description |
T[][] |
dense |
|
System.Boolean |
removeZeros |
|
Returns
Type Parameters
Parse(String, Nullable<Double>)
Parses a string containing a sparse array in LibSVM
format into a
Sparse<T> vector.
Declaration
public static Sparse<double> Parse(string values, double? insertValueAtBeginning = null)
Parameters
Type |
Name |
Description |
System.String |
values |
An array of "index:value" strings indicating
where each value belongs in the sparse vector.
|
System.Nullable<System.Double> |
insertValueAtBeginning |
Whether an intercept term should be added
at the beginning of the vector.
|
Returns
Type |
Description |
Sparse<System.Double> |
|
Parse(String[], Nullable<Double>, CultureInfo)
Parses a string containing a sparse array in LibSVM
format into a
Sparse<T> vector.
Declaration
public static Sparse<double> Parse(string[] values, double? insertValueAtBeginning = null, CultureInfo cultureInfo = null)
Parameters
Type |
Name |
Description |
System.String[] |
values |
An array of "index:value" strings indicating
where each value belongs in the sparse vector.
|
System.Nullable<System.Double> |
insertValueAtBeginning |
Whether an intercept term should be added
at the beginning of the vector.
|
CultureInfo |
cultureInfo |
The culture when parsing numbers e.g. comma for decimal or dot. |
Returns
Type |
Description |
Sparse<System.Double> |
|