NumPHP\Core\NumPHP::identity PHP Метод

identity() публичный статический Метод

Returns a identity matrix (NumArray) filled with 0 and 1 on the main diagonal
С версии: 1.0.0
public static identity ( integer $mAxis ) : NumArray
$mAxis integer size of the m axis and n axis
Результат NumArray
    public static function identity($mAxis)
    {
        return self::eye($mAxis, $mAxis);
    }

Usage Example

Пример #1
0
 /**
  * Tests LinAlg::lud with singular 4x4 matrix
  */
 public function testLUDecompositionSingularMatrix()
 {
     $matrix = NumPHP::identity(4);
     $matrix->set(2, 2, 0);
     $expectedP = NumPHP::identity(4);
     $expectedL = NumPHP::identity(4);
     $expectedU = NumPHP::identity(4);
     $expectedU->set(2, 2, 0);
     list($pMatrix, $lMatrix, $uMatrix) = LinAlg::lud($matrix);
     $this->assertNumArrayEquals($expectedP, $pMatrix, 'Matrix P is not equal');
     $this->assertNumArrayEquals($expectedL, $lMatrix, 'Matrix L is not equal');
     $this->assertNumArrayEquals($expectedU, $uMatrix, 'Matrix U is not equal');
 }
All Usage Examples Of NumPHP\Core\NumPHP::identity