Click or drag to resize
Accord.NET (logo)

CSharpJaggedMatrixFormatProvider Class

Gets the matrix representation used in C# jagged arrays.
Inheritance Hierarchy
SystemObject
  Accord.MathMatrixFormatProviderBase
    Accord.MathCSharpJaggedMatrixFormatProvider

Namespace:  Accord.Math
Assembly:  Accord.Math (in Accord.Math.dll) Version: 3.8.0
Syntax
public sealed class CSharpJaggedMatrixFormatProvider : MatrixFormatProviderBase
Request Example View Source

The CSharpJaggedMatrixFormatProvider type exposes the following members.

Constructors
  NameDescription
Public methodCSharpJaggedMatrixFormatProvider
Initializes a new instance of the CSharpJaggedMatrixFormatProvider class.
Top
Properties
  NameDescription
Public propertyStatic memberCurrentCulture
Gets the IMatrixFormatProvider which uses the CultureInfo used by the current thread.
Public propertyFormatColDelimiter
A string containing the column delimiter for a matrix to be used in formatting.
(Inherited from MatrixFormatProviderBase.)
Public propertyFormatColEnd
A string denoting the end of a matrix column to be used in formatting.
(Inherited from MatrixFormatProviderBase.)
Public propertyFormatColStart
A string denoting the start of a matrix column to be used in formatting.
(Inherited from MatrixFormatProviderBase.)
Public propertyFormatMatrixEnd
A string denoting the end of the matrix to be used in formatting.
(Inherited from MatrixFormatProviderBase.)
Public propertyFormatMatrixStart
A string denoting the start of the matrix to be used in formatting.
(Inherited from MatrixFormatProviderBase.)
Public propertyFormatRowDelimiter
A string containing the row delimiter for a matrix to be used in formatting.
(Inherited from MatrixFormatProviderBase.)
Public propertyFormatRowEnd
A string denoting the end of a matrix row to be used in formatting.
(Inherited from MatrixFormatProviderBase.)
Public propertyFormatRowStart
A string denoting the start of a matrix row to be used in formatting.
(Inherited from MatrixFormatProviderBase.)
Public propertyInnerProvider
Gets the culture specific formatting information to be used during parsing or formatting.
(Inherited from MatrixFormatProviderBase.)
Public propertyStatic memberInvariantCulture
Gets the IMatrixFormatProvider which uses the invariant system culture.
Public propertyParseColDelimiter
A string containing the column delimiter for a matrix to be used in parsing.
(Inherited from MatrixFormatProviderBase.)
Public propertyParseColEnd
A string denoting the end of a matrix column to be used in parsing.
(Inherited from MatrixFormatProviderBase.)
Public propertyParseColStart
A string denoting the start of a matrix column to be used in parsing.
(Inherited from MatrixFormatProviderBase.)
Public propertyParseMatrixEnd
A string denoting the end of the matrix to be used in parsing.
(Inherited from MatrixFormatProviderBase.)
Public propertyParseMatrixStart
A string denoting the start of the matrix to be used in parsing.
(Inherited from MatrixFormatProviderBase.)
Public propertyParseRowDelimiter
A string containing the row delimiter for a matrix to be used in parsing.
(Inherited from MatrixFormatProviderBase.)
Public propertyParseRowEnd
A string denoting the end of a matrix row to be used in parsing.
(Inherited from MatrixFormatProviderBase.)
Public propertyParseRowStart
A string denoting the start of a matrix row to be used in parsing.
(Inherited from MatrixFormatProviderBase.)
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetFormat
Returns an object that provides formatting services for the specified type. Currently, only IMatrixFormatProvider is supported.
(Inherited from MatrixFormatProviderBase.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks
This class can be used to convert to and from C# arrays and their string representation. Please see the example for details.
Examples

Converting from a jagged matrix to a string representation:

// Declare a number array
double[][] x = 
{
   new double[] { 1, 2, 3, 4 },
   new double[] { 5, 6, 7, 8 },
};

// Convert the aforementioned array to a string representation:
string str = x.ToString(CSharpJaggedMatrixFormatProvider.CurrentCulture);

// the final result will be equivalent to
"double[][] x =                  " +
"{                               " +
"   new double[] { 1, 2, 3, 4 }, " +
"   new double[] { 5, 6, 7, 8 }, " +
"}"

Converting from strings to actual arrays:

// Declare an input string
string str = "double[][] x =     " +
"{                               " +
"   new double[] { 1, 2, 3, 4 }, " +
"   new double[] { 5, 6, 7, 8 }, " +
"}";

// Convert the string representation to an actual number array:
double[][] array = Matrix.Parse(str, CSharpJaggedMatrixFormatProvider.InvariantCulture);

// array will now contain the actual jagged 
// array representation of the given string.
See Also