예제 #1
0
 /// <summary>
 /// Writes the matrix to a file in dense format. A directory will be created if needed.
 /// The first line is "var" TAB and then the tab-delimited col keys.
 /// Next is one line per row key. Each line is the row key TAB and then the tab-limited values.
 /// Values may include the special Missing value.
 /// </summary>
 /// <typeparam name="TRowKey">The type of the row key. Usually "String"</typeparam>
 /// <typeparam name="TColKey">The type of the col key. Usually "String"</typeparam>
 /// <typeparam name="TValue">The type of the value, for example, double, int, char, etc.</typeparam>
 /// <param name="matrix">The matrix to write</param>
 /// <param name="filename">The filename to write to.</param>
 public static void WriteDense <TRowKey, TColKey, TValue>(this Matrix <TRowKey, TColKey, TValue> matrix, string filename)
 {
     FileUtils.CreateDirectoryForFileIfNeeded(filename);
     using (TextWriter textWriter = File.CreateText(filename))
     {
         matrix.WriteDense(textWriter);
     }
 }