Esempio n. 1
0
        public void CanWriteCommaDelimitedComplexData()
        {
            var matrix =
                LinearAlgebra.Complex.DenseMatrix.OfArray(new[, ]
            {
                { new Complex(1.1, 1.1), new Complex(2.2, 2.2), new Complex(3.3, 3.3) },
                { new Complex(4.4, 4.4), new Complex(5.5, 5.5), new Complex(6.6, 6.6) },
                { new Complex(7.7, 7.7), new Complex(8.8, 8.8), new Complex(9.9, 9.9) }
            });
            var writer = new DelimitedWriter(",")
            {
                FormatProvider = CultureInfo.InvariantCulture
            };
            var stream = new MemoryStream();

            writer.WriteMatrix(matrix, stream);
            var data     = stream.ToArray();
            var reader   = new StreamReader(new MemoryStream(data));
            var text     = reader.ReadToEnd();
            var expected = "(1.1, 1.1),(2.2, 2.2),(3.3, 3.3)" + Environment.NewLine
                           + "(4.4, 4.4),(5.5, 5.5),(6.6, 6.6)" + Environment.NewLine
                           + "(7.7, 7.7),(8.8, 8.8),(9.9, 9.9)";

            Assert.AreEqual(expected, text);
        }
 public void CanWriteCommaDelimitedData()
 {
     var matrix = new DenseMatrix(new[,] { { 1.1, 2.2, 3.3 }, { 4.4, 5.5, 6.6 }, { 7.7, 8.8, 9.9 } });
     var writer = new DelimitedWriter(',');
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     var expected = @"1.1,2.2,3.3" + Environment.NewLine
                    + "4.4,5.5,6.6" + Environment.NewLine
                    + "7.7,8.8,9.9";
     Assert.AreEqual(expected, text);
 }
 public void CanWriteCommaDelimitedData()
 {
     var matrix = new DenseMatrix(new[,] { { new Complex(1.1, 1.1), new Complex(2.2, 2.2), new Complex(3.3, 3.3) }, { new Complex(4.4, 4.4), new Complex(5.5, 5.5), new Complex(6.6, 6.6) }, { new Complex(7.7, 7.7), new Complex(8.8, 8.8), new Complex(9.9, 9.9) } });
     var writer = new DelimitedWriter(',');
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     var expected = "(1.1, 1.1),(2.2, 2.2),(3.3, 3.3)" + Environment.NewLine
                    + "(4.4, 4.4),(5.5, 5.5),(6.6, 6.6)" + Environment.NewLine
                    + "(7.7, 7.7),(8.8, 8.8),(9.9, 9.9)";
     Assert.AreEqual(expected, text);
 }
 public void CanWriteSpaceDelimitedData()
 {
     var matrix = new SparseMatrix(new[,] { { 1.1, 0, 0 }, { 0, 5.5, 0 }, { 0, 0, 9.9 } });
     var writer = new DelimitedWriter(' ');
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     const string expected = @"1.1 0 0
     0 5.5 0
     0 0 9.9";
     Assert.AreEqual(expected, text);
 }
 public void CanWriteCommaDelimitedData()
 {
     var matrix = new DenseMatrix(new[,] { { 1.1f, 2.2f, 3.3f }, { 4.4f, 5.5f, 6.6f }, { 7.7f, 8.8f, 9.9f } });
     var writer = new DelimitedWriter(',');
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     const string expected = @"1.1,2.2,3.3
     4.4,5.5,6.6
     7.7,8.8,9.9";
     Assert.AreEqual(expected, text);
 }
 public void CanWriteCommaDelimitedData()
 {
     var matrix = DenseMatrix.OfArray(new[,] {{1.1f, 2.2f, 3.3f}, {4.4f, 5.5f, 6.6f}, {7.7f, 8.8f, 9.9f}});
     var writer = new DelimitedWriter(',')
         {
             CultureInfo = CultureInfo.InvariantCulture
         };
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     var expected = @"1.1,2.2,3.3" + Environment.NewLine
         + "4.4,5.5,6.6" + Environment.NewLine
         + "7.7,8.8,9.9";
     Assert.AreEqual(expected, text);
 }
 public void CanWriteCommaDelimitedData()
 {
     var matrix = DenseMatrix.OfArray(new[,] {{new Complex32(1.1f, 1.1f), new Complex32(2.2f, 2.2f), new Complex32(3.3f, 3.3f)}, {new Complex32(4.4f, 4.4f), new Complex32(5.5f, 5.5f), new Complex32(6.6f, 6.6f)}, {new Complex32(7.7f, 7.7f), new Complex32(8.8f, 8.8f), new Complex32(9.9f, 9.9f)}});
     var writer = new DelimitedWriter(',')
         {
             CultureInfo = CultureInfo.InvariantCulture
         };
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     var expected = "(1.1, 1.1),(2.2, 2.2),(3.3, 3.3)" + Environment.NewLine
         + "(4.4, 4.4),(5.5, 5.5),(6.6, 6.6)" + Environment.NewLine
         + "(7.7, 7.7),(8.8, 8.8),(9.9, 9.9)";
     Assert.AreEqual(expected, text);
 }
 public void CanWritePeriodDelimitedData()
 {
     var matrix = new DenseMatrix(new[,] { { 1.1, 2.2, 3.3 }, { 4.4, 5.5, 6.6 }, { 7.7, 8.8, 9.9 } });
     var culture = new CultureInfo("tr-TR");
     var writer = new DelimitedWriter('.')
                  {
                      CultureInfo = culture
                  };
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     const string expected = @"1,1.2,2.3,3
     4,4.5,5.6,6
     7,7.8,8.9,9";
     Assert.AreEqual(expected, text);
 }
 public void CanWritePeriodDelimitedData()
 {
     var matrix = DenseMatrix.OfArray(new[,] {{new Complex32(1.1f, 1.1f), new Complex32(2.2f, 2.2f), new Complex32(3.3f, 3.3f)}, {new Complex32(4.4f, 4.4f), new Complex32(5.5f, 5.5f), new Complex32(6.6f, 6.6f)}, {new Complex32(7.7f, 7.7f), new Complex32(8.8f, 8.8f), new Complex32(9.9f, 9.9f)}});
     var culture = new CultureInfo("tr-TR");
     var writer = new DelimitedWriter('.')
         {
             CultureInfo = culture
         };
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     var expected = "(1,1, 1,1).(2,2, 2,2).(3,3, 3,3)" + Environment.NewLine
         + "(4,4, 4,4).(5,5, 5,5).(6,6, 6,6)" + Environment.NewLine
         + "(7,7, 7,7).(8,8, 8,8).(9,9, 9,9)";
     Assert.AreEqual(expected, text);
 }
