@@ -138,7 +138,7 @@ public function add($value)
138138 */
139139 public function addMatrix (Matrix $ value )
140140 {
141- if ($ this ->rows != $ value ->rows || $ this ->columns != $ value ->columns ) {
141+ if ($ this ->getRowCount () != $ value ->getRowCount () || $ this ->getColumnCount () != $ value ->getColumnCount () ) {
142142 throw new MatrixException ('Cannot add two matrices of different size. ' );
143143 }
144144
@@ -162,10 +162,10 @@ public function map(callable $callback)
162162 {
163163 $ literal = [];
164164
165- for ($ i = 0 ; $ i < $ this ->rows ; $ i ++) {
165+ for ($ i = 0 ; $ i < $ this ->getRowCount () ; $ i ++) {
166166 $ row = [];
167167
168- for ($ j = 0 ; $ j < $ this ->columns ; $ j ++) {
168+ for ($ j = 0 ; $ j < $ this ->getColumnCount () ; $ j ++) {
169169 $ row [] = $ callback ($ this ->get ($ i , $ j ), $ i , $ j , $ this );
170170 }
171171
@@ -216,7 +216,7 @@ public function adjoint()
216216 */
217217 public function isSquare ()
218218 {
219- return $ this ->rows == $ this ->columns ;
219+ return $ this ->getRowCount () == $ this ->getColumnCount () ;
220220 }
221221
222222 /**
@@ -244,7 +244,7 @@ public function multiply($value)
244244 */
245245 public function multiplyMatrix (Matrix $ value )
246246 {
247- if ($ this ->columnCount != $ value ->rowCount ) {
247+ if ($ this ->getColumnCount () != $ value ->rowCount ) {
248248 throw new MatrixException ('Cannot multiply matrices of these sizes. ' );
249249 }
250250
@@ -256,7 +256,7 @@ public function multiplyMatrix(Matrix $value)
256256 for ($ j = 0 ; $ j < $ value ->columnCount ; $ j ++) {
257257 $ sum = 0 ;
258258
259- for ($ k = 0 ; $ k < $ this ->columnCount ; $ k ++) {
259+ for ($ k = 0 ; $ k < $ this ->getColumnCount () ; $ k ++) {
260260 $ sum += $ this ->get ($ i , $ k ) * $ value ->get ($ k , $ j );
261261 }
262262
@@ -317,7 +317,7 @@ public function determinant()
317317 }
318318
319319 // Base case for a 1 by 1 matrix
320- if ($ this ->rows == 1 ) {
320+ if ($ this ->getRowCount () == 1 ) {
321321 return $ this ->get (0 , 0 );
322322 }
323323
@@ -348,8 +348,8 @@ public function isSymmetric()
348348 return false ;
349349 }
350350
351- for ($ i = 0 ; $ i < $ this ->rows ; ++$ i ) {
352- for ($ j = 0 ; $ j < $ this ->columns ; ++$ j ) {
351+ for ($ i = 0 ; $ i < $ this ->getRowCount () ; ++$ i ) {
352+ for ($ j = 0 ; $ j < $ this ->getColumnCount () ; ++$ j ) {
353353 if ($ i == $ j ) {
354354 continue ;
355355 }
@@ -496,7 +496,7 @@ protected function choleskyDecomposition()
496496 */
497497 public function contatenateBottom (Matrix $ other )
498498 {
499- if ($ this ->columnCount !== $ other ->columnCount ) {
499+ if ($ this ->getColumnCount () !== $ other ->getColumnCount () ) {
500500 throw new MatrixException (
501501 'Cannot concatenate matrices of incompatible size: '
502502 . print_r ($ this ->internal , true )
@@ -515,7 +515,7 @@ public function contatenateBottom(Matrix $other)
515515 */
516516 public function contatenateRight (Matrix $ other )
517517 {
518- if ($ this ->rowCount !== $ other ->rowCount ) {
518+ if ($ this ->rowCount !== $ other ->getRowCount () ) {
519519 throw new MatrixException (
520520 'Cannot concatenate matrices of incompatible size: '
521521 . print_r ($ this ->internal , true )
@@ -539,7 +539,7 @@ public function contatenateRight(Matrix $other)
539539 public function diagonal ()
540540 {
541541 $ diagonal = [];
542- $ max = min ([$ this ->rows , $ this ->columns ]);
542+ $ max = min ([$ this ->getRowCount () , $ this ->getColumnCount () ]);
543543
544544 for ($ i = 0 ; $ i < $ max ; $ i ++) {
545545 $ diagonal [] = $ this ->get ($ i , $ i );
@@ -554,12 +554,12 @@ public function diagonal()
554554 */
555555 public function equals (Matrix $ matrixB )
556556 {
557- if ($ this ->rowCount != $ matrixB ->rowCount || $ this ->columnCount != $ matrixB ->columnCount ) {
557+ if ($ this ->rowCount != $ matrixB ->rowCount || $ this ->getColumnCount () != $ matrixB ->columnCount ) {
558558 return false ;
559559 }
560560
561561 for ($ i = $ this ->rowCount ; $ i --;) {
562- for ($ j = $ this ->columnCount ; $ j --;) {
562+ for ($ j = $ this ->getColumnCount () ; $ j --;) {
563563 if ($ this ->get ($ i , $ j ) != $ matrixB ->get ($ i , $ j )) {
564564 return false ;
565565 }
@@ -581,14 +581,14 @@ public function submatrix($row = null, $column = null)
581581 {
582582 $ literal = [];
583583
584- for ($ i = 0 ; $ i < $ this ->rows ; $ i ++) {
584+ for ($ i = 0 ; $ i < $ this ->getRowCount () ; $ i ++) {
585585 if ($ i === $ row ) {
586586 continue ;
587587 }
588588
589589 $ rowLiteral = [];
590590
591- for ($ j = 0 ; $ j < $ this ->columns ; $ j ++) {
591+ for ($ j = 0 ; $ j < $ this ->getColumnCount () ; $ j ++) {
592592 if ($ j === $ column ) {
593593 continue ;
594594 }
@@ -627,7 +627,7 @@ public function subtract($value)
627627 */
628628 public function subtractMatrix (Matrix $ value )
629629 {
630- if ($ this ->rowCount != $ value ->rowCount || $ this ->columnCount != $ value ->columnCount ) {
630+ if ($ this ->rowCount != $ value ->rowCount || $ this ->getColumnCount () != $ value ->columnCount ) {
631631 throw new MatrixException ('Cannot subtract two matrices of different size. ' );
632632 }
633633
@@ -660,7 +660,7 @@ public function trace()
660660
661661 $ trace = 0 ;
662662
663- for ($ i = 0 ; $ i < $ this ->rows ; $ i ++) {
663+ for ($ i = 0 ; $ i < $ this ->getRowCount () ; $ i ++) {
664664 $ trace += $ this ->get ($ i , $ i );
665665 }
666666
@@ -674,10 +674,10 @@ public function transpose()
674674 {
675675 $ literal = [];
676676
677- for ($ i = 0 ; $ i < $ this ->columns ; $ i ++) {
677+ for ($ i = 0 ; $ i < $ this ->getColumnCount () ; $ i ++) {
678678 $ literal [] = [];
679679
680- for ($ j = 0 ; $ j < $ this ->rows ; $ j ++) {
680+ for ($ j = 0 ; $ j < $ this ->getRowCount () ; $ j ++) {
681681 $ literal [$ i ][] = $ this ->get ($ j , $ i );
682682 }
683683 }
@@ -746,7 +746,7 @@ public function __get($property)
746746 */
747747 public function getColumnCount ()
748748 {
749- return $ this ->columnCount ;
749+ return $ this ->getColumnCount () ;
750750 }
751751
752752 /**
0 commit comments