Click or drag to resize

FloatMatrix Class

Class FloatMatrix represents a general mathematical matrix class of floating point numbers. Methods are provided for performing algebraic operations, data manipulation, and slicing.
Inheritance Hierarchy
SystemObject
  CenterSpace.NMath.CoreFloatMatrix

Namespace:  CenterSpace.NMath.Core
Assembly:  NMath (in NMath.dll) Version: 7.3
Syntax
[SerializableAttribute]
public class FloatMatrix : IEnumerable<float>, 
	IEnumerable, ICloneable, IXmlSerializable

The FloatMatrix type exposes the following members.

Constructors
  NameDescription
Public methodFloatMatrix
An undefined matrix. Must be resized before using.
Public methodFloatMatrix(DataRow)
Constructs a FloatMatrix instance whose values are derived from the entire contents of the given array of rows.
Public methodFloatMatrix(DataRowCollection)
Constructs a FloatMatrix instance whose values are derived from the entire contents of the given row collection.
Public methodFloatMatrix(DataTable)
Constructs a FloatMatrix instance whose values are derived from the entire contents of the given data table.
Public methodFloatMatrix(DataView)
Constructs a FloatMatrix instance whose values are derived from the entire contents of the given data view.
Public methodCode exampleFloatMatrix(TextReader)
Constructs a FloatMatrix instance from the given text reader.
Public methodFloatMatrix(Single)
Constructs a FloatMatrix instance initialized with data in a given two-dimensional array.
Public methodCode exampleFloatMatrix(String)
Constructs a FloatMatrix instance from a formatted string.
Public methodFloatMatrix(FloatMatrix)
Constructs a deep copy of a FloatMatrix.
Public methodFloatMatrix(FloatVector)
Constructs a n x 1 FloatMatrix instance from a given vector.
Public methodFloatMatrix(Int32, Int32)
Constructs a FloatMatrix instance with the specifed number of rows and columns.
Public methodCode exampleFloatMatrix(TextReader, NumberStyles)
Constructs a FloatMatrix instance from the given text reader.
Public methodCode exampleFloatMatrix(String, Char)
Constructs a FloatMatrix instance from a formatted string with a specified delimiter.
Public methodCode exampleFloatMatrix(String, NumberStyles)
Constructs a FloatMatrix instance from a formatted string and a NumberStyles object.
Public methodCode exampleFloatMatrix(Int32, Int32, FloatDataBlock)
Constructs a FloatMatrix instance from a data block.
Public methodFloatMatrix(Int32, Int32, RandomNumberGenerator)
Constructs a FloatMatrix instance from a random number generator.
Public methodFloatMatrix(Int32, Int32, Single)
Constructs a FloatMatrix instance of the specifed dimensions and initializes all matrix element values to the given value.
Public methodCode exampleFloatMatrix(String, NumberStyles, Char)
Constructs a FloatMatrix instance from a formatted string with a specified delimiter and style.
Public methodFloatMatrix(Int32, Int32, RandomNumberStream, IRandomNumberDistributionSingle)
Constructs a FloatMatrix instance from a random number generator.
Public methodCode exampleFloatMatrix(Int32, Int32, TextReader, Char)
Constructs a FloatMatrix instance from a given text reader with a specified delimiter.
Public methodFloatMatrix(Int32, Int32, Single, Single)
Constructs a FloatMatrix instance of the specifed dimensions. Values are initialized starting with a given initial value, incremented by the specified amount for each element in the matrix.
Public methodFloatMatrix(Int32, Int32, Single, StorageType)
Constructs a FloatMatrix instance of the specified dimensions, initialized with the values in a given array.
Public methodCode exampleFloatMatrix(Int32, Int32, String, Char)
Constructs a FloatMatrix instance from a formatted string with a specified delimiter.
Public methodFloatMatrix(Int32, Int32, FloatDataBlock, Int32, Int32)
Constructs a FloatMatrix instance from a data block with the given row and column strides.
Public methodCode exampleFloatMatrix(Int32, Int32, TextReader, NumberStyles, Char)
Constructs a FloatMatrix instance from a given text reader with specified delimiter and styles.
Public methodCode exampleFloatMatrix(Int32, Int32, String, NumberStyles, Char)
Constructs a FloatMatrix instance from a formatted string with a specified delimiter and style.
Top
Properties
  NameDescription