Esempio n. 10
0
        public void CanWriteSpaceDelimitedData()
        {
            var matrix = new SparseMatrix(new[, ] {
                { 1.1f, 0, 0 }, { 0, 5.5f, 0 }, { 0, 0, 9.9f }
            });
            var writer = new DelimitedWriter(' ');
            var stream = new MemoryStream();

            writer.WriteMatrix(matrix, stream);
            var data     = stream.ToArray();
            var reader   = new StreamReader(new MemoryStream(data));
            var text     = reader.ReadToEnd();
            var expected = @"1.1 0 0" + Environment.NewLine
                           + "0 5.5 0" + Environment.NewLine
                           + "0 0 9.9";

            Assert.AreEqual(expected, text);
        }
 public void CanWritePeriodDelimitedData()
 {
     var matrix = new DenseMatrix(new[,] { { new Complex(1.1, 1.1), new Complex(2.2, 2.2), new Complex(3.3, 3.3) }, { new Complex(4.4, 4.4), new Complex(5.5, 5.5), new Complex(6.6, 6.6) }, { new Complex(7.7, 7.7), new Complex(8.8, 8.8), new Complex(9.9, 9.9) } });
     var culture = new CultureInfo("tr-TR");
     var writer = new DelimitedWriter('.')
                  {
                      CultureInfo = culture
                  };
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     var expected = "(1,1, 1,1).(2,2, 2,2).(3,3, 3,3)" + Environment.NewLine
                    + "(4,4, 4,4).(5,5, 5,5).(6,6, 6,6)" + Environment.NewLine
                    + "(7,7, 7,7).(8,8, 8,8).(9,9, 9,9)";
     Assert.AreEqual(expected, text);
 }
