/** * @dataProvider dataProviderForTranspose */ public function testTranspose(array $M) { $R = new RowVector($M); $Rᵀ = $R->transpose(); $this->assertInstanceOf('MathPHP\\LinearAlgebra\\ColumnVector', $Rᵀ); $this->assertInstanceOf('MathPHP\\LinearAlgebra\\Matrix', $Rᵀ); $this->assertEquals(count($M), $Rᵀ->getM()); $this->assertEquals(1, $Rᵀ->getN()); foreach ($M as $row => $value) { $this->assertEquals($value, $Rᵀ[$row][0]); } }
public function testSum() { $vector = new RowVector(1, 2, 3, -4); $this->assertSame(2.0, $vector->sum()); }