• 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 Jagged

Jagged matrices.
Inheritance
System.Object
Jagged
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)
System.Object.ToString()
Namespace: Mars.Numerics
Assembly: Mars.Numerics.dll
Syntax
public static class Jagged

Methods

| Improve this Doc View Source

ColumnVector<T>(T[])

Creates a Nx1 matrix with a single column vector of size N.
Declaration
public static T[][] ColumnVector<T>(params T[] values)
Parameters
Type Name Description
T[] values
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Convert(Array, Type)

Converts the values of a tensor.
Declaration
public static Array Convert(this Array array, Type type)
Parameters
Type Name Description
System.Array array The tensor to be converted.
System.Type type The type of the output.
Returns
Type Description
System.Array
See Also
Matrix
Vector
| Improve this Doc View Source

Convert<TOutput>(Array)

Converts the values of a tensor.
Declaration
public static Array Convert<TOutput>(this Array array)
Parameters
Type Name Description
System.Array array The tensor to be converted.
Returns
Type Description
System.Array
Type Parameters
Name Description
TOutput The type of the output.
See Also
Matrix
Vector
| Improve this Doc View Source

Convert<TInput, TOutput>(TInput[][], Converter<TInput, TOutput>)

Converts the values of a matrix using the given converter expression.
Declaration
public static TOutput[][] Convert<TInput, TOutput>(this TInput[][] matrix, Converter<TInput, TOutput> converter)
Parameters
Type Name Description
TInput[][] matrix The vector to be converted.
System.Converter<TInput, TOutput> converter The converter function.
Returns
Type Description
TOutput[][]
Type Parameters
Name Description
TInput The type of the input.
TOutput The type of the output.
See Also
Matrix
Vector
| Improve this Doc View Source

Convert<TInput, TOutput>(TInput[][])

Converts the values of a matrix using the default converter.
Declaration
public static TOutput[][] Convert<TInput, TOutput>(this TInput[][] matrix)
Parameters
Type Name Description
TInput[][] matrix The matrix to be converted.
Returns
Type Description
TOutput[][]
Type Parameters
Name Description
TInput The type of the input.
TOutput The type of the output.
See Also
Matrix
Vector
| Improve this Doc View Source

Convert<TInput, TOutput>(TInput[,], Converter<TInput, TOutput>)

Converts the values of a matrix using the given converter expression.
Declaration
public static TOutput[][] Convert<TInput, TOutput>(this TInput[, ] matrix, Converter<TInput, TOutput> converter)
Parameters
Type Name Description
TInput[,] matrix The vector to be converted.
System.Converter<TInput, TOutput> converter The converter function.
Returns
Type Description
TOutput[][]
Type Parameters
Name Description
TInput The type of the input.
TOutput The type of the output.
See Also
Matrix
Vector
| Improve this Doc View Source

Convert<TInput, TOutput>(TInput[,])

Converts the values of a matrix using the default converter.
Declaration
public static TOutput[][] Convert<TInput, TOutput>(TInput[, ] matrix)
Parameters
Type Name Description
TInput[,] matrix The matrix to be converted.
Returns
Type Description
TOutput[][]
Type Parameters
Name Description
TInput The type of the input.
TOutput The type of the output.
See Also
Matrix
Vector
| Improve this Doc View Source

Create(Type, Int32[], Object)

Creates a jagged matrix with all values set to a given value.
Declaration
public static Array Create(Type elementType, int[] shape, object value)
Parameters
Type Name Description
System.Type elementType The type of the elements to be contained in the matrix.
System.Int32[] shape The number of dimensions that the matrix should have.
System.Object value The initial values for the vector.
Returns
Type Description
System.Array A matrix of the specified size.
See Also
Matrix
Vector
| Improve this Doc View Source

Create<T>(T[][])

Creates a matrix with the given rows.
Declaration
public static T[][] Create<T>(params T[][] rows)
Parameters
Type Name Description
T[][] rows The row vectors in the matrix.
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Create<T>(T[,])

