Example #1
0
        public void ToArrayJagged()
        {
            MatrixD m = new MatrixD(3, 4, rowMajor, MatrixOrder.RowMajor);

              double[][] array = m.ToArrayJagged();
              Assert.AreEqual(3, array.Length);
              for (int i = 0; i < 3; i++)
              {
            Assert.AreEqual(4, array[i].Length);
            for (int j = 0; j < 4; j++)
            {
              Assert.AreEqual(i * 4 + j + 1, array[i][j]);
            }
              }

              array = (double[][]) m;
              Assert.AreEqual(3, array.Length);
              for (int i = 0; i < 3; i++)
              {
            Assert.AreEqual(4, array[i].Length);
            for (int j = 0; j < 4; j++)
            {
              Assert.AreEqual(i * 4 + j + 1, array[i][j]);
            }
              }

              m = null;
              array = (double[][]) m;
              Assert.IsNull(array);
        }