Beispiel #1
0
        public void ToArray2D()
        {
            MatrixF m = new MatrixF(3, 4, rowMajor, MatrixOrder.RowMajor);

              float[,] array = m.ToArray2D();
              Assert.AreEqual(3, array.GetLength(0));
              Assert.AreEqual(4, array.GetLength(1));
              for (int i = 0; i < 3; i++)
            for (int j = 0; j < 4; j++)
              Assert.AreEqual(i * 4 + j + 1, array[i, j]);

              array = (float[,]) m;
              Assert.AreEqual(3, array.GetLength(0));
              Assert.AreEqual(4, array.GetLength(1));
              for (int i = 0; i < 3; i++)
            for (int j = 0; j < 4; j++)
              Assert.AreEqual(i * 4 + j + 1, array[i, j]);

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