77class Matrix implements ArrayAccess
88{
99 /**
10- * Number of columns in the matrix.
11- *
1210 * @var int
1311 */
1412 protected $ columnCount ;
1513
1614 /**
17- * Number of rows in the matrix.
18- *
1915 * @var int
2016 */
2117 protected $ rowCount ;
2218
2319 /**
24- * Internal array for the matrix data that this class wraps.
25- *
2620 * @var array
2721 */
2822 protected $ internal ;
2923
3024 /**
31- * LU Decomposition of this matrix, lazily created as needed.
32- *
3325 * @var LUDecomposition
3426 */
35- protected $ LU = null ;
27+ protected $ LU ;
3628
3729 /**
3830 * __construct
@@ -60,8 +52,6 @@ public function __construct(array $literal)
6052 }
6153
6254 /**
63- * Tests an array representation of a matrix to see if it would make a valid matrix
64- *
6555 * @param array $literal
6656 * @return boolean
6757 */
@@ -154,7 +144,7 @@ public function addMatrix(Matrix $value)
154144 * - The current column
155145 * - The matrix being iterated over
156146 *
157- * @param callable $callback A function that returns the computed new values.
147+ * @param callable $callback
158148 * @return Matrix
159149 */
160150 public function map (callable $ callback )
@@ -175,8 +165,8 @@ public function map(callable $callback)
175165 }
176166
177167 /**
178- * @param int $row Which zero-based row index to access.
179- * @param int $column Which zero-based column index to access.
168+ * @param int $row
169+ * @param int $column
180170 * @return float
181171 */
182172 public function get ($ row , $ column )
@@ -196,8 +186,6 @@ public function addScalar($value)
196186 }
197187
198188 /**
199- * Creates and returns a new matrix that is the adjoint of this matrix.
200- *
201189 * @return Matrix
202190 * @throws MatrixException
203191 */
@@ -211,7 +199,7 @@ public function adjoint()
211199 }
212200
213201 /**
214- * @return boolean True if the matrix is square, false otherwise.
202+ * @return boolean
215203 */
216204 public function isSquare ()
217205 {
@@ -293,7 +281,6 @@ public function inverse()
293281 throw new MatrixException ('This matrix has a zero determinant and is therefore not invertable: ' . print_r ($ this ->internal , true ));
294282 }
295283
296- // Use LU decomposition for the general case.
297284 return $ this ->getLUDecomp ()->inverse ();
298285 }
299286
@@ -316,9 +303,6 @@ public function determinant()
316303 }
317304
318305 /**
319- * Lazy-loads the LU decomposition. If it has already been built for this
320- * matrix, it returns the existing one. Otherwise, it creates a new one.
321- *
322306 * @return LUDecomposition
323307 */
324308 protected function getLUDecomp ()
@@ -423,7 +407,7 @@ public function diagonal()
423407
424408 /**
425409 * @param Matrix $matrixB
426- * @return boolean True if equal. False otherwise.
410+ * @return boolean
427411 */
428412 public function equals (Matrix $ matrixB )
429413 {
@@ -446,8 +430,8 @@ public function equals(Matrix $matrixB)
446430 * Returns a new matrix with the selected row and column removed, useful for
447431 * calculating determinants or other recursive operations on matrices.
448432 *
449- * @param int $row Row to remove, null to remove no row.
450- * @param int $column Column to remove, null to remove no column.
433+ * @param int|null $row Row to remove, null to remove no row.
434+ * @param int|null $column Column to remove, null to remove no column.
451435 * @return Matrix
452436 */
453437 public function submatrix ($ row = null , $ column = null )
@@ -521,7 +505,6 @@ public function subtractScalar($value)
521505 }
522506
523507 /**
524- * Sums the main diagonal values of a square matrix.
525508 * @return float
526509 * @throws MatrixException
527510 */
0 commit comments