• MARS Website
  • Core API
  • SmartOpenHamburg API
  • Model Components API
  • Common API
Show / Hide Table of Contents
  • Mars.Common
    • GeoHash
    • GeoHashDecoder
    • GeohashDecodeResult
    • GeoHashEncoder
    • GeoHashPrecision
    • Hyperrectangle
    • InputHashHelper
    • PositionHelper
  • Mars.Common.Collections
    • BinaryArrayHeap<T>
    • DoubleBits
    • FibonacciHeap<T, TKey>
    • FibonacciHeapDoubleKey<T>
    • FibonacciHeapNode<T, TKey>
    • FibonacciHeapNodeDoubleKey<T>
    • HeapNode
    • IntervalSize
    • K2DTree<T>
    • K2dTreeNode<T>
    • KdTree
    • KdTree<T>
    • KdTreeBase<TNode>
    • KdTreeNode
    • KdTreeNode<T>
    • KdTreeNodeBase<TNode>
    • KdTreeNodeCollection<TNode>
    • KdTreeNodeList<T>
    • Key
    • Node<T>
    • NodeBase<T>
    • NodeDataContainer<T>
    • NodeDistance<TNode>
    • QuadTree<T>
    • Root<T>
    • TreeDataContainer<T>
  • Mars.Common.Collections.CritBit
    • ICritBitTree<TValue>
  • Mars.Common.Collections.Graph
    • EdgeData
    • GraphData
    • GraphSerializer
    • ISpatialGraph
    • KeyContainer
    • NodeData
    • SpatialGraph
    • SpatialGraphHelper
  • Mars.Common.Collections.Graph.Algorithms
    • AStar
    • CompressedPathDatabase
    • ContractionSearch
    • DepthLimitedTraversal
  • Mars.Common.Collections.Graph.Helper
    • INodeFinder
    • KdTreeNodeFinder
    • RunLengthEncoder
  • Mars.Common.Collections.KNNGraph
    • DefaultRandomGenerator
    • DistanceUtils
    • EventSources
    • EventSources.GraphBuildEventSource
    • EventSources.GraphSearchEventSource
    • IProgressReporter
    • IProvideRandomValues
    • KnnGraph<TItem, TDistance>
    • KnnGraph<TItem, TDistance>.KnnSearchResult
    • KnnGraph<TItem, TDistance>.Parameters
    • Node
    • ReverseComparer<T>
    • ReverseComparerExtensions
    • SelectionKind
    • TravelingCosts<TItem, TDistance>
  • Mars.Common.Compat
    • FormatDecoderAttribute
    • FormatEncoderAttribute
    • FormatHandlerAttribute
    • IntegerAttribute
    • NegativeIntegerAttribute
    • NonnegativeIntegerAttribute
    • NonpositiveIntegerAttribute
    • PositiveIntegerAttribute
  • Mars.Common.Data
    • DomainDataImporter
  • Mars.Common.Data.Providers
    • AscDataProvider
    • GeoJsonFeatureCollectionConverter
    • GeoJsonFeatureConverter
    • GeoJsonHelper
    • GeometryDataProvider
    • GraphMlProvider
    • HttpDataProvider
    • IDataProvider<TInput>
    • JsonFileDataProvider
    • JsonTextDataProvider
    • XmlFileDataProvider
    • XmlTextDataProvider
  • Mars.Common.Exceptions
    • DimensionMismatchException
    • ParseException
  • Mars.Common.IO
    • ExtensionMethods
    • FileClientUtils
    • FileKeys
    • HttpClientUtils
    • ObjectSerialize
    • Serializer
    • SerializerCompression
    • SparseFormat
    • SparseReader
    • SparseWriter
  • Mars.Common.IO.Attributes
    • SerializationBinderAttribute
    • SurrogateSelectorAttribute
  • Mars.Common.IO.Console
    • ChildProgressBar
    • IProgressBar
    • ProgressBar
    • ProgressBarBase
    • ProgressBarHeight
    • ProgressBarOptions
    • ProgressBarSimple
  • Mars.Common.IO.Csv
    • CsvAnalyzer
    • CsvReader
    • CsvReader.RecordEnumerator
    • CsvWriter
    • MissingFieldAction
    • ParseErrorAction
    • ValueTrimmingOptions
  • Mars.Common.IO.Events
    • ParseErrorEventArgs
  • Mars.Common.IO.Exceptions
    • MalformedCsvException
    • MissingFieldCsvException
  • Mars.Common.IO.Mapped
    • Context
    • DefaultArrayFactory
    • Extensions
    • IArrayFactory
    • ISerializableToStream
    • MappedAccessor<T>
    • MemoryMap
    • MemoryMap.CreateAccessorFunc<T>
    • MemoryMap.ReadFromDelegate<T>
    • MemoryMap.WriteToDelegate<T>
    • MemoryMapDelegates
    • MemoryMapDelegates.CreateAccessorFunc<T>
    • MemoryMapStream
  • Mars.Common.IO.Mapped.Accessors
    • MappedAccessorByte
    • MappedAccessorDouble
    • MappedAccessorInt16
    • MappedAccessorInt32
    • MappedAccessorInt64
    • MappedAccessorSingle
    • MappedAccessorUInt16
    • MappedAccessorUInt32
    • MappedAccessorUInt64
    • MappedAccessorVariable<T>
  • Mars.Common.IO.Mapped.Arrays
    • Array<T>
    • ArrayBase<T>
    • ArrayProfile
    • MappedArray<TMapped, T>
    • MappedArray<TMapped, T>.MapFrom
    • MappedArray<TMapped, T>.MapTo
    • MemoryArray<T>
    • VariableArray<T>
  • Mars.Common.IO.Mapped.Collections
    • MemoryBackedDictionary<TKey, TValue>
    • MemoryBackedList<T>
  • Mars.Common.IO.Mapped.Indexes
    • Index<T>
  • Mars.Common.IO.Mapped.Streams
    • CappedStream
  • Mars.Common.Socket
    • ByteOrder
    • CloseEventArgs
    • CloseStatusCode
    • CompressionMethod
    • ErrorEventArgs
    • Ext
    • MessageEventArgs
    • WebSocket
    • WebSocketException
    • WebSocketState
  • Mars.Common.Socket.Server
    • IWebSocketSession
    • WebHeaderCollection
    • WebSocketBehavior
    • WebSocketContext
    • WebSocketServer
    • WebSocketServiceHost
    • WebSocketServiceManager
    • WebSocketSessionManager
  • Mars.Numerics
    • Classes
    • Combinatorics
    • Constants
    • Distance
    • Elementwise
    • Jagged
    • MathematicsException
    • MathHelper
    • Matrix
    • MatrixOrder
    • MatrixType
    • Norm
    • Sort
    • Sorting
    • Sparse
    • Sparse<T>
    • Tools
    • Vector
    • VectorHelper
    • VectorType
  • Mars.Numerics.Comparers
    • ArrayComparer<T>
    • ComparerDirection
    • CustomComparer<T>
    • ElementComparer
    • ElementComparer<T>
    • GeneralComparer
    • StableComparer<T>
  • Mars.Numerics.Distances
    • Angular
    • Chebyshev
    • Cosine
    • Dirac<T>
    • Euclidean
    • Hamming
    • Hamming<T>
    • Haversine
    • Jaccard
    • Jaccard<T>
    • Kulczynski
    • Levenshtein
    • Levenshtein<T>
    • Manhattan
    • Matching
    • Minkowski
    • SquareEuclidean
    • Vincenty
    • Vincenty.Ellipsoid
  • Mars.Numerics.Distances.Base
    • IDistance<T>
    • IDistance<TFirst, TSecond>
    • IMetric<T>
    • ISimilarity<T, TU>
    • ISimilarity<T>
  • Mars.Numerics.Exceptions
    • DimensionMismatchException
    • NonPositiveDefiniteMatrixException
    • SingularMatrixException
  • Mars.Numerics.Formats
    • DefaultMatrixFormatProvider
    • IMatrixFormatProvider
    • MatrixFormatProviderBase
    • MatrixFormatter
    • OctaveMatrixFormatProvider
  • Mars.Numerics.Ranges
    • ByteRange
    • DoubleRange
    • FloatRange
    • IntRange
    • IRange<T>
  • Mars.Numerics.Statistics
    • ConstValueDistribution<T>
    • Distribution<T>
    • FastGaussianDistributionD
    • FastGaussianDistributionF
    • IDistribution
    • UniformDiscreteDistribution
    • UniformDistributionD
    • UniformDistributionF
  • Mars.Numerics.Statistics.Base
    • BinarySearch
    • DistributionBase
    • ISampleableDistribution<TObservations>
    • IUnivariateDistribution
    • IUnivariateDistribution<TObservation>
    • UnivariateDiscreteDistribution