Creates a matrix with the given values.
Declaration
public static T[][] Create<T>(T[, ] values)
Parameters
Type Name Description
T[,] values The values in the matrix.
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Create<T>(Int32, Int32, T)

Creates a jagged matrix with all values set to a given value.
Declaration
public static T[][] Create<T>(int rows, int columns, T value)
Parameters
Type Name Description
System.Int32 rows The number of rows in the matrix.
System.Int32 columns The number of columns in the matrix.
T value The initial values for the vector.
Returns
Type Description
T[][] A matrix of the specified size.
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Create<T>(Int32, Int32, T[])

Creates a matrix with all values set to a given value.
Declaration
public static T[][] Create<T>(int rows, int columns, params T[] values)
Parameters
Type Name Description
System.Int32 rows The number of rows in the matrix.
System.Int32 columns The number of columns in the matrix.
T[] values The initial values for the matrix.
Returns
Type Description
T[][] A matrix of the specified size.
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Create<T>(Int32, Int32, T[][], Boolean)

Creates a matrix with all values set to a given value.
Declaration
public static T[][] Create<T>(int rows, int columns, T[][] values, bool transpose = false)
Parameters
Type Name Description
System.Int32 rows The number of rows in the matrix.
System.Int32 columns The number of columns in the matrix.
T[][] values The initial values for the matrix.
System.Boolean transpose Whether to transpose the matrix when copying or not. Default is false.
Returns
Type Description
T[][] A matrix of the specified size.
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Create<T>(Int32[], T)

Creates a jagged matrix with all values set to a given value.
Declaration
public static Array Create<T>(int[] shape, T value)
Parameters
Type Name Description
System.Int32[] shape The number of dimensions that the matrix should have.
T value The initial values for the vector.
Returns
Type Description
System.Array A matrix of the specified size.
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

CreateAs(Array, Type)

Creates a new multidimensional matrix with the same shape as another matrix.
Declaration
public static Array CreateAs(Array matrix, Type type)
Parameters
Type Name Description
System.Array matrix
System.Type type
Returns
Type Description
System.Array
See Also
Matrix
Vector
| Improve this Doc View Source

CreateAs<T>(T[][])

Returns a new multidimensional matrix.
Declaration
public static T[][] CreateAs<T>(T[][] matrix)
Parameters
Type Name Description
T[][] matrix
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

CreateAs<T>(T[,])

Creates a new multidimensional matrix with the same shape as another matrix.
Declaration
public static T[][] CreateAs<T>(T[, ] matrix)
Parameters
Type Name Description
T[,] matrix
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

CreateAs<TInput, TOutput>(TInput[][])

Returns a new multidimensional matrix.
Declaration
public static TOutput[][] CreateAs<TInput, TOutput>(TInput[][] matrix)
Parameters
Type Name Description
TInput[][] matrix
Returns
Type Description
TOutput[][]
Type Parameters
Name Description
TInput
TOutput
See Also
Matrix
Vector
| Improve this Doc View Source

CreateAs<TInput, TOutput>(TInput[][][])

Returns a new multidimensional matrix.
Declaration
public static TOutput[][][] CreateAs<TInput, TOutput>(TInput[][][] matrix)
Parameters
Type Name Description
TInput[][][] matrix
Returns
Type Description
TOutput[][][]
Type Parameters
Name Description
TInput
TOutput
See Also
Matrix
Vector
| Improve this Doc View Source

CreateAs<TInput, TOutput>(TInput[,])

Returns a new multidimensional matrix.
Declaration
public static TOutput[][] CreateAs<TInput, TOutput>(TInput[, ] matrix)
Parameters
Type Name Description
TInput[,] matrix
Returns
Type Description
TOutput[][]
Type Parameters
Name Description
TInput
TOutput
See Also
Matrix
Vector
| Improve this Doc View Source

Diagonal<T>(T[], T[][])

Return a square matrix with a vector of values on its diagonal.
Declaration
public static T[][] Diagonal<T>(T[] values, T[][] result)
Parameters
Type Name Description
T[] values
T[][] result
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Diagonal<T>(T[])

