assertInstanceOf(ComplexMatrix::class, $A); } /** * @test Constructor exception when non complex number provided */ public function testConstructorException() { // Given $A = [ [new Complex(2, 1), new Complex(2, 1)], [new Complex(2, 1), new ArbitraryInteger(4)], ]; // Then $this->expectException(Exception\IncorrectTypeException::class); // When $A = new ComplexMatrix($A); } /** * @test createZeroValue */ public function testCreateZeroValue() { // Given $zeroMatrix = ComplexMatrix::createZeroValue(); // And $expected = [ [new Complex(0, 0)] ]; // Then $this->assertEquals($expected, $zeroMatrix->getMatrix()); } /** * @test conjugateTranspose */ public function testConjugateTranspose() { // Given $A = [ [new Complex(1, 0), new Complex(-2, -1), new Complex(5, 0)], [new Complex(1, 1), new Complex(0, 1), new Complex(4, -2)], ]; $A = new ComplexMatrix($A); // And $expected = [ [new Complex(1, 0), new Complex(1, -1)], [new Complex(-2, 1), new Complex(0, -1)], [new Complex(5, 0), new Complex(4, 2)], ]; // When $Aᴴ = $A->conjugateTranspose(); // Then $this->assertEquals($expected, $Aᴴ->getMatrix()); } }