Public propertyCols
Gets number of columns in this matrix.
Public propertyCode exampleColStride
Gets the increment between successive elements in a column.
Public propertyDataBlock
Gets a reference to the underly data that this matrix is viewing.
Public propertyIsCompactStride
Returns true if the matrix data is in column major contiguous storage.
Public propertyItemInt32, Slice
Creates a vector view of the specifed slice of the specified row of this matrix.
Public propertyItemInt32, Int32
Indexer for returning the element at a specified row and column position.
Public propertyItemSlice, Slice
Returns the submatrix determined by the specified slices.
Public propertyItemSlice, Int32
Creates a vector view of the specifed slice of the specified column of this matrix.
Public propertyRows
Gets the number of rows in this matrix.
Public propertyCode exampleRowStride
Gets the increment between successive elements in a row.
Top
Methods
  NameDescription
Public methodStatic memberAdd(Single, FloatMatrix)
Adds a scalar and a matrix.
Public methodStatic memberAdd(FloatMatrix, FloatMatrix)
Adds two matrices.
Public methodStatic memberAdd(FloatMatrix, Single)
Adds a matrix and a scalar.
Public methodStatic memberAdd(Single, FloatMatrix, FloatMatrix)
Adds a scalar and a matrix.
Public methodStatic memberAdd(FloatMatrix, FloatMatrix, FloatMatrix)
Adds two matrices.
Public methodStatic memberAdd(FloatMatrix, Single, FloatMatrix)
Adds a scalar to a matrix
Public methodApply(FuncSingle, Single)
Returns a new matrix with the same size as this matrix, whose values are the result of applying the given unary function to each element of this matrix.
Public methodApply(FuncSingle, Int32, Single, Int32)
Returns a new matrix with the same size as this matrix, whose values are the result of applying the given binary function to each element of this matrix. The first parameter to the binary function is the matrix element; the second parameter is the passed integer value.
Public methodApply(FuncSingle, Single, Single, FloatMatrix)
Returns a new matrix with the same size as this matrix, whose values are the result of applying the given binary function to each element of this matrix. The first parameter to the binary function is the matrix element; the second parameter is the corresponding element of the passed matrix.
Public methodApply(FuncSingle, Single, Single, Single)
Returns a new matrix with the same size as this matrix, whose values are the result of applying the given binary function to each element of this matrix. The first parameter to the binary function is the matrix element; the second parameter is the passed floating point value.
Public methodApplyColumns
Returns a new vector containing an element for each column in this matrix. The elements are the results of applying a function that takes a vector and returns a single-precision number.
Public methodClear
Sets the data elements of this vector to zero.
Public methodClear(Int32, Slice)
Sets the values of the submatrix determined by the specified slices to zero.
Public methodClear(Slice, Slice)
Sets the values of the submatrix determined by the specified slices to zero.
Public methodClear(Slice, Int32)
Sets the values of the submatrix determined by the specified slices to zero.
Public methodClone
Creates a deep copy of this matrix.
Public methodCol
Returns a column of this matrix as a vector. The returned vector and the matrix share the data.
Public methodStatic memberDecrement
Decrements each element of the given matrix.
Public methodDeepenThisCopy
Guarantees that there is only one reference to the underlying data and that this data is in contiguous storage.
Public methodDiagonal
Returns a vector view of the main diagonal of this matrix.
Public methodDiagonal(Int32)
Returns a vector view of a diagonal of this matrix.
Public methodStatic memberDivide(Single, FloatMatrix)
Divide a scalar by a matrix.
Public methodStatic memberDivide(FloatMatrix, FloatMatrix)
Divide a matrix by another.
Public methodStatic memberDivide(FloatMatrix, Single)
Divide a matrix by a scalar.
Public methodStatic memberDivide(Single, FloatMatrix, FloatMatrix)
Divide a scalar by a matrix.
Public methodStatic memberDivide(FloatMatrix, FloatMatrix, FloatMatrix)
Divide a matrix by another.
Public methodStatic memberDivide(FloatMatrix, Single, FloatMatrix)
Divide a matrix by a scalar.
Public methodEquals
Tests for equality of this matrix and another matrix. Two matrices are equal if they have the same dimensions and all values are equal.
(Overrides ObjectEquals(Object).)
Public methodFrobeniusNorm
Computes the Frobenius norm for this matrix.
Public methodGetEnumerator
Creates an IEnumerator{float} out of the data elements in this matrix.
Public methodGetFloatEnumerator
Creates an IFloatEnumerator out of the data elements in this vector.
Public methodGetHashCode
Returns an integer hash code for this matrix.
(Overrides ObjectGetHashCode.)
Public methodGetSchema
The method is reserved and should not be used.
Public methodStatic memberIdentity
Returns an identity matrix of the specified size.
Public methodIncrement(Single)
Adds the specified value to each element in the matrix.
Public methodStatic memberIncrement(FloatMatrix)
Increments each element of the given matrix.
Public methodInfinityNorm
Computes the infinity-norm of this matrix.
Public methodIsNumeric
Checks every matrix element for NaN or Infinity values, if none are found, true is returned, otherwise false is returned.
Public methodStatic memberMultiply(Single, FloatMatrix)
Multiple a scalar and a matrix.
Public methodStatic memberMultiply(FloatMatrix, FloatMatrix)
Multiply two matrices.
Public methodStatic memberMultiply(FloatMatrix, Single)
Multiply a matrix and a scalar.
Public methodStatic memberMultiply(Single, FloatMatrix, FloatMatrix)
Multiply a scalar and a matrix.
Public methodStatic memberMultiply(FloatMatrix, FloatMatrix, FloatMatrix)
Multiply two matrices.
Public methodStatic memberMultiply(FloatMatrix, Single, FloatMatrix)
Multiply a matrix and a scalar.
Public methodNaNEquals
Tests for equality of this matrix and another matrix. Two matrices are equal if they have the same dimensions and all values are equal.
Public methodStatic memberNegate
Negation operator.
Public methodOneNorm
Computes the 1-norm of this matrix.
Public methodStatic memberCode exampleParse(TextReader)
Returns a new FloatMatrix instance from the given text reader.
Public methodStatic memberCode exampleParse(String)
Constructs a FloatMatrix instance from a formatted string.
Public methodStatic memberCode exampleParse(TextReader, NumberStyles)
Returns a new FloatMatrix instance from the given text reader.
Public methodStatic memberCode exampleParse(String, NumberStyles)
Constructs a FloatMatrix instance from a formatted string and a NumberStyles object.
Public methodCode exampleReadXml
Generates a FloatMatrix instance form its XML representation.
Examples
The matrix: | 1 2 3 | | 4 5 6 | | 7 8 9 | would be serialized as:
Public methodResize
Changes the dimensions of this matrix to those specified, adding zeros or truncating as necessary.
Public methodResizeAndClear
Changes the dimensions of this matrix to those specified. Matrix values are not preserved during this operation and are reset to zero.
Public methodRow
Returns a row of this matrix as a vector. The returned vector and the matrix share the data.
Public methodScale
Scales each element in the matrix by the specified value.
Public methodSet(Single)
Sets the data elements of this vector to the specified value.
Public methodSet(Int32, Slice, Single)
Sets the values in the specified row and columns to the given value.
Public methodSet(Slice, Slice, Single)
Sets the values of the submatrix determined by the specified slices to a given value.
Public methodSet(Slice, Int32, Single)
Sets the values in the specified rows and column to a given value.
Public methodShallowCopy
Creates a shallow copy of this matrix.
Public methodSlice
Returns a vector that views a slice of this matrix. The slice begins at element i,j and extends for n elements. The increment between successive elements in the vector is rowStride rows and colStride columns.
Public methodStatic memberSubtract(Single, FloatMatrix)
Subtracts a matrix from a scalar.
Public methodStatic memberSubtract(FloatMatrix, FloatMatrix)
Subtracts one matrix from another.
Public methodStatic memberSubtract(FloatMatrix, Single)
Subtracts a scalar from a matrix.
Public methodStatic memberSubtract(Single, FloatMatrix, FloatMatrix)
Subtracts a matrix from a scalar.
Public methodStatic memberSubtract(FloatMatrix, FloatMatrix, FloatMatrix)
Subtracts one matrix from another.
Public methodStatic memberSubtract(FloatMatrix, Single, FloatMatrix)
Subtracts a scalar from a matrix.
Public methodToArray
Copies data into a new array and returns it.
Public methodCode exampleToCommaSeparated
Returns a formatted string representation of this matrix using commas and newlines.
Public methodCode exampleToCommaSeparated(String)
Returns a formatted string representation of this matrix using commas and newlines. Numbers are formatted using the specified format string.
Public methodToDataTable
Creates a data table containing the values in this matrix.
Public methodToDataTable(String)
Creates a data table with the specified name containing the values in this matrix.
Public methodCode exampleToString
Returns a formatted string representation of this matrix.
(Overrides ObjectToString.)
Public methodCode exampleToString(String)
Returns a formatted string representation of this matrix. Numbers are displayed using the specified format.
Public methodCode exampleToTabDelimited
Returns a formatted string representation of this matrix using tabs and newlines.
Public methodCode exampleToTabDelimited(String)
Returns a formatted string representation of this matrix using tabs and newlines. Numbers are formatted using the specified format string.
Public methodTransform(FuncSingle)
Modifies the elements of this matrix by applying the given no-argument function to each element.
Public methodTransform(FuncSingle, Single)
Modifies the elements of this matrix by applying the given unary function to each element.
Public methodTransform(FuncSingle, Int32, Single, Int32)
Modifies the contents of this matrix by applying the given binary function to each element. The first parameter to the binary function is the matrix element; the second parameter is the passed integer value.
Public methodTransform(FuncSingle, Single, Single, FloatMatrix)
Modifies the contents of this matrix by applying the given binary function to each element. The first parameter to the binary function is the matrix element; the second parameter is the corresponding element of the passed matrix.
Public methodTransform(FuncSingle, Single, Single, Single)
Modifies the contents of this matrix by applying the given binary function to each element. The first parameter to the binary function is the matrix element; the second parameter is the passed floating point value.
Public methodTranspose
Returns the transpose of this matrix.
Public methodWrite(TextWriter)
Writes a text representation of this matrix to the writer.
Public methodWrite(TextWriter, String)
Writes a formatted text representation of this matrix to the writer using the specified format.
Public methodCode exampleWriteAsCSV(TextWriter)
Writes a formatted text representation of this matrix using commas and newlines.
Public methodCode exampleWriteAsCSV(TextWriter, String)
Writes a formatted string representation of this matrix using commas and newlines. Numbers are formatted using the specified format string.
Public methodCode exampleWriteXml
Converts an object into its XML representation.
Examples
The matrix: | 1 2 3 | | 4 5 6 | | 7 8 9 | would be serialized as:
Top
Operators
  NameDescription