Return a square matrix with a vector of values on its diagonal.
Declaration
public static T[][] Diagonal<T>(T[] values)
Parameters
Type Name Description
T[] values
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Diagonal<T>(T[][][])

Returns a block-diagonal matrix with the given matrices on its diagonal.
Declaration
public static T[][] Diagonal<T>(T[][][] blocks)
Parameters
Type Name Description
T[][][] blocks
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Diagonal<T>(Int32, T, T[][])

Returns a square diagonal matrix of the given size.
Declaration
public static T[][] Diagonal<T>(int size, T value, T[][] result)
Parameters
Type Name Description
System.Int32 size
T value
T[][] result
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Diagonal<T>(Int32, T)

Returns a square diagonal matrix of the given size.
Declaration
public static T[][] Diagonal<T>(int size, T value)
Parameters
Type Name Description
System.Int32 size
T value
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Diagonal<T>(Int32, T[], T[][])

Return a square matrix with a vector of values on its diagonal.
Declaration
public static T[][] Diagonal<T>(int size, T[] values, T[][] result)
Parameters
Type Name Description
System.Int32 size
T[] values
T[][] result
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Diagonal<T>(Int32, T[])

Return a square matrix with a vector of values on its diagonal.
Declaration
public static T[][] Diagonal<T>(int size, T[] values)
Parameters
Type Name Description
System.Int32 size
T[] values
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Diagonal<T>(Int32, Int32, T, T[][])

Returns a matrix of the given size with value on its diagonal.
Declaration
public static T[][] Diagonal<T>(int rows, int cols, T value, T[][] result)
Parameters
Type Name Description
System.Int32 rows
System.Int32 cols
T value
T[][] result
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Diagonal<T>(Int32, Int32, T)

Returns a matrix of the given size with value on its diagonal.
Declaration
public static T[][] Diagonal<T>(int rows, int cols, T value)
Parameters
Type Name Description
System.Int32 rows
System.Int32 cols
T value
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Diagonal<T>(Int32, Int32, T[], T[][])

Returns a matrix with a vector of values on its diagonal.
Declaration
public static T[][] Diagonal<T>(int rows, int cols, T[] values, T[][] result)
Parameters
Type Name Description
System.Int32 rows
System.Int32 cols
T[] values
T[][] result
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Diagonal<T>(Int32, Int32, T[])

Returns a matrix with a vector of values on its diagonal.
Declaration
public static T[][] Diagonal<T>(int rows, int cols, T[] values)
Parameters
Type Name Description
System.Int32 rows
System.Int32 cols
T[] values
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Enumerate(Array, Int32[])

Enumerates through all elements in a matrix.
Declaration
public static IEnumerable Enumerate(this Array array, int[] shape)
Parameters
Type Name Description
System.Array array The array to be iterated.
System.Int32[] shape The full shape of array .
Returns
Type Description
System.Collections.IEnumerable
See Also
Matrix
Vector
| Improve this Doc View Source

Enumerate(Array)

Enumerates through all elements in a matrix.
Declaration
public static IEnumerable Enumerate(this Array array)
Parameters
Type Name Description
System.Array array The array to be iterated.
Returns
Type Description
System.Collections.IEnumerable
See Also
Matrix
Vector
| Improve this Doc View Source

Enumerate<T>(Array, Int32[])

Enumerates through all elements in a matrix.
Declaration
public static IEnumerable<T> Enumerate<T>(this Array array, int[] shape)
Parameters
Type Name Description
System.Array array The array to be iterated.
System.Int32[] shape The full shape of array .
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Enumerate<T>(Array)

Enumerates through all elements in a matrix.
Declaration
public static IEnumerable<T> Enumerate<T>(this Array array)
Parameters
Type Name Description
System.Array array The array to be iterated.
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Identity(Int32)

Creates a square matrix with ones across its diagonal.
Declaration
public static double[][] Identity(int size)
Parameters
Type Name Description
System.Int32 size
Returns
Type Description
System.Double[][]
See Also
Matrix
Vector
| Improve this Doc View Source

