x Sorry, these patches are not available anymore due to data migration. Please run a fresh inspection.
Passed
Push — main ( b63ebb...d6f51d )
by Shubham
02:04
created

ref   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A factory() 0 9 2
1
<?php
2
declare(strict_types=1);
3
namespace Np\linAlgb\reductions;
4
5
use Np\matrix;
6
use Np\vector;
7
use Np\core\lapack;
8
9
/**
10
 * REF
11
 *
12
 * The row echelon form (REF) of a matrix.
13
 * 
14
 * @package Np
15
 * @category Scientific Computing
16
 * @author ghost (Shubham Chaudhary)
17
 * @email [email protected]
18
 * @copyright (c) 2020-2021, Shubham Chaudhary
19
 */
20
21
class ref { 
22
    
23
     /**
24
      * 
25
      * @param \Np\matrix $m
26
      * @return matrix|null
27
      */
28
    public static function factory(\Np\matrix $m): matrix|null {
29
        $ipiv = vector::factory(min($m->row, $m->col), vector::INT);
30
        $ar = $m->copy();
31
        $lp = lapack::getrf($ar, $ipiv);
32
        if ($lp != 0) {
33
            return null;
34
        }
35
        
36
        return $ar;
37
    }
38
}
39