Public operatorStatic memberAddition(Single, FloatMatrix)
Adds a scalar and a matrix.
Public operatorStatic memberAddition(FloatMatrix, FloatMatrix)
Adds two matrices.
Public operatorStatic memberAddition(FloatMatrix, Single)
Adds a matrix and a scalar.
Public operatorStatic memberDecrement
Decrements each element of the input matrix.
Public operatorStatic memberDivision(Single, FloatMatrix)
Divide a scalar by a matrix.
Public operatorStatic memberDivision(FloatMatrix, FloatMatrix)
Divide a matrix by another.
Public operatorStatic memberDivision(FloatMatrix, Single)
Divide a matrix by a scalar.
Public operatorStatic memberEquality
Tests for equality of two matrices. Two matrices are equal if they have the same dimensions and all values are equal.
Public operatorStatic memberIncrement
Increments each element of the given matrix.
Public operatorStatic memberInequality
Tests for inequality of two matrices. Two matrices are not equal if they have different dimensions or their values are not all equal.
Public operatorStatic memberMultiply(Single, FloatMatrix)
Multiple a scalar and a matrix.
Public operatorStatic memberMultiply(FloatMatrix, FloatMatrix)
Multiple two matrices.
Public operatorStatic memberMultiply(FloatMatrix, Single)
Multiply a matrix and a scalar.
Public operatorStatic memberSubtraction(Single, FloatMatrix)
Subtracts a matrix from a scalar.
Public operatorStatic memberSubtraction(FloatMatrix, FloatMatrix)
Subtracts one matrix from another.
Public operatorStatic memberSubtraction(FloatMatrix, Single)
Subtracts a scalar from a matrix.
Public operatorStatic memberUnaryNegation
Negation operator.
Public operatorStatic memberUnaryPlus
Unary + operator. Just returns the input matrix.
Top
Fields
  NameDescription
Public fieldStatic memberXmlColumnsAttribute
XML columns attribute name.
Public fieldStatic memberXmlDataElement
XML data element name.
Public fieldStatic memberXmlDatumElement
XML datum element name.
Public fieldStatic memberXmlRowsAttribute
XML rows attribute name.
Top
See Also