public function testIdentityMatrix() { $expected = array(array(1.0, 0.0, 0.0), array(0.0, 1.0, 0.0), array(0.0, 0.0, 1.0)); $this->assertEquals($expected, MatrixFactory::identityMatrix(3)->getArray()); // $expected = array(array(1.0, 0.0, 0.0), array(0.0, 1.0, 0.0)); $this->assertEquals($expected, MatrixFactory::identityMatrix(2, 3)->getArray()); }
public function testIsMatrix() { $matrix = MatrixFactory::identityMatrix(3); $this->assertTrue(Matrix::isMatrix($matrix)); $not_matrix = array(1, 2, 3); $this->assertTrue(!Matrix::isMatrix($not_matrix)); $not_matrix = new stdClass(); $this->assertTrue(!Matrix::isMatrix($not_matrix)); }
public function testDiv() { $a = $this->B; $this->assertEquals(MatrixFactory::identityMatrix(2)->getArray(), $a->div($a)->getArray()); }