Skip to content

Commit b57d5ce

Browse files
committed
Update to use getters for rows and columns.
1 parent df30539 commit b57d5ce

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/LUDecomposition.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private function LUDecomp()
4747
{
4848
$scaling = [];
4949
$this->parity = 1; // start parity at +1 (parity is "even" for zero row interchanges)
50-
$n = $this->rows;
50+
$n = $this->getRowCount();
5151
$p =& $this->permutations;
5252

5353
// We want to find the largest element in each row for scaling.
@@ -111,7 +111,7 @@ private function LUDecomp()
111111
*/
112112
public function determinant()
113113
{
114-
$n = $this->rows;
114+
$n = $this->getRowCount();
115115
$determinant = $this->parity; // Start with +1 for an even # of row swaps, -1 for an odd #
116116

117117
// The determinant is simply the product of the diagonal elements, with sign given
@@ -147,7 +147,7 @@ private function rowPivot($thisRow, $thatRow)
147147
*/
148148
public function solve(array $b)
149149
{
150-
$n = $this->rows;
150+
$n = $this->getRowCount();
151151

152152
if (count($b) !== $n) {
153153
throw new MatrixException('The knowns vector must be the same size as the coefficient matrix.');
@@ -204,7 +204,7 @@ public function inverse()
204204
$inverse = [];
205205

206206
// Get size of matrix
207-
$n = $this->rows;
207+
$n = $this->getRowCount();
208208
$b = array_fill(0, $n, 0); // initialize empty vector
209209

210210
// For each j from 0 to n-1

0 commit comments

Comments
 (0)