@@ -91,7 +91,7 @@ Vector &Vector::operator=(const Vector &other) {
9191 if (this != &other) {
9292 if (this ->getSize () != other.getSize ()) {
9393 throw MPException (" Vectors of different size in"
94- " Vector::operator=" );
94+ " Vector::operator=" );
9595 }
9696 for (unsigned int row = 0 ; row < this ->getSize (); row++) {
9797 this ->table [row] = other.table [row];
@@ -107,7 +107,7 @@ void Vector::negate() {
107107 for (unsigned int row = 0 ; row < this ->getSize (); row++) {
108108 if (this ->get (row) == MP_MINUS_INFINITY) {
109109 throw MPException (" Cannot negate vectors with MP_MINUS_INFINITY elements in"
110- " Vector::negate" );
110+ " Vector::negate" );
111111 }
112112 this ->put (row, -this ->get (row));
113113 }
@@ -132,7 +132,7 @@ MPTime Vector::normalize() {
132132
133133 if (maxEl == MP_MINUS_INFINITY) {
134134 throw MPException (" Cannot normalize vector with norm MP_MINUS_INFINITY"
135- " Vector::normalize" );
135+ " Vector::normalize" );
136136 }
137137 for (unsigned int row = 0 ; row < this ->getSize (); row++) {
138138 MPTime x_i = this ->get (row); // MPTime handles -INF correctly
@@ -355,27 +355,23 @@ void Matrix::addRows(uint n) {
355355}
356356
357357/* *
358- * Increases the number of cols of the matrix by n and fills the new elements with -\infty.
359- */
360- void Matrix::addCols (uint n)
361- {
358+ * Increases the number of cols of the matrix by n and fills the new elements with -\infty.
359+ */
360+ void Matrix::addCols (uint n) {
362361 unsigned int rows = this ->getRows ();
363362 unsigned int cols = this ->getCols ();
364363 this ->szCols = this ->szCols + n;
365364 auto it = this ->table .begin () + cols;
366- for (unsigned int r = 0 ; r < rows; r++)
367- {
368- for (unsigned int c = 0 ; c < n; c++)
369- {
370- it= this ->table .insert (it, MP_MINUS_INFINITY);
365+ for (unsigned int r = 0 ; r < rows; r++) {
366+ for (unsigned int c = 0 ; c < n; c++) {
367+ it = this ->table .insert (it, MP_MINUS_INFINITY);
371368 }
372369 if (r < rows - 1 ) {
373- advance (it, cols+ n);
370+ advance (it, cols + n);
374371 }
375372 }
376373}
377374
378-
379375/* *
380376 * Get size of a square matrix
381377 */
@@ -390,7 +386,7 @@ unsigned int Matrix::getSize() const {
390386MPTime Matrix::get (unsigned int row, unsigned int column) const {
391387 if ((row >= this ->getRows ()) || (column >= this ->getCols ())) {
392388 throw MPException (" Index out of bounds in"
393- " Matrix::get" );
389+ " Matrix::get" );
394390 }
395391 return this ->table [row * this ->getCols () + column];
396392}
@@ -414,7 +410,7 @@ Vector Matrix::getRowVector(unsigned int row) const {
414410void Matrix::put (unsigned int row, unsigned int column, MPTime value) {
415411 if ((row >= this ->getRows ()) || (column >= this ->getCols ())) {
416412 throw MPException (" Index out of bounds in"
417- " Matrix::put" );
413+ " Matrix::put" );
418414 }
419415 this ->table [row * this ->getCols () + column] = value;
420416}
@@ -462,7 +458,7 @@ Vector Matrix::mp_multiply(const Vector &v) const {
462458 // Check size of the matrix and vector
463459 if (this ->getCols () != v.getSize ()) {
464460 throw MPException (" Matrix and vector are of unequal size in "
465- " Matrix::mp_multiply" );
461+ " Matrix::mp_multiply" );
466462 }
467463
468464 // Allocate space of the resulting vector
@@ -487,7 +483,7 @@ Matrix Matrix::mp_multiply(const Matrix &m) const {
487483 // Check sizes of the matrices
488484 if (this ->getCols () != m.getRows ()) {
489485 throw MPException (" Matrices are of incompatible size in"
490- " Matrix::mp_multiply(Matrix)" );
486+ " Matrix::mp_multiply(Matrix)" );
491487 }
492488
493489 // Allocate space of the resulting matrix
@@ -514,7 +510,7 @@ Matrix Matrix::mp_sub(const Matrix &m) const {
514510 // Check sizes of the matrices
515511 if ((m.getRows () != this ->getRows ()) || (m.getCols () != this ->getCols ())) {
516512 throw MPException (" Matrices are of different size in"
517- " Matrix::mp_sub(Matrix&" );
513+ " Matrix::mp_sub(Matrix&" );
518514 }
519515
520516 // Allocate space of the resulting matrix
@@ -537,7 +533,7 @@ Matrix Matrix::mp_maximum(const Matrix &m) const {
537533 // Check sizes of the matrices
538534 if ((m.getRows () != this ->getRows ()) || (m.getCols () != this ->getCols ())) {
539535 throw MPException (" Matrices are of different size in"
540- " Matrix::maximum(Matrix*, Matrix*" );
536+ " Matrix::maximum(Matrix*, Matrix*" );
541537 }
542538
543539 // Allocate space of the resulting matrix
@@ -575,8 +571,7 @@ Matrix Matrix::mp_power(const unsigned int p) const {
575571/* *
576572 * Matrix copy.
577573 */
578- std::shared_ptr<Matrix> Matrix::createCopyPtr () const
579- {
574+ std::shared_ptr<Matrix> Matrix::createCopyPtr () const {
580575 std::shared_ptr<Matrix> newMatrix = std::make_shared<Matrix>(this ->getRows (), this ->getCols ());
581576 unsigned int nEls = this ->getRows () * this ->getCols ();
582577 for (unsigned int pos = 0 ; pos < nEls; pos++) {
@@ -587,8 +582,7 @@ std::shared_ptr<Matrix> Matrix::createCopyPtr() const
587582/* *
588583 * Matrix copy.
589584 */
590- Matrix Matrix::createCopy () const
591- {
585+ Matrix Matrix::createCopy () const {
592586 Matrix newMatrix (this ->getRows (), this ->getCols ());
593587 unsigned int nEls = this ->getRows () * this ->getCols ();
594588 for (unsigned int pos = 0 ; pos < nEls; pos++) {
@@ -598,30 +592,29 @@ Matrix Matrix::createCopy() const
598592}
599593
600594/* *
601- * Matrix transposed copy.
602- */
595+ * Matrix transposed copy.
596+ */
603597std::shared_ptr<Matrix> Matrix::getTransposedCopy () const {
604598 unsigned int MR = this ->getCols ();
605599 unsigned int MC = this ->getRows ();
606600 std::shared_ptr<Matrix> newMatrix = std::make_shared<Matrix>(MR, MC);
607- for (unsigned int col = 0 ; col < MC; col++)
608- {
609- for (unsigned int row = 0 ; row < MR; row++)
610- {
611- newMatrix->put (row, col, this ->get (col, row)); // NOLINT(readability-suspicious-call-argument)
601+ for (unsigned int col = 0 ; col < MC; col++) {
602+ for (unsigned int row = 0 ; row < MR; row++) {
603+ newMatrix->put (
604+ row, col, this ->get (col, row)); // NOLINT(readability-suspicious-call-argument)
612605 }
613606 }
614607 return newMatrix;
615608}
616609
617-
618610Matrix Matrix::transpose () const {
619611 unsigned int MR = this ->getCols ();
620612 unsigned int MC = this ->getRows ();
621613 Matrix newMatrix (MR, MC);
622614 for (unsigned int col = 0 ; col < MC; col++) {
623615 for (unsigned int row = 0 ; row < MR; row++) {
624- newMatrix.put (row, col, this ->get (col, row)); // NOLINT(readability-suspicious-call-argument)
616+ newMatrix.put (
617+ row, col, this ->get (col, row)); // NOLINT(readability-suspicious-call-argument)
625618 }
626619 }
627620 return newMatrix;
@@ -697,8 +690,7 @@ Matrix Matrix::getSubMatrixNonSquare(const std::list<unsigned int> &colIndices)
697690 return newMatrix;
698691}
699692
700-
701- Matrix Matrix::getSubMatrixNonSquareRows (const std::list<unsigned int >& rowIndices) const {
693+ Matrix Matrix::getSubMatrixNonSquareRows (const std::list<unsigned int > &rowIndices) const {
702694 auto NR = static_cast <unsigned int >(rowIndices.size ());
703695 Matrix newMatrix (NR, this ->getCols ());
704696
@@ -712,7 +704,8 @@ Matrix Matrix::getSubMatrixNonSquareRows(const std::list<unsigned int>& rowIndic
712704 return newMatrix;
713705}
714706
715- std::shared_ptr<Matrix> Matrix::getSubMatrixNonSquareRowsPtr (const std::list<unsigned int >& rowIndices) const {
707+ std::shared_ptr<Matrix>
708+ Matrix::getSubMatrixNonSquareRowsPtr (const std::list<unsigned int > &rowIndices) const {
716709 auto NR = static_cast <unsigned int >(rowIndices.size ());
717710 auto newMatrix = std::make_shared<Matrix>(NR, this ->getCols ());
718711
@@ -746,7 +739,7 @@ void Matrix::add(MPTime increase, Matrix &result) const {
746739 unsigned int MC = this ->getCols ();
747740 if ((MR != result.getRows ()) || (MC != result.getCols ())) {
748741 throw MPException (" Matrices are of different size in"
749- " Matrix::add(Matrix*, MPTime, Matrix*" );
742+ " Matrix::add(Matrix*, MPTime, Matrix*" );
750743 }
751744 for (unsigned int r = 0 ; r < MR; r++) {
752745 for (unsigned int c = 0 ; c < MC; c++) {
@@ -764,7 +757,7 @@ void Matrix::maximum(const Matrix &matB, Matrix &result) const {
764757 if ((matB.getRows () != MR) || (matB.getCols () != MC) || (result.getRows () != MR)
765758 || (result.getCols () != MC)) {
766759 throw MPException (" Matrices are of different size in"
767- " Matrix::maximum(Matrix*, Matrix*, Matrix*" );
760+ " Matrix::maximum(Matrix*, Matrix*, Matrix*" );
768761 }
769762
770763 for (unsigned int r = 0 ; r < MR; r++) {
@@ -969,7 +962,7 @@ bool Matrix::allPairLongestPathMatrix(MPTime posCycleThreshold,
969962
970963 if ((N != res.getRows ()) || (N != res.getCols ())) {
971964 throw MPException (" The matrix of the longest paths "
972- " should have the same size as the given matrix." );
965+ " should have the same size as the given matrix." );
973966 }
974967
975968 // TODO(mgeilen): make / use copy operation
@@ -1081,8 +1074,7 @@ CDouble Matrix::mp_eigenvalue() const {
10811074/* *
10821075 * returns the largest element of a row
10831076 */
1084- MPTime Matrix::getMaxOfRow (uint rowNumber) const
1085- {
1077+ MPTime Matrix::getMaxOfRow (uint rowNumber) const {
10861078 if (rowNumber > this ->getRows ()) {
10871079 throw MPException (" Matrix getMaxOfRow input index out of bounds." );
10881080 }
@@ -1252,7 +1244,7 @@ Matrix::mp_generalized_eigenvectors() const {
12521244 CId n = length.first ;
12531245 MPTime value =
12541246 ((MPTime (length.second )) <= MP_MINUS_INFINITY ? MP_MINUS_INFINITY
1255- : MPTime (length.second ));
1247+ : MPTime (length.second ));
12561248 v.put (static_cast <unsigned int >(n), value);
12571249 }
12581250
0 commit comments