Generated by DocFX

Class Sparse

Extension methods for sparse vectors.

Inheritance
System.Object
Sparse
Namespace: ISynergy.Framework.Mathematics.Common
Assembly: ISynergy.Framework.Mathematics.dll
Syntax
public static class Sparse : object

Methods

View Source

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
Name Description
T
View Source

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 Description
Sparse<T>
Type Parameters
Name Description
T
View Source

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 Description
Sparse<T>[]
Type Parameters
Name Description
T
View Source

FromDictionary(IDictionary<Int32, Int32>)

Creates a sparse vector from a dictionary mapping indices to values.

Declaration
public static Sparse<double> FromDictionary(IDictionary<int, int> dictionary)
Parameters
Type Name Description
IDictionary<System.Int32, System.Int32> dictionary
Returns
Type Description
Sparse<System.Double>
View Source

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>
View Source

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>
View Source

ToDense<T>(Sparse<T>[])

Converts an array of sparse vectors into a jagged matrix.

Declaration
public static T[][] ToDense<T>(this Sparse<T>[] vectors)
    where T : IEquatable<T>
Parameters
Type Name Description
Sparse<T>[] vectors
Returns
Type Description
T[][]
Type Parameters
Name Description
T
View Source

ToDense<T>(Sparse<T>[], Int32)

Converts an array of sparse vectors into a jagged matrix.

Declaration
public static T[][] ToDense<T>(this Sparse<T>[] vectors, int length)
    where T : IEquatable<T>
Parameters
Type Name Description
Sparse<T>[] vectors
System.Int32 length
Returns
Type Description
T[][]
Type Parameters
Name Description
T