Identity<T>(Int32)

Creates a square matrix with ones across its diagonal.
Declaration
public static T[][] Identity<T>(int size)
Parameters
Type Name Description
System.Int32 size
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

KHot(Boolean[][], Int32)

Creates a matrix of k-hot vectors, where all values at each row are zero except for the ones in the positions where mask are true, which are set to one.
Declaration
public static double[][] KHot(bool[][] mask, int columns)
Parameters
Type Name Description
System.Boolean[][] mask The boolean mask determining where ones will be placed.
System.Int32 columns The size (length) of the vectors (columns of the matrix).
Returns
Type Description
System.Double[][] A matrix containing one-hot vectors where only a single position is one and the others are zero.
See Also
Matrix
Vector
| Improve this Doc View Source

KHot(Int32[][], Double[][])

Creates a matrix of k-hot vectors, where all values at each row are zero except for the indicated indices, which are set to one.
Declaration
public static double[][] KHot(int[][] indices, double[][] result)
Parameters
Type Name Description
System.Int32[][] indices The rows's dimension which will be marked as one.
System.Double[][] result The matrix where the one-hot should be marked.
Returns
Type Description
System.Double[][] A matrix containing k-hot vectors where only elements at the indicated indices are set to one and the others are zero.
See Also
Matrix
Vector
| Improve this Doc View Source

KHot(Int32[][], Int32)

Creates a matrix of k-hot vectors, where all values at each row are zero except for the indicated indices, which are set to one.
Declaration
public static double[][] KHot(int[][] indices, int columns)
Parameters
Type Name Description
System.Int32[][] indices The rows's dimension which will be marked as one.
System.Int32 columns The size (length) of the vectors (columns of the matrix).
Returns
Type Description
System.Double[][] A matrix containing k-hot vectors where only elements at the indicated indices are set to one and the others are zero.
See Also
Matrix
Vector
| Improve this Doc View Source

KHot<T>(Boolean[][], T[][])

Creates a matrix of one-hot vectors, where all values at each row are zero except for the ones in the positions where mask are true, which are set to one.
Declaration
public static T[][] KHot<T>(bool[][] mask, T[][] result)
Parameters
Type Name Description
System.Boolean[][] mask The boolean mask determining where ones will be placed.
T[][] result The matrix where the one-hot should be marked.
Returns
Type Description
T[][] A matrix containing one-hot vectors where only a single position is one and the others are zero.
Type Parameters
Name Description
T The data type for the matrix.
See Also
Matrix
Vector
| Improve this Doc View Source

KHot<T>(Boolean[][])

Creates a matrix of k-hot vectors, where all values at each row are zero except for the ones in the positions where mask are true, which are set to one.
Declaration
public static T[][] KHot<T>(bool[][] mask)
Parameters
Type Name Description
System.Boolean[][] mask The boolean mask determining where ones will be placed.
Returns
Type Description
T[][] A matrix containing one-hot vectors where only a single position is one and the others are zero.
Type Parameters
Name Description
T The data type for the matrix.
See Also
Matrix
Vector
| Improve this Doc View Source

KHot<T>(Int32[][], T[][])

Creates a matrix of k-hot vectors, where all values at each row are zero except for the indicated indices, which are set to one.
Declaration
public static T[][] KHot<T>(int[][] indices, T[][] result)
Parameters
Type Name Description
System.Int32[][] indices The rows's dimension which will be marked as one.
T[][] result The matrix where the one-hot should be marked.
Returns
Type Description
T[][] A matrix containing k-hot vectors where only elements at the indicated indices are set to one and the others are zero.
Type Parameters
Name Description
T The data type for the matrix.
See Also
Matrix
Vector
| Improve this Doc View Source

KHot<T>(Int32[][], Int32)