Class Sparse<T>

Sparse vector representation (in LibSVM format).
Inheritance
System.Object
Sparse<T>
Implements
System.ICloneable
System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IList
System.Collections.ICollection
System.Collections.IEnumerable
System.IFormattable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Mars.Numerics
Assembly: Mars.Numerics.dll
Syntax
[Serializable]
public sealed class Sparse<T> : ICloneable, IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable, IFormattable where T : IEquatable<T>
Type Parameters
Name Description
T The type for the non-zero elements in this vector.

Constructors

| Improve this Doc View Source

Sparse()

Creates a sparse vector with zero elements.
Declaration
public Sparse()
| Improve this Doc View Source

Sparse(Int32)

Creates a sparse vector with the maximum number of elements.
Declaration
public Sparse(int length)
Parameters
Type Name Description
System.Int32 length The maximum number of non-zero elements that this vector can accomodate.
| Improve this Doc View Source

Sparse(Int32[], T[])

Creates a sparse vector from a vector of indices and a vector of values occuring at those indices.
Declaration
public Sparse(int[] indices, T[] values)
Parameters
Type Name Description
System.Int32[] indices The indices for non-zero entries.
T[] values The non-zero values happening at each index.

Properties

| Improve this Doc View Source

Indices

Gets or sets the vector of indices indicating the location of the non-zero elements contained in this sparse vector.
Declaration
public int[] Indices { get; set; }
Property Value
Type Description
System.Int32[]
| Improve this Doc View Source