Esempio n. 12
0
        public void CanWriteCommaDelimitedData()
        {
            var matrix = new DenseMatrix(new[, ] {
                { 1.1f, 2.2f, 3.3f }, { 4.4f, 5.5f, 6.6f }, { 7.7f, 8.8f, 9.9f }
            });
            var writer = new DelimitedWriter(',');
            var stream = new MemoryStream();

            writer.WriteMatrix(matrix, stream);
            var data     = stream.ToArray();
            var reader   = new StreamReader(new MemoryStream(data));
            var text     = reader.ReadToEnd();
            var expected = @"1.1,2.2,3.3" + Environment.NewLine
                           + "4.4,5.5,6.6" + Environment.NewLine
                           + "7.7,8.8,9.9";

            Assert.AreEqual(expected, text);
        }
 public void CanWritePeriodDelimitedData()
 {
     var matrix = new DenseMatrix(new[,] { { 1.1f, 2.2f, 3.3f }, { 4.4f, 5.5f, 6.6f }, { 7.7f, 8.8f, 9.9f } });
     var culture = new CultureInfo("tr-TR");
     var writer = new DelimitedWriter('.')
                  {
                      CultureInfo = culture
                  };
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     var expected = @"1,1.2,2.3,3" + Environment.NewLine
                    + "4,4.5,5.6,6" + Environment.NewLine
                    + "7,7.8,8.9,9";
     Assert.AreEqual(expected, text);
 }
Esempio n. 14
0
        public void CanWriteSpaceDelimitedData()
        {
            var matrix = new DenseMatrix(new[, ] {
                { new Complex32(1.1f, 1.1f), new Complex32(2.2f, 2.2f), new Complex32(3.3f, 3.3f) }, { new Complex32(4.4f, 4.4f), new Complex32(5.5f, 5.5f), new Complex32(6.6f, 6.6f) }, { new Complex32(7.7f, 7.7f), new Complex32(8.8f, 8.8f), new Complex32(9.9f, 9.9f) }
            });
            var writer = new DelimitedWriter(' ');
            var stream = new MemoryStream();

            writer.WriteMatrix(matrix, stream);
            var data     = stream.ToArray();
            var reader   = new StreamReader(new MemoryStream(data));
            var text     = reader.ReadToEnd();
            var expected = "(1.1, 1.1) (2.2, 2.2) (3.3, 3.3)" + Environment.NewLine
                           + "(4.4, 4.4) (5.5, 5.5) (6.6, 6.6)" + Environment.NewLine
                           + "(7.7, 7.7) (8.8, 8.8) (9.9, 9.9)";

            Assert.AreEqual(expected, text);
        }
Esempio n. 15
0
        public void CanWriteCommaDelimitedSingleData()
        {
            var matrix = LinearAlgebra.Single.DenseMatrix.OfArray(new[, ] {
                { 1.1f, 2.2f, 3.3f }, { 4.4f, 5.5f, 6.6f }, { 7.7f, 8.8f, 9.9f }
            });
            var writer = new DelimitedWriter(",")
            {
                FormatProvider = CultureInfo.InvariantCulture
            };
            var stream = new MemoryStream();

            writer.WriteMatrix(matrix, stream);
            var data     = stream.ToArray();
            var reader   = new StreamReader(new MemoryStream(data));
            var text     = reader.ReadToEnd();
            var expected = @"1.1,2.2,3.3" + Environment.NewLine
                           + "4.4,5.5,6.6" + Environment.NewLine
                           + "7.7,8.8,9.9";

            Assert.AreEqual(expected, text);
        }