Creates a matrix of k-hot vectors, where all values at each row are zero except for the indicated indices, which are set to one.
Declaration
public static T[][] KHot<T>(int[][] indices, int columns)
Parameters
Type Name Description
System.Int32[][] indices The rows's dimension which will be marked as one.
System.Int32 columns The size (length) of the vectors (columns of the matrix).
Returns
Type Description
T[][] A matrix containing k-hot vectors where only elements at the indicated indices are set to one and the others are zero.
Type Parameters
Name Description
T The data type for the matrix.
See Also
Matrix
Vector
| Improve this Doc View Source

Magic(Int32)

Creates a jagged magic square matrix.
Declaration
public static double[][] Magic(int size)
Parameters
Type Name Description
System.Int32 size
Returns
Type Description
System.Double[][]
See Also
Matrix
Vector
| Improve this Doc View Source

OneHot(Int32[], Double[][])

Creates a matrix of one-hot vectors, where all values at each row are zero except for the indicated indices, which is set to one.
Declaration
public static double[][] OneHot(int[] indices, double[][] result)
Parameters
Type Name Description
System.Int32[] indices The rows's dimension which will be marked as one.
System.Double[][] result The matrix where the one-hot should be marked.
Returns
Type Description
System.Double[][] A matrix containing one-hot vectors where only a single position is one and the others are zero.
See Also
Matrix
Vector
| Improve this Doc View Source

OneHot<T>(Boolean[], T[][])

Creates a matrix of one-hot vectors, where all values at each row are zero except for the ones in the positions where mask are true, which are set to one.
Declaration
public static T[][] OneHot<T>(bool[] mask, T[][] result)
Parameters
Type Name Description
System.Boolean[] mask The boolean mask determining where ones will be placed.
T[][] result The matrix where the one-hot should be marked.
Returns
Type Description
T[][] A matrix containing one-hot vectors where only a single position is one and the others are zero.
Type Parameters
Name Description
T The data type for the matrix.
See Also
Matrix
Vector
| Improve this Doc View Source

OneHot<T>(Int32[], T[][])

Creates a matrix of one-hot vectors, where all values at each row are zero except for the indicated indices, which is set to one.
Declaration
public static T[][] OneHot<T>(int[] indices, T[][] result)
Parameters
Type Name Description
System.Int32[] indices The rows's dimension which will be marked as one.
T[][] result The matrix where the one-hot should be marked.
Returns
Type Description
T[][] A matrix containing one-hot vectors where only a single position is one and the others are zero.
Type Parameters
Name Description
T The data type for the matrix.
See Also
Matrix
Vector
| Improve this Doc View Source

Ones(Int32, Int32)

Creates a zero-valued matrix.
Declaration
public static double[][] Ones(int rows, int columns)
Parameters
Type Name Description
System.Int32 rows The number of rows in the matrix.
System.Int32 columns The number of columns in the matrix.
Returns
Type Description
System.Double[][] A vector of the specified size.
See Also
Matrix
Vector
| Improve this Doc View Source

Ones<T>(Int32, Int32)

Creates a zero-valued matrix.
Declaration
public static T[][] Ones<T>(int rows, int columns)
Parameters
Type Name Description
System.Int32 rows The number of rows in the matrix.
System.Int32 columns The number of columns in the matrix.
Returns
Type Description
T[][] A matrix of the specified size.
Type Parameters
Name Description
T The type of the matrix to be created.
See Also
Matrix
Vector
| Improve this Doc View Source

Outer(Double[], Double[], Double[][])

Gets the outer product (matrix product) between two vectors (a*bT).
Declaration
public static double[][] Outer(double[] a, double[] b, double[][] result)
Parameters
Type Name Description
System.Double[] a
System.Double[] b
System.Double[][] result
Returns
Type Description
System.Double[][]
Remarks
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.
See Also
Matrix
Vector
| Improve this Doc View Source

Outer(Double[], Double[], Int32[][])

Gets the outer product (matrix product) between two vectors (a*bT).
Declaration
public static int[][] Outer(double[] a, double[] b, int[][] result)
Parameters
Type Name Description
System.Double[] a
System.Double[] b
System.Int32[][] result
Returns
Type Description
System.Int32[][]
Remarks
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.
See Also
Matrix
Vector
| Improve this Doc View Source