Item[Int32]

Gets the the value stored at position i.
Declaration
public T this[int i] { get; set; }
Parameters
Type Name Description
System.Int32 i
Property Value
Type Description
T
| Improve this Doc View Source

Length

Gets the maximum non-zero element index in the sparse vector.
Declaration
public int Length { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Values

Gets or sets the vector of values indicating which non-zero value happens at each position indicated in Indices.
Declaration
public T[] Values { get; set; }
Property Value
Type Description
T[]

Methods

| Improve this Doc View Source

Clone()

Creates a new object that is a copy of the current instance.
Declaration
public object Clone()
Returns
Type Description
System.Object A new object that is a copy of this instance.
| Improve this Doc View Source

CopyTo(T[], Int32)

Copies the elements of the System.Collections.Generic.ICollection<T> to an System.Array, starting at a particular System.Array index.
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type Name Description
T[] array The one-dimensional System.Array that is the destination of the elements copied from System.Collections.Generic.ICollection<T>. The System.Array must have zero-based indexing.
System.Int32 arrayIndex The zero-based index in array at which copying begins.
| Improve this Doc View Source

IsFull()

Determines whether this Sparse vector has elements on all indices.
Declaration
public bool IsFull()
Returns
Type Description
System.Boolean true if this instance is full; otherwise, false.
| Improve this Doc View Source

ToDense()

Converts this sparse vector to a dense vector of the given length.
Declaration
public T[] ToDense()
Returns
Type Description
T[]
| Improve this Doc View Source

ToDense(Int32)

Converts this sparse vector to a dense vector of the given length.
Declaration
public T[] ToDense(int length)
Parameters
Type Name Description
System.Int32 length
Returns
Type Description
T[]
| Improve this Doc View Source

ToSparse()

Converts this sparse vector to a sparse representation where the indices are intertwined with their corresponding values.
Declaration
public T[] ToSparse()
Returns
Type Description
T[]
| Improve this Doc View Source

ToString()

Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
Type Description
System.String A System.String that represents this instance.
Overrides
System.Object.ToString()
| Improve this Doc View Source

ToString(String, IFormatProvider)

Returns a System.String that represents this instance.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type Name Description
System.String format The format.
System.IFormatProvider formatProvider The format provider.
Returns
Type Description
System.String A System.String that represents this instance.

Operators

| Improve this Doc View Source

Implicit(Sparse<T> to Array)

Performs an implicit conversion from Sparse<T> to System.Array.
Declaration
public static implicit operator Array(Sparse<T> obj)
Parameters
Type Name Description
Sparse<T> obj
Returns
Type Description
System.Array

Explicit Interface Implementations

| Improve this Doc View Source

ICollection<T>.Add(T)

Sparse vector representation (in LibSVM format).
Declaration
void ICollection<T>.Add(T item)
Parameters
Type Name Description
T item
| Improve this Doc View Source

ICollection<T>.Clear()

Sparse vector representation (in LibSVM format).
Declaration
void ICollection<T>.Clear()
| Improve this Doc View Source

ICollection<T>.Contains(T)

Sparse vector representation (in LibSVM format).
Declaration
bool ICollection<T>.Contains(T item)
Parameters
Type Name Description
T item
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ICollection<T>.Count

Sparse vector representation (in LibSVM format).
Declaration
int ICollection<T>.Count { get; }
Returns
Type Description
System.Int32
| Improve this Doc View Source

ICollection<T>.IsReadOnly

Sparse vector representation (in LibSVM format).
Declaration
bool ICollection<T>.IsReadOnly { get; }
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ICollection<T>.Remove(T)

Sparse vector representation (in LibSVM format).
Declaration
bool ICollection<T>.Remove(T item)
Parameters
Type Name Description
T item
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IEnumerable<T>.GetEnumerator()

Sparse vector representation (in LibSVM format).
Declaration
IEnumerator<T> IEnumerable<T>.GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<T>
| Improve this Doc View Source

IList<T>.IndexOf(T)

Sparse vector representation (in LibSVM format).
Declaration
int IList<T>.IndexOf(T item)
Parameters
Type Name Description
T item
Returns
Type Description
System.Int32
| Improve this Doc View Source

IList<T>.Insert(Int32, T)

Sparse vector representation (in LibSVM format).
Declaration
void IList<T>.Insert(int index, T item)
Parameters
Type Name Description
System.Int32 index
T item
| Improve this Doc View Source

IList<T>.Item[Int32]

Sparse vector representation (in LibSVM format).
Declaration
T IList<T>.this[int index] { get; set; }
Parameters
Type Name Description
System.Int32 index
Returns
Type Description
T
| Improve this Doc View Source

IList<T>.RemoveAt(Int32)

Sparse vector representation (in LibSVM format).
Declaration
void IList<T>.RemoveAt(int index)
Parameters
Type Name Description
System.Int32 index
| Improve this Doc View Source

ICollection.CopyTo(Array, Int32)

Sparse vector representation (in LibSVM format).
Declaration
void ICollection.CopyTo(Array array, int index)
Parameters
Type Name Description
System.Array array
System.Int32 index
| Improve this Doc View Source

ICollection.Count

Sparse vector representation (in LibSVM format).
Declaration
int ICollection.Count { get; }
Returns
Type Description
System.Int32
| Improve this Doc View Source

ICollection.IsSynchronized

Sparse vector representation (in LibSVM format).
Declaration
bool ICollection.IsSynchronized { get; }
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ICollection.SyncRoot

Sparse vector representation (in LibSVM format).
Declaration
object ICollection.SyncRoot { get; }
Returns
Type Description
System.Object
| Improve this Doc View Source

IEnumerable.GetEnumerator()

Sparse vector representation (in LibSVM format).
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator
| Improve this Doc View Source

IList.Add(Object)

Sparse vector representation (in LibSVM format).
Declaration
int IList.Add(object value)
Parameters
Type Name Description
System.Object value
Returns
Type Description
System.Int32
| Improve this Doc View Source

IList.Clear()

Sparse vector representation (in LibSVM format).
Declaration
void IList.Clear()
| Improve this Doc View Source

IList.Contains(Object)

Sparse vector representation (in LibSVM format).
Declaration
bool IList.Contains(object value)
Parameters
Type Name Description
System.Object value
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IList.IndexOf(Object)

Sparse vector representation (in LibSVM format).
Declaration
int IList.IndexOf(object value)
Parameters
Type Name Description
System.Object value
Returns
Type Description
System.Int32
| Improve this Doc View Source

IList.Insert(Int32, Object)

Sparse vector representation (in LibSVM format).
Declaration
void IList.Insert(int index, object value)
Parameters
Type Name Description
System.Int32 index
System.Object value
| Improve this Doc View Source

IList.IsFixedSize

Sparse vector representation (in LibSVM format).
Declaration
bool IList.IsFixedSize { get; }
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IList.IsReadOnly

Sparse vector representation (in LibSVM format).
Declaration
bool IList.IsReadOnly { get; }
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IList.Item[Int32]

Sparse vector representation (in LibSVM format).
Declaration
object IList.this[int index] { get; set; }
Parameters
Type Name Description
System.Int32 index
Returns
Type Description
System.Object
| Improve this Doc View Source

IList.Remove(Object)

Sparse vector representation (in LibSVM format).
Declaration
void IList.Remove(object value)
Parameters
Type Name Description
System.Object value
| Improve this Doc View Source

IList.RemoveAt(Int32)

Sparse vector representation (in LibSVM format).
Declaration
void IList.RemoveAt(int index)
Parameters
Type Name Description
System.Int32 index

Implements

System.ICloneable
System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IList
System.Collections.ICollection
System.Collections.IEnumerable
System.IFormattable

Extension Methods

Serializer.Save<T>(T, out Byte[], SerializerCompression)
Serializer.Save<T>(T, Stream, SerializerCompression)
Serializer.Save<T>(T, BinaryFormatter, Stream, SerializerCompression)
Serializer.Save<T>(T, String, SerializerCompression)
Serializer.Save<T>(T, String)
Matrix.Concatenate<T>(T, T[])
Matrix.Replace<T>(T, Object, Object)
Matrix.Transpose<T>(T, Int32[])
Combinatorics.Subsets<T>(IEnumerable<T>, Boolean)
Combinatorics.Subsets<T>(IEnumerable<T>, Int32, Boolean)
Matrix.SetEquals<T>(IEnumerable<T>, IEnumerable<T>)
Matrix.Apply<TData, TResult>(IList<TData>, Func<TData, TResult>, TResult[])
Matrix.Apply<TData, TResult>(IList<TData>, Func<TData, TResult>)
VectorHelper.Shuffle<T>(IList<T>)
DomainDataImporter.Import(Object, InputConfiguration)
ObjectSerialize.Serialize(Object)
Matrix.IsEqual(Object, Object, Decimal, Decimal)
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © MARS GROUP. HAW Hamburg