Esempio n. 1
0
 /**
  * @return bool
  */
 public function solvable()
 {
     return $this->coefficients->invertible();
 }
Esempio n. 2
0
 /**
  * https://en.wikipedia.org/wiki/Power_iteration
  * @param MatrixInterface $matrix
  * @return Vector
  */
 public function getEigenVector(MatrixInterface $matrix)
 {
     $iterations = 20000;
     $dim = $matrix->rows();
     for ($i = 0; $i < $dim; $i++) {
         $value[] = 1;
     }
     $b = new Vector($value);
     for ($i = 0; $i < $iterations; $i++) {
         $b = $this->multiply($matrix, $b->toColumnMatrix())->toVector();
         $b = $b->scalarMultiply(1 / $b->norm());
     }
     return $b;
 }