Outer(Double[], Double[])

Gets the outer product (matrix product) between two vectors (a*bT).
Declaration
public static double[][] Outer(double[] a, double[] b)
Parameters
Type Name Description
System.Double[] a
System.Double[] b
Returns
Type Description
System.Double[][]
Remarks
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.
See Also
Matrix
Vector
| Improve this Doc View Source

Outer(Double[], Int32[], Double[][])

Gets the outer product (matrix product) between two vectors (a*bT).
Declaration
public static double[][] Outer(double[] a, int[] b, double[][] result)
Parameters
Type Name Description
System.Double[] a
System.Int32[] b
System.Double[][] result
Returns
Type Description
System.Double[][]
Remarks
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.
See Also
Matrix
Vector
| Improve this Doc View Source

Outer(Double[], Int32[], Int32[][])

Gets the outer product (matrix product) between two vectors (a*bT).
Declaration
public static int[][] Outer(double[] a, int[] b, int[][] result)
Parameters
Type Name Description
System.Double[] a
System.Int32[] b
System.Int32[][] result
Returns
Type Description
System.Int32[][]
Remarks
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.
See Also
Matrix
Vector
| Improve this Doc View Source

Outer(Double[], Int32[])

Gets the outer product (matrix product) between two vectors (a*bT).
Declaration
public static double[][] Outer(double[] a, int[] b)
Parameters
Type Name Description
System.Double[] a
System.Int32[] b
Returns
Type Description
System.Double[][]
Remarks
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.
See Also
Matrix
Vector
| Improve this Doc View Source

Outer(Int32[], Double[], Double[][])

Gets the outer product (matrix product) between two vectors (a*bT).
Declaration
public static double[][] Outer(int[] a, double[] b, double[][] result)
Parameters
Type Name Description
System.Int32[] a
System.Double[] b
System.Double[][] result
Returns
Type Description
System.Double[][]
Remarks
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.
See Also
Matrix
Vector
| Improve this Doc View Source

Outer(Int32[], Double[], Int32[][])

Gets the outer product (matrix product) between two vectors (a*bT).
Declaration
public static int[][] Outer(int[] a, double[] b, int[][] result)
Parameters
Type Name Description
System.Int32[] a
System.Double[] b
System.Int32[][] result
Returns
Type Description
System.Int32[][]
Remarks
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.
See Also
Matrix
Vector
| Improve this Doc View Source

Outer(Int32[], Double[])

Gets the outer product (matrix product) between two vectors (a*bT).
Declaration
public static double[][] Outer(int[] a, double[] b)
Parameters
Type Name Description
System.Int32[] a
System.Double[] b
Returns
Type Description
System.Double[][]
Remarks
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.
See Also
Matrix
Vector
| Improve this Doc View Source

Outer(Int32[], Int32[], Double[][])

Gets the outer product (matrix product) between two vectors (a*bT).
Declaration
public static double[][] Outer(int[] a, int[] b, double[][] result)
Parameters
Type Name Description
System.Int32[] a
System.Int32[] b
System.Double[][] result
Returns
Type Description
System.Double[][]
Remarks
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.
See Also
Matrix
Vector
| Improve this Doc View Source

Outer(Int32[], Int32[], Int32[][])

Gets the outer product (matrix product) between two vectors (a*bT).
Declaration
public static int[][] Outer(int[] a, int[] b, int[][] result)
Parameters
Type Name Description
System.Int32[] a
System.Int32[] b
System.Int32[][] result
Returns
Type Description
System.Int32[][]
Remarks
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.
See Also
Matrix
Vector
| Improve this Doc View Source

Outer(Int32[], Int32[])

Gets the outer product (matrix product) between two vectors (a*bT).
Declaration
public static int[][] Outer(int[] a, int[] b)
Parameters
Type Name Description
System.Int32[] a
System.Int32[] b
Returns
Type Description
System.Int32[][]
Remarks
In linear algebra, the outer product typically refers to the tensor product of two vectors. The result of applying the outer product to a pair of vectors is a matrix. The name contrasts with the inner product, which takes as input a pair of vectors and produces a scalar.
See Also
Matrix
Vector
| Improve this Doc View Source

