/// <summary> /// Converts matrix to a DenseAnsi. Even if the matrix is already an denseAnsi, a new one is created.. /// </summary> /// <param name="matrix">The matrix to convert from</param> /// <param name="parallelOptions">A ParallelOptions instance that configures the multithreaded behavior of this operation.</param> /// <returns>A denseAnsi version of the matrix</returns> public static DenseAnsi ToDenseAnsi <T>(this Matrix <string, string, T> matrix, ParallelOptions parallelOptions) { var matrix2 = matrix.ConvertValueView(new CharToGenericConverter <T>().Inverted, '?'); return(matrix2.ToDenseAnsi(parallelOptions)); }
//Similar code elsewhere, but hard to move static code to common location /// <summary> /// Writes a matrix in DenseAnsi format to a textWriter. Converts the values of the matrix to char (on the fly). Does not need to convert to DenseAnsi format. /// </summary> /// <typeparam name="T">The type of the values of the matrix, for example, double</typeparam> /// <param name="matrix">The matrix to write</param> /// <param name="textWriter">The stream to write to</param> /// <param name="parallelOptions">A ParallelOptions instance that configures the multithreaded behavior of this operation.</param> public static void WriteDenseAnsi <T>(this Matrix <string, string, T> matrix, TextWriter textWriter, ParallelOptions parallelOptions) { Matrix <string, string, char> matrixInternal = matrix.ConvertValueView(new CharToGenericConverter <T>().Inverted, DenseAnsi.StaticMissingValue); matrixInternal.WriteDenseAnsi(textWriter, parallelOptions); }
public static void WriteDenseAnsi <T>(this Matrix <string, string, T> matrix, TextWriter textWriter, ParallelOptions parallelOptions, bool verbose = false) { Matrix <string, string, char> matrixInternal = matrix.ConvertValueView(ValueConverter.GetCharToGeneric <T>().Inverted, DenseAnsi.StaticMissingValue); matrixInternal.WriteDenseAnsi(textWriter, parallelOptions, verbose); }