Defines how matrices are formatted and displayed, depending on the chosen format representation.
Inheritance: ICustomFormatter
Example #1
0
 /// <summary>
 ///   Converts the string representation of a matrix to its
 ///   double-precision floating-point number matrix equivalent.
 /// </summary>
 /// <param name="s">The string representation of the matrix.</param>
 /// <param name="provider">
 ///   The format provider to use in the conversion. Default is to use
 ///   <see cref="DefaultMatrixFormatProvider.CurrentCulture"/>.
 /// </param>
 /// <returns>A double-precision floating-point number matrix parsed
 /// from the given string using the given format provider.</returns>
 ///
 public static double[][] ParseJagged(string s, IMatrixFormatProvider provider)
 {
     return(MatrixFormatter.ParseJagged(s, provider));
 }
Example #2
0
 /// <summary>
 ///   Converts the string representation of a matrix to its
 ///   double-precision floating-point number matrix equivalent.
 /// </summary>
 /// <param name="str">The string representation of the matrix.</param>
 /// <returns>A double-precision floating-point number matrix parsed
 /// from the given string using the given format provider.</returns>
 ///
 public static double[,] Parse(string str)
 {
     return(MatrixFormatter.ParseMultidimensional(str, DefaultMatrixFormatProvider.CurrentCulture));
 }
Example #3
0
 /// <summary>
 ///   Converts the string representation of a matrix to its
 ///   double-precision floating-point number matrix equivalent.
 /// </summary>
 /// <param name="str">The string representation of the matrix.</param>
 /// <param name="provider">
 ///   The format provider to use in the conversion. Default is to use
 ///   <see cref="DefaultMatrixFormatProvider.CurrentCulture"/>.
 /// </param>
 /// <returns>A double-precision floating-point number matrix parsed
 /// from the given string using the given format provider.</returns>
 ///
 public static double[,] Parse(string str, IMatrixFormatProvider provider)
 {
     return(MatrixFormatter.ParseMultidimensional(str, provider));
 }
Example #4
0
 /// <summary>
 ///   Returns a <see cref="System.String"/> that represents an array.
 /// </summary>
 ///
 /// <param name="array">The array.</param>
 ///
 /// <param name="format">
 ///   The format to use when creating the resulting string.
 /// </param>
 ///
 /// <returns>
 ///   A <see cref="System.String"/> that represents this instance.
 /// </returns>
 ///
 /// <example>
 ///   Please see <see cref="CSharpMatrixFormatProvider"/>,
 ///   <see cref="OctaveArrayFormatProvider"/> or <see cref="DefaultArrayFormatProvider"/>
 ///   for examples and more details.
 /// </example>
 ///
 public static string ToString(this double[] array, string format)
 {
     return(MatrixFormatter.Format(format, array, DefaultArrayFormatProvider.CurrentCulture));
 }
Example #5
0
 /// <summary>
 ///   Returns a <see cref="System.String"/> that represents an array.
 /// </summary>
 ///
 /// <param name="matrix">The matrix.</param>
 ///
 /// <param name="format">
 ///   The format to use when creating the resulting string.
 /// </param>
 ///
 /// <param name="provider">
 ///   The <see cref="IMatrixFormatProvider"/> to be used
 ///   when creating the resulting string. Default is to use
 ///   <see cref="DefaultMatrixFormatProvider.CurrentCulture"/>.
 /// </param>
 ///
 /// <returns>
 ///   A <see cref="System.String"/> that represents this instance.
 /// </returns>
 ///
 /// <example>
 ///   Please see <see cref="CSharpMatrixFormatProvider"/>,
 ///   <see cref="OctaveArrayFormatProvider"/> or <see cref="DefaultArrayFormatProvider"/>
 ///   for examples and more details.
 /// </example>
 ///
 public static string ToString(this double[] matrix, string format, IMatrixFormatProvider provider)
 {
     return(MatrixFormatter.Format(format, matrix, provider));
 }
Example #6
0
 /// <summary>
 ///   Returns a <see cref="System.String"/> that represents a matrix.
 /// </summary>
 ///
 /// <param name="matrix">The matrix.</param>
 ///
 /// <param name="format">
 ///   The format to use when creating the resulting string.
 /// </param>
 ///
 /// <returns>
 ///   A <see cref="System.String"/> that represents this instance.
 /// </returns>
 ///
 /// <example>
 ///   Please see <see cref="CSharpMatrixFormatProvider"/>,
 ///   <see cref="CSharpJaggedMatrixFormatProvider"/>, <see cref="CSharpArrayFormatProvider"/>,
 ///   <see cref="OctaveMatrixFormatProvider"/>, or <see cref="OctaveArrayFormatProvider"/>
 ///   for more details.
 /// </example>
 ///
 public static string ToString(this double[][] matrix, string format)
 {
     return(MatrixFormatter.Format(format, matrix, DefaultMatrixFormatProvider.CurrentCulture));
 }
Example #7
0
 /// <summary>
 ///   Converts the string representation of a vector to its
 ///   double-precision floating-point number vector equivalent.
 /// </summary>
 /// <param name="str">The string representation of the vector.</param>
 /// <param name="provider">
 ///   The format provider to use in the conversion. Default is to use
 ///   <see cref="DefaultMatrixFormatProvider.CurrentCulture"/>.
 /// </param>
 /// <returns>A double-precision floating-point number matrix parsed
 /// from the given string using the given format provider.</returns>
 ///
 public static double[] Parse(string str, IMatrixFormatProvider provider)
 {
     return(MatrixFormatter.ParseJagged(str, provider).Flatten());
 }
Example #8
0
 /// <summary>
 ///   Converts the string representation of a vector to its
 ///   double-precision floating-point number vector equivalent.
 /// </summary>
 /// <param name="str">The string representation of the matrix.</param>
 /// <returns>A double-precision floating-point number matrix parsed
 /// from the given string using the given format provider.</returns>
 ///
 public static double[] Parse(string str)
 {
     return(MatrixFormatter.ParseJagged(str, DefaultMatrixFormatProvider.CurrentCulture).Flatten());
 }