Random(Int32, Double, Double, Boolean, Double[][])

Creates a matrix with uniformly distributed random data.
Declaration
public static double[][] Random(int size, double min, double max, bool symmetric = false, double[][] result = null)
Parameters
Type Name Description
System.Int32 size
System.Double min
System.Double max
System.Boolean symmetric
System.Double[][] result
Returns
Type Description
System.Double[][]
See Also
Matrix
Vector
| Improve this Doc View Source

Random(Int32, Int32, Double, Double, Double[][])

Creates a matrix with uniformly distributed random data.
Declaration
public static double[][] Random(int rows, int columns, double min, double max, double[][] result = null)
Parameters
Type Name Description
System.Int32 rows
System.Int32 columns
System.Double min
System.Double max
System.Double[][] result
Returns
Type Description
System.Double[][]
See Also
Matrix
Vector
| Improve this Doc View Source

Random(Int32, Int32, Int32, Boolean, Int32[][])

Creates a matrix with uniformly distributed random data.
Declaration
public static int[][] Random(int size, int min, int max, bool symmetric = false, int[][] result = null)
Parameters
Type Name Description
System.Int32 size
System.Int32 min
System.Int32 max
System.Boolean symmetric
System.Int32[][] result
Returns
Type Description
System.Int32[][]
See Also
Matrix
Vector
| Improve this Doc View Source

Random(Int32, Int32, Int32, Int32, Int32[][])

Creates a matrix with uniformly distributed random data.
Declaration
public static int[][] Random(int rows, int columns, int min, int max, int[][] result = null)
Parameters
Type Name Description
System.Int32 rows
System.Int32 columns
System.Int32 min
System.Int32 max
System.Int32[][] result
Returns
Type Description
System.Int32[][]
See Also
Matrix
Vector
| Improve this Doc View Source

Random(Int32, Int32)

Creates a matrix with uniformly distributed random data.
Declaration
public static double[][] Random(int rows, int columns)
Parameters
Type Name Description
System.Int32 rows
System.Int32 columns
Returns
Type Description
System.Double[][]
See Also
Matrix
Vector
| Improve this Doc View Source

Random(Int32)

Creates a matrix with uniformly distributed random data.
Declaration
public static double[][] Random(int size)
Parameters
Type Name Description
System.Int32 size
Returns
Type Description
System.Double[][]
See Also
Matrix
Vector
| Improve this Doc View Source

Random<T>(Int32, IRandomNumberGenerator<T>, Boolean, T[][])

Creates a square matrix matrix with random data.
Declaration
public static T[][] Random<T>(int size, IRandomNumberGenerator<T> generator, bool symmetric = false, T[][] result = null)
Parameters
Type Name Description
System.Int32 size
Mars.Common.Core.Random.IRandomNumberGenerator<T> generator
System.Boolean symmetric
T[][] result
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Random<T>(Int32, Int32, IRandomNumberGenerator<T>, T[][])

Creates a rows-by-cols matrix with random data.
Declaration
public static T[][] Random<T>(int rows, int cols, IRandomNumberGenerator<T> generator, T[][] result = null)
Parameters
Type Name Description
System.Int32 rows
System.Int32 cols
Mars.Common.Core.Random.IRandomNumberGenerator<T> generator
T[][] result
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Reshape<T>(T[], Int32, Int32, T[][], MatrixOrder)

Transforms a vector into a matrix of given dimensions.
Declaration
public static T[][] Reshape<T>(this T[] array, int rows, int cols, T[][] result, MatrixOrder order = MatrixOrder.CRowMajor)
Parameters
Type Name Description
T[] array
System.Int32 rows
System.Int32 cols
T[][] result
MatrixOrder order
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Reshape<T>(T[], Int32, Int32, MatrixOrder)

