Search in sources :

Example 1 with ViewMatrixStorage

use of org.apache.ignite.ml.math.primitives.matrix.storage.ViewMatrixStorage in project ignite by apache.

the class MatrixViewConstructorTest method attributeTest.

/**
 */
@Test
public void attributeTest() {
    for (Matrix m : new Matrix[] { new DenseMatrix(3, 3), new DenseMatrix(3, 4), new DenseMatrix(4, 3) }) {
        ViewMatrix matrixView = new ViewMatrix(m, 0, 0, m.rowSize(), m.columnSize());
        ViewMatrixStorage delegateStorage = (ViewMatrixStorage) matrixView.getStorage();
        assertEquals(m.rowSize(), matrixView.rowSize());
        assertEquals(m.columnSize(), matrixView.columnSize());
        assertEquals(m.rowSize(), (delegateStorage).rowsLength());
        assertEquals(m.columnSize(), (delegateStorage).columnsLength());
        assertEquals(m.isDense(), delegateStorage.isDense());
        assertEquals(m.isArrayBased(), delegateStorage.isArrayBased());
        assertArrayEquals(m.getStorage().data(), delegateStorage.data(), 0.0);
    }
}
Also used : ViewMatrix(org.apache.ignite.ml.math.primitives.matrix.impl.ViewMatrix) DenseMatrix(org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix) ViewMatrixStorage(org.apache.ignite.ml.math.primitives.matrix.storage.ViewMatrixStorage) ViewMatrix(org.apache.ignite.ml.math.primitives.matrix.impl.ViewMatrix) DenseMatrix(org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix) Test(org.junit.Test)

Aggregations

DenseMatrix (org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix)1 ViewMatrix (org.apache.ignite.ml.math.primitives.matrix.impl.ViewMatrix)1 ViewMatrixStorage (org.apache.ignite.ml.math.primitives.matrix.storage.ViewMatrixStorage)1 Test (org.junit.Test)1