Esempio n. 16
0
        public void CanWriteCommaDelimitedData()
        {
            var matrix = DenseMatrix.OfArray(new[, ] {
                { 1.1, 2.2, 3.3 }, { 4.4, 5.5, 6.6 }, { 7.7, 8.8, 9.9 }
            });
            var writer = new DelimitedWriter(',')
            {
                CultureInfo = CultureInfo.InvariantCulture
            };
            var stream = new MemoryStream();

            writer.WriteMatrix(matrix, stream);
            var data     = stream.ToArray();
            var reader   = new StreamReader(new MemoryStream(data));
            var text     = reader.ReadToEnd();
            var expected = @"1.1,2.2,3.3" + Environment.NewLine
                           + "4.4,5.5,6.6" + Environment.NewLine
                           + "7.7,8.8,9.9";

            Assert.AreEqual(expected, text);
        }
        public void CanWritePeriodDelimitedData()
        {
            var matrix = DenseMatrix.OfArray(new[, ] {
                { new Complex(1.1, 1.1), new Complex(2.2, 2.2), new Complex(3.3, 3.3) }, { new Complex(4.4, 4.4), new Complex(5.5, 5.5), new Complex(6.6, 6.6) }, { new Complex(7.7, 7.7), new Complex(8.8, 8.8), new Complex(9.9, 9.9) }
            });
            var culture = new CultureInfo("tr-TR");
            var writer  = new DelimitedWriter('.')
            {
                CultureInfo = culture
            };
            var stream = new MemoryStream();

            writer.WriteMatrix(matrix, stream);
            var data     = stream.ToArray();
            var reader   = new StreamReader(new MemoryStream(data));
            var text     = reader.ReadToEnd();
            var expected = "(1,1, 1,1).(2,2, 2,2).(3,3, 3,3)" + Environment.NewLine
                           + "(4,4, 4,4).(5,5, 5,5).(6,6, 6,6)" + Environment.NewLine
                           + "(7,7, 7,7).(8,8, 8,8).(9,9, 9,9)";

            Assert.AreEqual(expected, text);
        }
Esempio n. 18
0
        public void CanWritePeriodDelimitedData()
        {
            var matrix = new DenseMatrix(new[, ] {
                { 1.1f, 2.2f, 3.3f }, { 4.4f, 5.5f, 6.6f }, { 7.7f, 8.8f, 9.9f }
            });
            var culture = new CultureInfo("tr-TR");
            var writer  = new DelimitedWriter('.')
            {
                CultureInfo = culture
            };
            var stream = new MemoryStream();

            writer.WriteMatrix(matrix, stream);
            var data     = stream.ToArray();
            var reader   = new StreamReader(new MemoryStream(data));
            var text     = reader.ReadToEnd();
            var expected = @"1,1.2,2.3,3" + Environment.NewLine
                           + "4,4.5,5.6,6" + Environment.NewLine
                           + "7,7.8,8.9,9";

            Assert.AreEqual(expected, text);
        }
 public void CanWriteTabDelimitedData()
 {
     var matrix = new UserDefinedMatrix(new[,] { { 1.1, 2.2, 3.3 }, { 4.4, 5.5, 6.6 }, { 7.7, 8.8, 9.9 } });
     var headers = new[] { "a", "b", "c" };
     var writer = new DelimitedWriter('\t')
                  {
                      ColumnHeaders = headers
                  };
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     var expected = "a\tb\tc"
         + Environment.NewLine
         + "1.1\t2.2\t3.3"
         + Environment.NewLine
         + "4.4\t5.5\t6.6"
         + Environment.NewLine
         + "7.7\t8.8\t9.9";
     Assert.AreEqual(expected, text);
 }
Esempio n. 20
0
        public void CanWritePeriodDelimitedData()
        {
            var matrix = new DenseMatrix(new[, ] {
                { new Complex32(1.1f, 1.1f), new Complex32(2.2f, 2.2f), new Complex32(3.3f, 3.3f) }, { new Complex32(4.4f, 4.4f), new Complex32(5.5f, 5.5f), new Complex32(6.6f, 6.6f) }, { new Complex32(7.7f, 7.7f), new Complex32(8.8f, 8.8f), new Complex32(9.9f, 9.9f) }
            });
            var culture = new CultureInfo("tr-TR");
            var writer  = new DelimitedWriter('.')
            {
                CultureInfo = culture
            };
            var stream = new MemoryStream();

            writer.WriteMatrix(matrix, stream);
            var data     = stream.ToArray();
            var reader   = new StreamReader(new MemoryStream(data));
            var text     = reader.ReadToEnd();
            var expected = "(1,1, 1,1).(2,2, 2,2).(3,3, 3,3)" + Environment.NewLine
                           + "(4,4, 4,4).(5,5, 5,5).(6,6, 6,6)" + Environment.NewLine
                           + "(7,7, 7,7).(8,8, 8,8).(9,9, 9,9)";

            Assert.AreEqual(expected, text);
        }
