eye() public static méthode

Returns a matrix (NumArray) filled with 0 and 1 on the main diagonal
Since: 1.0.0
public static eye ( integer $mAxis, integer $nAxis ) : NumArray
$mAxis integer size of the m axis
$nAxis integer size of the n axis, if not given `$nAxis` = `$mAxis`
Résultat NumArray
Exemple #1
0
 /**
  * Tests if Helper::isSquareMatrix works with valid square matrix
  */
 public function testCheckSquareMatrixValid()
 {
     $numArray = NumPHP::eye(3);
     $this->assertTrue(Helper::isSquareMatrix($numArray));
 }
 /**
  * Build the lower triangular matrix from given matrix
  *
  * @param NumArray $numArray given matrix
  *
  * @return NumArray
  *
  * @since 1.0.0
  */
 protected static function buildLMatrix(NumArray $numArray)
 {
     $shape = $numArray->getShape();
     $numArray->add(NumPHP::eye($shape[0], $shape[1]));
     return $numArray;
 }
Exemple #3
0
 /**
  * Tests NumPHP::identity with argument 3
  */
 public function testIdentity()
 {
     $numArray = NumPHP::identity(3);
     $expectedNumArray = NumPHP::eye(3, 3);
     $this->assertNumArrayEquals($expectedNumArray, $numArray);
 }