@@ -81,36 +81,36 @@ class Vector {
8181
8282 Vector &operator =(const Vector &);
8383
84- MPTime norm ();
84+ [[nodiscard]] MPTime norm () const ;
8585
8686 void negate ();
8787 MPTime normalize ();
8888
89- [[nodiscard]] Vector * add (MPTime increase) const ;
89+ [[nodiscard]] Vector add (MPTime increase) const ;
9090
91- void add (MPTime increase, Vector * result) const ;
91+ void add (MPTime increase, Vector& result) const ;
9292
93- void maximum (const Vector *matB , Vector * result) const ;
93+ void maximum (const Vector& vecB , Vector& result) const ;
9494
95- Vector * add (const Vector * vecB) const ;
95+ [[nodiscard]] Vector add (const Vector& vecB) const ;
9696
97- void add (const Vector * vecB, Vector * res) const ;
97+ void add (const Vector& vecB, Vector& res) const ;
9898
9999 Vector &operator +=(MPTime increase) {
100- this ->add (increase, this );
100+ this ->add (increase, * this );
101101 return *this ;
102102 }
103103
104104 Vector &operator -=(MPTime decrease) {
105105 assert (!decrease.isMinusInfinity ());
106- this ->add (-decrease, this );
106+ this ->add (-decrease, * this );
107107 return *this ;
108108 }
109109
110- bool compare (const Vector &v);
110+ [[nodiscard]] bool compare (const Vector &v) const ;
111111
112- Vector &incrementalMaximum (const Vector * vec) {
113- this ->maximum (vec, this );
112+ Vector &incrementalMaximum (const Vector& vec) {
113+ this ->maximum (vec, * this );
114114 return *this ;
115115 }
116116
@@ -145,10 +145,13 @@ class Matrix {
145145 */
146146 Matrix (unsigned int nr_rows, unsigned int nr_cols, MatrixFill fill = MatrixFill::MinusInfinity);
147147
148- Matrix (unsigned int nrows , unsigned int nr_cols, unsigned int nr_el);
148+ Matrix (unsigned int nr_rows , unsigned int nr_cols, unsigned int nr_el);
149149
150150 Matrix (Matrix &&) = default ;
151151 Matrix &operator =(Matrix &&) = default ;
152+ Matrix (const Matrix &)=default ;
153+
154+ Matrix &operator =(const Matrix &);
152155
153156 virtual ~Matrix ();
154157
@@ -167,16 +170,16 @@ class Matrix {
167170
168171 void pasteRowVector (unsigned int top_row, unsigned int left_column, const Vector *pastedVector);
169172
170- [[nodiscard]] virtual Matrix *createCopy () const ;
173+ // [[nodiscard]] virtual Matrix *createCopy() const;
171174
172- [[nodiscard]] Matrix * getTransposedCopy () const ;
175+ [[nodiscard]] Matrix transpose () const ;
173176
174- [[nodiscard]] virtual Matrix * getSubMatrix (const std::list<unsigned int > &rowIndices,
177+ [[nodiscard]] virtual Matrix getSubMatrix (const std::list<unsigned int > &rowIndices,
175178 const std::list<unsigned int > &colIndices) const ;
176179
177- [[nodiscard]] Matrix * getSubMatrix (const std::list<unsigned int > &indices) const ;
180+ [[nodiscard]] Matrix getSubMatrix (const std::list<unsigned int > &indices) const ;
178181
179- [[nodiscard]] Matrix * getSubMatrixNonSquare (const std::list<unsigned int > &indices) const ;
182+ [[nodiscard]] Matrix getSubMatrixNonSquare (const std::list<unsigned int > &indices) const ;
180183
181184 /* *
182185 * Increases the number of rows of the matrix by n and fills the new elements with -\infty.
@@ -188,21 +191,21 @@ class Matrix {
188191 void toLaTeXString (CString &outString, CDouble scale = 1.0 ) const ;
189192
190193 // Algebraic operations.
191- [[nodiscard]] Matrix * add (MPTime increase) const ;
194+ [[nodiscard]] Matrix add (MPTime increase) const ;
192195
193- void add (MPTime increase, Matrix * result) const ;
196+ void add (MPTime increase, Matrix& result) const ;
194197
195- [[nodiscard]] Matrix * mp_sub (const Matrix &m) const ;
198+ [[nodiscard]] Matrix mp_sub (const Matrix &m) const ;
196199
197- [[nodiscard]] Matrix * mp_maximum (const Matrix &m) const ;
200+ [[nodiscard]] Matrix mp_maximum (const Matrix &m) const ;
198201
199- void maximum (const Matrix * matB, Matrix * result) const ;
202+ void maximum (const Matrix& matB, Matrix& result) const ;
200203
201- [[nodiscard]] Vector * mp_multiply (const Vector &v) const ;
204+ [[nodiscard]] Vector mp_multiply (const Vector &v) const ;
202205
203- [[nodiscard]] Matrix * mp_multiply (const Matrix &m) const ;
206+ [[nodiscard]] Matrix mp_multiply (const Matrix &m) const ;
204207
205- [[nodiscard]] Matrix * mp_power (unsigned int p) const ;
208+ [[nodiscard]] Matrix mp_power (unsigned int p) const ;
206209
207210 [[nodiscard]] CDouble mp_eigenvalue () const ;
208211
@@ -213,19 +216,18 @@ class Matrix {
213216 [[nodiscard]] EigenvectorList mpEigenvectors () const ;
214217
215218 Matrix &operator +=(MPTime increase) {
216- this ->add (increase, this );
219+ this ->add (increase, * this );
217220 return *this ;
218221 }
219222
220223 Matrix &operator -=(MPTime decrease) {
221224 assert (!decrease.isMinusInfinity ());
222- this ->add (-decrease, this );
225+ this ->add (-decrease, * this );
223226 return *this ;
224227 }
225228
226- Matrix &incrementalMaximum (const Matrix *matrix) {
227- this ->maximum (matrix, this );
228- return *this ;
229+ void incrementalMaximum (const Matrix& matrix) {
230+ this ->maximum (matrix, *this );
229231 }
230232
231233 bool operator ==(const Matrix &other);
@@ -237,26 +239,21 @@ class Matrix {
237239 [[nodiscard]] MPTime largestFiniteElement () const ;
238240 [[nodiscard]] MPTime minimalFiniteElement () const ;
239241
240- [[nodiscard]] Matrix * plusClosureMatrix (MPTime posCycleThreshold = MP_EPSILON) const ;
242+ [[nodiscard]] Matrix plusClosureMatrix (MPTime posCycleThreshold = MP_EPSILON) const ;
241243
242- [[nodiscard]] Matrix * starClosureMatrix (MPTime posCycleThreshold = MP_EPSILON) const ;
244+ [[nodiscard]] Matrix starClosureMatrix (MPTime posCycleThreshold = MP_EPSILON) const ;
243245
244- [[nodiscard]] Matrix * allPairLongestPathMatrix (MPTime posCycleThreshold,
246+ [[nodiscard]] Matrix allPairLongestPathMatrix (MPTime posCycleThreshold,
245247 bool implyZeroSelfEdges) const ;
246248 bool
247249 allPairLongestPathMatrix (MPTime posCycleThreshold, bool implyZeroSelfEdges, Matrix &res) const ;
248250
249251 [[nodiscard]] MCMgraph mpMatrixToPrecedenceGraph () const ;
250252
251- // factory methods
252- [[nodiscard]] virtual Matrix *makeMatrix (unsigned int nr_rows, unsigned int nr_cols) const ;
253+ // // factory methods
254+ // [[nodiscard]] virtual Matrix *makeMatrix(unsigned int nr_rows, unsigned int nr_cols) const;
253255
254256private:
255- // Implicit copying is not allowed
256- // => Intentionally private and not implemented
257- Matrix (const Matrix &);
258-
259- Matrix &operator =(const Matrix &);
260257
261258 void init (MatrixFill fill);
262259 void init ();
@@ -268,44 +265,6 @@ class Matrix {
268265 unsigned int szCols;
269266};
270267
271- class ExtendedMatrix : public Matrix {
272- public:
273- ExtendedMatrix (unsigned int nrows, unsigned int nr_cols) : Matrix(nrows, nr_cols) {
274- unsigned int nr_els = this ->getRows () * this ->getCols ();
275- this ->bufferSets .resize (nr_els);
276- }
277-
278- // Creates a matrix with reserved memory for nr_el expected entities
279- ExtendedMatrix (unsigned int nrows, unsigned int nr_cols, unsigned int nr_el) :
280- Matrix (nrows, nr_cols, nr_el) {
281- this ->bufferSets .reserve (nr_el);
282- }
283- explicit ExtendedMatrix (unsigned int N) : Matrix(N) {}
284-
285- [[nodiscard]] Matrix *createCopy () const override {
286- Matrix *newMatrix = Matrix::createCopy ();
287- auto *newExtendedMatrix = dynamic_cast <ExtendedMatrix *>(newMatrix);
288-
289- unsigned int nr_els = this ->getRows () * this ->getCols ();
290- for (unsigned int pos = 0 ; pos < nr_els; pos++) {
291- newExtendedMatrix->bufferSets [pos] = this ->bufferSets [pos];
292- }
293-
294- return newExtendedMatrix;
295- }
296-
297- void put (unsigned int row, unsigned int column, MPTime value, std::unordered_set<int > &);
298- [[nodiscard]] Matrix *getSubMatrix (const std::list<unsigned int > &rowIndices,
299- const std::list<unsigned int > &colIndices) const override ;
300-
301- // factory methods
302- [[nodiscard]] Matrix *makeMatrix (unsigned int nr_rows, unsigned int nr_cols) const override ;
303-
304- [[nodiscard]] std::unordered_set<int > getBufferSet (unsigned int row, unsigned int column) const ;
305-
306- private:
307- std::vector<std::unordered_set<int >> bufferSets;
308- };
309268
310269/* ***************************************************
311270 * VectorList: usually represents a set of eigenvectors
0 commit comments