Пример #1
0
 /// <summary>
 /// Writes a matrix in DenseAnsi format to a file. 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="filename">The file 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, string filename, ParallelOptions parallelOptions)
 {
     FileUtils.CreateDirectoryForFileIfNeeded(filename);
     using (TextWriter writer = File.CreateText(filename))
     {
         matrix.WriteDenseAnsi(writer, parallelOptions);
     }
 }
Пример #2
0
        //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);
        }
Пример #3
0
        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);
        }