public void MatrixFrom1DArrayIsCopy()
 {
     // Sparse Matrix copies values from Complex[], but no remember reference. 
     var data = new[] {new Complex(1.0, 1), new Complex(1.0, 1), new Complex(1.0, 1), new Complex(1.0, 1), new Complex(1.0, 1), new Complex(1.0, 1), new Complex(2.0, 1), new Complex(2.0, 1), new Complex(2.0, 1)};
     var matrix = SparseMatrix.OfColumnMajor(3, 3, data);
     matrix[0, 0] = new Complex(10.0, 1);
     Assert.AreNotEqual(new Complex(10.0, 1), data[0]);
 }
 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);
 }