Esempio n. 21
0
        public void CanWriteTabDelimitedData()
        {
            var matrix = new UserDefinedMatrix(new[, ] {
                { 1.1f, 2.2f, 3.3f }, { 4.4f, 5.5f, 6.6f }, { 7.7f, 8.8f, 9.9f }
            });
            var headers = new[] { "a", "b", "c" };
            var writer  = new DelimitedWriter('\t')
            {
                ColumnHeaders = headers
            };
            var stream = new MemoryStream();

            writer.WriteMatrix(matrix, stream);
            var data     = stream.ToArray();
            var reader   = new StreamReader(new MemoryStream(data));
            var text     = reader.ReadToEnd();
            var expected = "a\tb\tc" + Environment.NewLine
                           + "1.1\t2.2\t3.3" + Environment.NewLine
                           + "4.4\t5.5\t6.6" + Environment.NewLine
                           + "7.7\t8.8\t9.9";

            Assert.AreEqual(expected, text);
        }
Esempio n. 22
0
        public void CanWriteTabDelimitedData()
        {
            var matrix = new DenseMatrix(new[, ] {
                { new Complex32(1.1f, 1.1f), new Complex32(2.2f, 2.2f), new Complex32(3.3f, 3.3f) }, { new Complex32(4.4f, 4.4f), new Complex32(5.5f, 5.5f), new Complex32(6.6f, 6.6f) }, { new Complex32(7.7f, 7.7f), new Complex32(8.8f, 8.8f), new Complex32(9.9f, 9.9f) }
            });
            var headers = new[] { "a", "b", "c" };
            var writer  = new DelimitedWriter('\t')
            {
                ColumnHeaders = headers
            };
            var stream = new MemoryStream();

            writer.WriteMatrix(matrix, stream);
            var data     = stream.ToArray();
            var reader   = new StreamReader(new MemoryStream(data));
            var text     = reader.ReadToEnd();
            var expected = "a\tb\tc" + Environment.NewLine
                           + "(1.1, 1.1)\t(2.2, 2.2)\t(3.3, 3.3)" + Environment.NewLine
                           + "(4.4, 4.4)\t(5.5, 5.5)\t(6.6, 6.6)" + Environment.NewLine
                           + "(7.7, 7.7)\t(8.8, 8.8)\t(9.9, 9.9)";

            Assert.AreEqual(expected, text);
        }
        public void CanWriteTabDelimitedData()
        {
            var matrix = DenseMatrix.OfArray(new[, ] {
                { new Complex(1.1, 1.1), new Complex(2.2, 2.2), new Complex(3.3, 3.3) }, { new Complex(4.4, 4.4), new Complex(5.5, 5.5), new Complex(6.6, 6.6) }, { new Complex(7.7, 7.7), new Complex(8.8, 8.8), new Complex(9.9, 9.9) }
            });
            var headers = new[] { "a", "b", "c" };
            var writer  = new DelimitedWriter('\t')
            {
                ColumnHeaders = headers,
                CultureInfo   = CultureInfo.InvariantCulture
            };
            var stream = new MemoryStream();

            writer.WriteMatrix(matrix, stream);
            var data     = stream.ToArray();
            var reader   = new StreamReader(new MemoryStream(data));
            var text     = reader.ReadToEnd();
            var expected = "a\tb\tc" + Environment.NewLine
                           + "(1.1, 1.1)\t(2.2, 2.2)\t(3.3, 3.3)" + Environment.NewLine
                           + "(4.4, 4.4)\t(5.5, 5.5)\t(6.6, 6.6)" + Environment.NewLine
                           + "(7.7, 7.7)\t(8.8, 8.8)\t(9.9, 9.9)";

            Assert.AreEqual(expected, text);
        }
 public void CanWriteTabDelimitedData()
 {
     var matrix = new DenseMatrix(new[,] { { new Complex(1.1, 1.1), new Complex(2.2, 2.2), new Complex(3.3, 3.3) }, { new Complex(4.4, 4.4), new Complex(5.5, 5.5), new Complex(6.6, 6.6) }, { new Complex(7.7, 7.7), new Complex(8.8, 8.8), new Complex(9.9, 9.9) } });
     var headers = new[] { "a", "b", "c" };
     var writer = new DelimitedWriter('\t')
                  {
                      ColumnHeaders = headers
                  };
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     var expected = "a\tb\tc" + Environment.NewLine
                    + "(1.1, 1.1)\t(2.2, 2.2)\t(3.3, 3.3)" + Environment.NewLine
                    + "(4.4, 4.4)\t(5.5, 5.5)\t(6.6, 6.6)" + Environment.NewLine
                    + "(7.7, 7.7)\t(8.8, 8.8)\t(9.9, 9.9)";
     Assert.AreEqual(expected, text);
 }
 public void CanWriteSpaceDelimitedData()
 {
     var matrix = new SparseMatrix(new[,] { { 1.1f, 0, 0 }, { 0, 5.5f, 0 }, { 0, 0, 9.9f } });
     var writer = new DelimitedWriter(' ')
                  {
                      CultureInfo = CultureInfo.InvariantCulture
                  };
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     var expected = @"1.1 0 0" + Environment.NewLine
                    + "0 5.5 0" + Environment.NewLine
                    + "0 0 9.9";
     Assert.AreEqual(expected, text);
 }
 public void CanWriteTabDelimitedData()
 {
     var matrix = new DenseMatrix(new[,] { { new Complex32(1.1f, 1.1f), new Complex32(2.2f, 2.2f), new Complex32(3.3f, 3.3f) }, { new Complex32(4.4f, 4.4f), new Complex32(5.5f, 5.5f), new Complex32(6.6f, 6.6f) }, { new Complex32(7.7f, 7.7f), new Complex32(8.8f, 8.8f), new Complex32(9.9f, 9.9f) } });
     var headers = new[] { "a", "b", "c" };
     var writer = new DelimitedWriter('\t')
                  {
                      ColumnHeaders = headers,
                      CultureInfo = CultureInfo.InvariantCulture
                  };
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     var expected = "a\tb\tc" + Environment.NewLine
                    + "(1.1, 1.1)\t(2.2, 2.2)\t(3.3, 3.3)" + Environment.NewLine
                    + "(4.4, 4.4)\t(5.5, 5.5)\t(6.6, 6.6)" + Environment.NewLine
                    + "(7.7, 7.7)\t(8.8, 8.8)\t(9.9, 9.9)";
     Assert.AreEqual(expected, text);
 }
 public void CanWriteSpaceDelimitedData()
 {
     var matrix = DenseMatrix.OfArray(new[,] {{new Complex(1.1, 1.1), new Complex(2.2, 2.2), new Complex(3.3, 3.3)}, {new Complex(4.4, 4.4), new Complex(5.5, 5.5), new Complex(6.6, 6.6)}, {new Complex(7.7, 7.7), new Complex(8.8, 8.8), new Complex(9.9, 9.9)}});
     var writer = new DelimitedWriter(' ')
         {
             CultureInfo = CultureInfo.InvariantCulture
         };
     var stream = new MemoryStream();
     writer.WriteMatrix(matrix, stream);
     var data = stream.ToArray();
     var reader = new StreamReader(new MemoryStream(data));
     var text = reader.ReadToEnd();
     var expected = "(1.1, 1.1) (2.2, 2.2) (3.3, 3.3)" + Environment.NewLine
         + "(4.4, 4.4) (5.5, 5.5) (6.6, 6.6)" + Environment.NewLine
         + "(7.7, 7.7) (8.8, 8.8) (9.9, 9.9)";
     Assert.AreEqual(expected, text);
 }