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