Transforms a vector into a matrix of given dimensions.
Declaration
public static T[][] Reshape<T>(T[] array, int rows, int cols, MatrixOrder order = MatrixOrder.CRowMajor)
Parameters
Type Name Description
T[] array
System.Int32 rows
System.Int32 cols
MatrixOrder order
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

RowVector<T>(T[])

Creates a 1xN matrix with a single row vector of size N.
Declaration
public static T[][] RowVector<T>(params T[] values)
Parameters
Type Name Description
T[] values
Returns
Type Description
T[][]
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Square<T>(Int32, T)

Creates a jagged matrix with all values set to a given value.
Declaration
public static T[][] Square<T>(int size, T value)
Parameters
Type Name Description
System.Int32 size The number of rows and columns in the matrix.
T value The initial values for the matrix.
Returns
Type Description
T[][] A matrix of the specified size.
Type Parameters
Name Description
T
See Also
Create<T>(Int32, Int32, T)
| Improve this Doc View Source

Transpose<T>(T[,])

Gets the transpose of a matrix.
Declaration
public static T[][] Transpose<T>(T[, ] matrix)
Parameters
Type Name Description
T[,] matrix A matrix.
Returns
Type Description
T[][] The transpose of the given matrix.
Type Parameters
Name Description
T
See Also
Matrix
Vector
| Improve this Doc View Source

Zeros(Int32, Int32, Int32)

Creates a zero-valued rank-3 tensor.
Declaration
public static double[][][] Zeros(int rows, int columns, int depth)
Parameters
Type Name Description
System.Int32 rows The number of rows in the tensor.
System.Int32 columns The number of columns in the tensor.
System.Int32 depth The number of channels in the tensor.
Returns
Type Description
System.Double[][][] A matrix of the specified size.
See Also
Matrix
Vector
| Improve this Doc View Source

Zeros(Int32, Int32)

Creates a zero-valued matrix.
Declaration
public static double[][] Zeros(int rows, int columns)
Parameters
Type Name Description
System.Int32 rows The number of rows in the matrix.
System.Int32 columns The number of columns in the matrix.
Returns
Type Description
System.Double[][] A vector of the specified size.
See Also
Matrix
Vector
| Improve this Doc View Source

Zeros(Type, Int32[])

Creates a jagged matrix with all values set to zero.
Declaration
public static Array Zeros(Type elementType, params int[] shape)
Parameters
Type Name Description
System.Type elementType The type of the elements to be contained in the matrix.
System.Int32[] shape The number of dimensions that the matrix should have.
Returns
Type Description
System.Array A matrix of the specified size.
See Also
Matrix
Vector
| Improve this Doc View Source

Zeros<T>(Int32, Int32, Int32)

Creates a zero-valued rank-3 tensor.
Declaration
public static T[][][] Zeros<T>(int rows, int columns, int depth)
Parameters
Type Name Description
System.Int32 rows The number of rows in the tensor.
System.Int32 columns The number of columns in the tensor.
System.Int32 depth The number of channels in the tensor.
Returns
Type Description
T[][][] A matrix of the specified size.
Type Parameters
Name Description
T The type of the matrix to be created.
See Also
Matrix
Vector
| Improve this Doc View Source

Zeros<T>(Int32, Int32)

Creates a zero-valued matrix.
Declaration
public static T[][] Zeros<T>(int rows, int columns)
Parameters
Type Name Description
System.Int32 rows The number of rows in the matrix.
System.Int32 columns The number of columns in the matrix.
Returns
Type Description
T[][] A matrix of the specified size.
Type Parameters
Name Description
T The type of the matrix to be created.
See Also
Matrix
Vector
| Improve this Doc View Source

Zeros<T>(Int32[])

Creates a jagged matrix with all values set to zero.
Declaration
public static Array Zeros<T>(params int[] shape)
Parameters
Type Name Description
System.Int32[] shape The number of dimensions that the matrix should have.
Returns
Type Description
System.Array A matrix of the specified size.
Type Parameters
Name Description
T
See Also
Matrix
Vector

See Also

Matrix
Vector
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © MARS GROUP. HAW Hamburg