Esempio n. 1
0
 /**
  * @dataProvider dataProviderForAsColumnMatrix
  */
 public function testAsColumnMatrix(array $A, array $R)
 {
     $A = new Vector($A);
     $R = new Matrix($R);
     $M = $A->asColumnMatrix();
     $this->assertEquals($R, $M);
 }
Esempio n. 2
0
 /**
  * Axiom: A⨂B = ABᵀ
  * Outer product is the same as matrix multiplication of A and transpose of B
  * @dataProvider dataProviderForOuterProduct
  */
 public function testOuterProductIsMatrixMultiplicationOfAAndBTranspose(array $A, array $B)
 {
     // Vector A⨂B
     $Av = new Vector($A);
     $Bv = new Vector($B);
     $A⨂B = $Av->outerProduct($Bv);
     // Matrix multiplication ABᵀ
     $Am = $Av->asColumnMatrix();
     $Bᵀ = new Matrix([$Bv->getVector()]);
     $ABᵀ = $Am->multiply($Bᵀ);
     $this->assertEquals($A⨂B, $ABᵀ);
 }