/** * @dataProvider dataProviderForConstructor */ public function testConstructor(array $M, array $V) { $R = new RowVector($M); $V = new Matrix($V); $this->assertInstanceOf('MathPHP\\LinearAlgebra\\RowVector', $R); $this->assertInstanceOf('MathPHP\\LinearAlgebra\\Matrix', $R); $this->assertEquals($V[0], $R[0]); $this->assertEquals(1, $V->getM()); $this->assertEquals(count($M), $V->getN()); }
/** * @dataProvider dataProviderForConstructor */ public function testConstructor(array $M, array $V) { $C = new ColumnVector($M); $V = new Matrix($V); $this->assertInstanceOf('MathPHP\\LinearAlgebra\\ColumnVector', $C); $this->assertInstanceOf('MathPHP\\LinearAlgebra\\Matrix', $C); foreach ($M as $row => $value) { $this->assertEquals($value, $V[$row][0]); } $this->assertEquals(count($M), $V->getM()); $this->assertEquals(1, $V->getN()); }