//-------------------------------------------------------------------------
 private void assertMatrix(DoubleMatrix matrix, params double[] expected)
 {
     if (expected.Length == 0)
     {
         assertSame(matrix, DoubleMatrix.EMPTY);
         assertEquals(matrix.Empty, true);
     }
     else
     {
         assertEquals(matrix.size(), expected.Length);
         int        rowCount = matrix.rowCount();
         int        colCount = matrix.columnCount();
         double[][] array    = matrix.toArrayUnsafe();
         double[][] array2   = matrix.toArray();
         assertTrue(Arrays.deepEquals(array, array2));
         for (int i = 0; i < rowCount; i++)
         {
             for (int j = 0; j < colCount; j++)
             {
                 assertEquals(matrix.get(i, j), expected[i * colCount + j]);
                 assertEquals(array[i][j], expected[i * colCount + j]);
             }
         }
         assertEquals(matrix.dimensions(), 2);
         assertEquals(matrix.Empty, false);
         assertEquals(matrix.Square, matrix.rowCount() == matrix.columnCount());
     }
 }