OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
DynamicRectMatrix.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2004-present, The University of Notre Dame. All rights
3 * reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your
32 * research, please cite the appropriate papers when you publish your
33 * work. Good starting points are:
34 *
35 * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).
36 * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).
37 * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).
38 * [4] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
39 * [5] Kuang & Gezelter, Mol. Phys., 110, 691-701 (2012).
40 * [6] Lamichhane, Gezelter & Newman, J. Chem. Phys. 141, 134109 (2014).
41 * [7] Lamichhane, Newman & Gezelter, J. Chem. Phys. 141, 134110 (2014).
42 * [8] Bhattarai, Newman & Gezelter, Phys. Rev. B 99, 094106 (2019).
43 */
44
45/**
46 * @file DynamicRectMatrix.hpp
47 * @author Teng Lin
48 * @date 10/11/2004
49 * @version 1.0
50 */
51
52#ifndef MATH_DYNAMICRECTMATRIX_HPP
53#define MATH_DYNAMICRECTMATRIX_HPP
54
55#include <cmath>
56
58#include "math/RectMatrix.hpp"
59
60namespace OpenMD {
61
62 /**
63 * @class DynamicRectMatrix DynamicRectMatrix.hpp "math/DynamicRectMatrix.hpp"
64 * @brief rectangular matrix class
65 */
66 template<typename Real>
68 public:
69 using ElemType = Real;
70 using ElemPoinerType = Real*;
72
73 /** default constructor */
75 nrow_ = 0;
76 ncol_ = 0;
77 data_ = NULL;
78 }
79
80 DynamicRectMatrix(unsigned int nrow, unsigned int ncol) {
81 allocate(nrow, ncol);
82
83 for (unsigned int i = 0; i < nrow_; i++)
84 for (unsigned int j = 0; j < ncol_; j++)
85 this->data_[i][j] = 0.0;
86 }
87
88 /** Constructs and initializes every element of this matrix to a scalar */
89 DynamicRectMatrix(unsigned int nrow, unsigned int ncol, Real s) {
90 allocate(nrow, ncol);
91 for (unsigned int i = 0; i < nrow_; i++)
92 for (unsigned int j = 0; j < ncol_; j++)
93 this->data_[i][j] = s;
94 }
95
96 DynamicRectMatrix(unsigned int nrow, unsigned int ncol, Real* array) {
97 allocate(nrow, ncol);
98 for (unsigned int i = 0; i < nrow_; i++)
99 for (unsigned int j = 0; j < ncol_; j++)
100 this->data_[i][j] = array[i * ncol_ + j];
101 }
102
103 /** copy constructor */
105 allocate(m.getNRow(), m.getNCol());
106
107 for (unsigned int i = 0; i < nrow_; i++)
108 for (unsigned int j = 0; j < ncol_; j++)
109 this->data_[i][j] = m.data_[i][j];
110 }
111
112 /** destructor*/
113 ~DynamicRectMatrix() { deallocate(); }
114
115 /** copy assignment operator */
117 if (this == &m) return *this;
118 if (nrow_ != m.getNRow() || ncol_ != m.getNCol()) {
119 deallocate();
120 allocate(m.getNRow(), m.getNCol());
121 }
122
123 for (unsigned int i = 0; i < nrow_; i++)
124 for (unsigned int j = 0; j < ncol_; j++)
125 this->data_[i][j] = m.data_[i][j];
126 return *this;
127 }
128
129 /**
130 * Returns the reference of a single element of this matrix.
131 * @return the reference of a single element of this matrix
132 * @param i row index
133 * @param j Column index
134 */
135 Real& operator()(unsigned int i, unsigned int j) {
136 return this->data_[i][j];
137 }
138
139 /**
140 * Returns the value of a single element of this matrix.
141 * @return the value of a single element of this matrix
142 * @param i row index
143 * @param j Column index
144 */
145 Real operator()(unsigned int i, unsigned int j) const {
146 return this->data_[i][j];
147 }
148
149 /**
150 * Copies the internal data to an array
151 * @param array the pointer of destination array
152 */
153 void getArray(Real* array) {
154 for (unsigned int i = 0; i < nrow_; i++) {
155 for (unsigned int j = 0; j < ncol_; j++) {
156 array[i * nrow_ + j] = this->data_[i][j];
157 }
158 }
159 }
160
161 /**
162 * Returns a row of this matrix as a vector.
163 * @return a row of this matrix as a vector
164 * @param row the row index
165 */
166 DynamicVector<Real> getRow(unsigned int row) {
168
169 for (unsigned int i = 0; i < ncol_; i++)
170 v[i] = this->data_[row][i];
171
172 return v;
173 }
174
175 /**
176 * Sets a row of this matrix
177 * @param row the row index
178 * @param v the vector to be set
179 */
180 void setRow(unsigned int row, const DynamicVector<Real>& v) {
181 assert(v.size() == nrow_);
182 for (unsigned int i = 0; i < ncol_; i++)
183 this->data_[row][i] = v[i];
184 }
185
186 /**
187 * Returns a column of this matrix as a vector.
188 * @return a column of this matrix as a vector
189 * @param col the column index
190 */
191 DynamicVector<Real> getColumn(unsigned int col) {
192 DynamicVector<Real> v(ncol_);
193
194 for (unsigned int j = 0; j < nrow_; j++)
195 v[j] = this->data_[j][col];
196
197 return v;
198 }
199
200 /**
201 * Sets a column of this matrix
202 * @param col the column index
203 * @param v the vector to be set
204 */
205 void setColumn(unsigned int col, const DynamicVector<Real>& v) {
206 for (unsigned int j = 0; j < nrow_; j++)
207 this->data_[j][col] = v[j];
208 }
209
210 /**
211 * swap two rows of this matrix
212 * @param i the first row
213 * @param j the second row
214 */
215 void swapRow(unsigned int i, unsigned int j) {
216 assert(i < nrow_ && j < nrow_);
217
218 for (unsigned int k = 0; k < ncol_; k++)
219 std::swap(this->data_[i][k], this->data_[j][k]);
220 }
221
222 /**
223 * swap two Columns of this matrix
224 * @param i the first Column
225 * @param j the second Column
226 */
227 void swapColumn(unsigned int i, unsigned int j) {
228 assert(i < ncol_ && j < ncol_);
229
230 for (unsigned int k = 0; k < nrow_; k++)
231 std::swap(this->data_[k][i], this->data_[k][j]);
232 }
233
234 /**
235 * Tests if this matrix is identical to matrix m
236 * @return true if this matrix is equal to the matrix m, return false
237 * otherwise
238 * @param m matrix to be compared
239 *
240 * @todo replace operator == by template function equal
241 */
243 assert(nrow_ == m.getNRow() && ncol_ == m.getNCol());
244 for (unsigned int i = 0; i < nrow_; i++)
245 for (unsigned int j = 0; j < ncol_; j++)
246 if (!equal(this->data_[i][j], m.data_[i][j])) return false;
247
248 return true;
249 }
250
251 /**
252 * Tests if this matrix is not equal to matrix m
253 * @return true if this matrix is not equal to the matrix m, return false
254 * otherwise
255 * @param m matrix to be compared
256 */
257 bool operator!=(const DynamicRectMatrix<Real>& m) { return !(*this == m); }
258
259 /** Negates the value of this matrix in place. */
260 inline void negate() {
261 for (unsigned int i = 0; i < nrow_; i++)
262 for (unsigned int j = 0; j < ncol_; j++)
263 this->data_[i][j] = -this->data_[i][j];
264 }
265
266 /**
267 * Sets the value of this matrix to the negation of matrix m.
268 * @param m the source matrix
269 */
270 inline void negate(const DynamicRectMatrix<Real>& m) {
271 for (unsigned int i = 0; i < nrow_; i++)
272 for (unsigned int j = 0; j < ncol_; j++)
273 this->data_[i][j] = -m.data_[i][j];
274 }
275
276 /**
277 * Sets the value of this matrix to the sum of itself and m (*this += m).
278 * @param m the other matrix
279 */
280 inline void add(const DynamicRectMatrix<Real>& m) {
281 assert(nrow_ == m.getNRow() && ncol_ == m.getNCol());
282 for (unsigned int i = 0; i < nrow_; i++)
283 for (unsigned int j = 0; j < ncol_; j++)
284 this->data_[i][j] += m.data_[i][j];
285 }
286
287 /**
288 * Sets the value of this matrix to the sum of m1 and m2 (*this = m1 + m2).
289 * @param m1 the first matrix
290 * @param m2 the second matrix
291 */
292 inline void add(const DynamicRectMatrix<Real>& m1,
293 const DynamicRectMatrix<Real>& m2) {
294 assert(m1.getNRow() == m2.getNRow() && m1.getNCol() == m2.getNCol());
295 for (unsigned int i = 0; i < nrow_; i++)
296 for (unsigned int j = 0; j < ncol_; j++)
297 this->data_[i][j] = m1.data_[i][j] + m2.data_[i][j];
298 }
299
300 /**
301 * Sets the value of this matrix to the difference of itself and m (*this -=
302 * m).
303 * @param m the other matrix
304 */
305 inline void sub(const DynamicRectMatrix<Real>& m) {
306 assert(nrow_ == m.getNRow() && ncol_ == m.getNCol());
307 for (unsigned int i = 0; i < nrow_; i++)
308 for (unsigned int j = 0; j < ncol_; j++)
309 this->data_[i][j] -= m.data_[i][j];
310 }
311
312 /**
313 * Sets the value of this matrix to the difference of matrix m1 and m2
314 * (*this = m1 - m2).
315 * @param m1 the first matrix
316 * @param m2 the second matrix
317 */
318 inline void sub(const DynamicRectMatrix<Real>& m1,
319 const DynamicRectMatrix<Real>& m2) {
320 assert(m1.getNRow() == m2.getNRow() && m1.getNCol() == m2.getNCol());
321 for (unsigned int i = 0; i < nrow_; i++)
322 for (unsigned int j = 0; j < ncol_; j++)
323 this->data_[i][j] = m1.data_[i][j] - m2.data_[i][j];
324 }
325
326 /**
327 * Sets the value of this matrix to the scalar multiplication of itself
328 * (*this *= s).
329 * @param s the scalar value
330 */
331 inline void mul(Real s) {
332 for (unsigned int i = 0; i < nrow_; i++)
333 for (unsigned int j = 0; j < ncol_; j++)
334 this->data_[i][j] *= s;
335 }
336
337 /**
338 * Sets the value of this matrix to the scalar multiplication of matrix m
339 * (*this = s * m).
340 * @param s the scalar value
341 * @param m the matrix
342 */
343 inline void mul(Real s, const DynamicRectMatrix<Real>& m) {
344 assert(nrow_ == m.getNRow() && ncol_ == m.getNCol());
345 for (unsigned int i = 0; i < nrow_; i++)
346 for (unsigned int j = 0; j < ncol_; j++)
347 this->data_[i][j] = s * m.data_[i][j];
348 }
349
350 /**
351 * Sets the value of this matrix to the scalar division of itself (*this /=
352 * s ).
353 * @param s the scalar value
354 */
355 inline void div(Real s) {
356 for (unsigned int i = 0; i < nrow_; i++)
357 for (unsigned int j = 0; j < ncol_; j++)
358 this->data_[i][j] /= s;
359 }
360
361 /**
362 * Sets the value of this matrix to the scalar division of matrix m (*this
363 * = m /s).
364 * @param s the scalar value
365 * @param m the matrix
366 */
367 inline void div(Real s, const DynamicRectMatrix<Real>& m) {
368 assert(nrow_ == m.getNRow() && ncol_ == m.getNCol());
369 for (unsigned int i = 0; i < nrow_; i++)
370 for (unsigned int j = 0; j < ncol_; j++)
371 this->data_[i][j] = m.data_[i][j] / s;
372 }
373
374 /**
375 * Multiples a scalar onto every element of this matrix.
376 * @param s the scalar value
377 */
379 this->mul(s);
380 return *this;
381 }
382
383 /**
384 * Divides every element of this matrix by a scalar.
385 * @param s the scalar value
386 */
388 this->div(s);
389 return *this;
390 }
391
392 /**
393 * Sets the value of this matrix to the sum of the other matrix and itself
394 * (*this += m).
395 * @param m the other matrix
396 */
398 assert(nrow_ == m.getNRow() && ncol_ == m.getNCol());
399 add(m);
400 return *this;
401 }
402
403 /**
404 * Sets the value of this matrix to the differerence of itself and the other
405 * matrix (*this -= m)
406 * @param m the other matrix
407 */
409 assert(nrow_ == m.getNRow() && ncol_ == m.getNCol());
410 sub(m);
411 return *this;
412 }
413
414 /** Return the transpose of this matrix */
416 DynamicRectMatrix<Real> result(ncol_, nrow_);
417
418 for (unsigned int i = 0; i < nrow_; i++)
419 for (unsigned int j = 0; j < ncol_; j++)
420 result(j, i) = this->data_[i][j];
421
422 return result;
423 }
424
425 unsigned int getNRow() const { return nrow_; }
426 unsigned int getNCol() const { return ncol_; }
427
428 template<class MatrixType>
429 void setSubMatrix(unsigned int beginRow, unsigned int beginCol,
430 const MatrixType& m) {
431 assert(beginRow + m.getNRow() - 1 <= nrow_);
432 assert(beginCol + m.getNCol() - 1 <= ncol_);
433
434 for (unsigned int i = 0; i < m.getNRow(); ++i)
435 for (unsigned int j = 0; j < m.getNCol(); ++j)
436 this->data_[beginRow + i][beginCol + j] = m(i, j);
437 }
438
439 template<class MatrixType>
440 void getSubMatrix(unsigned int beginRow, unsigned int beginCol,
441 MatrixType& m) {
442 assert(beginRow + m.getNRow() - 1 <= nrow_);
443 assert(beginCol + m.getNCol() - 1 <= ncol_);
444
445 for (unsigned int i = 0; i < m.getNRow(); ++i)
446 for (unsigned int j = 0; j < m.getNCol(); ++j)
447 m(i, j) = this->data_[beginRow + i][beginCol + j];
448 }
449
450 protected:
451 Real** data_;
452 unsigned int nrow_;
453 unsigned int ncol_;
454
455 private:
456 void allocate(unsigned int nrow, unsigned int ncol) {
457 nrow_ = (unsigned int)nrow;
458 ncol_ = (unsigned int)ncol;
459 data_ = new Real*[nrow_];
460 for (unsigned int i = 0; i < nrow_; ++i)
461 data_[i] = new Real[ncol_];
462 }
463
464 void deallocate() {
465 for (unsigned int i = 0; i < nrow_; ++i)
466 delete data_[i];
467 delete[] data_;
468
469 nrow_ = 0;
470 ncol_ = 0;
471 data_ = NULL;
472 }
473 };
474
475 /** Negate the value of every element of this matrix. */
476 template<typename Real>
478 DynamicRectMatrix<Real> result(m);
479
480 result.negate();
481
482 return result;
483 }
484
485 /**
486 * Return the sum of two matrixes (m1 + m2).
487 * @return the sum of two matrixes
488 * @param m1 the first matrix
489 * @param m2 the second matrix
490 */
491 template<typename Real>
493 const DynamicRectMatrix<Real>& m2) {
494 DynamicRectMatrix<Real> result(m1.getNRow(), m1.getNCol());
495
496 result.add(m1, m2);
497
498 return result;
499 }
500
501 /**
502 * Return the difference of two matrixes (m1 - m2).
503 * @return the sum of two matrixes
504 * @param m1 the first matrix
505 * @param m2 the second matrix
506 */
507 template<typename Real>
509 const DynamicRectMatrix<Real>& m2) {
510 DynamicRectMatrix<Real> result(m1.getNRow(), m1.getNCol());
511
512 result.sub(m1, m2);
513
514 return result;
515 }
516
517 /**
518 * Return the multiplication of scalar and matrix (m * s).
519 * @return the multiplication of a scalar and a matrix
520 * @param m the matrix
521 * @param s the scalar
522 */
523 template<typename Real>
525 Real s) {
526 DynamicRectMatrix<Real> result(m.getNRow(), m.getNCol());
527
528 result.mul(s, m);
529
530 return result;
531 }
532
533 /**
534 * Return the multiplication of a scalar and a matrix (s * m).
535 * @return the multiplication of a scalar and a matrix
536 * @param s the scalar
537 * @param m the matrix
538 */
539 template<typename Real>
541 const DynamicRectMatrix<Real>& m) {
542 DynamicRectMatrix<Real> result(m.getNRow(), m.getNCol());
543
544 result.mul(s, m);
545
546 return result;
547 }
548
549 /**
550 * Return the multiplication of two matrixes (m1 * m2).
551 * @return the multiplication of two matrixes
552 * @param m1 the first matrix
553 * @param m2 the second matrix
554 */
555 template<typename Real>
557 const DynamicRectMatrix<Real>& m2) {
558 assert(m1.getNCol() == m2.getNRow());
559 unsigned int sameDim = m1.getNCol();
560 unsigned int nrow = m1.getNRow();
561 unsigned int ncol = m2.getNCol();
562 DynamicRectMatrix<Real> result(nrow, ncol);
563 for (unsigned int i = 0; i < nrow; i++)
564 for (unsigned int j = 0; j < ncol; j++)
565 for (unsigned int k = 0; k < sameDim; k++)
566 result(i, j) += m1(i, k) * m2(k, j);
567
568 return result;
569 }
570
571 /**
572 * Return the multiplication of a matrix and a vector (m * v).
573 * @return the multiplication of a matrix and a vector
574 * @param m the matrix
575 * @param v the vector
576 */
577 template<typename Real>
579 const DynamicVector<Real>& v) {
580 unsigned int nrow = m.getNRow();
581 unsigned int ncol = m.getNCol();
582 assert(ncol == v.size());
583 DynamicVector<Real> result(nrow);
584
585 for (unsigned int i = 0; i < nrow; i++)
586 for (unsigned int j = 0; j < ncol; j++)
587 result[i] += m(i, j) * v[j];
588
589 return result;
590 }
591
592 /**
593 * Return the scalar division of matrix (m / s).
594 * @return the scalar division of matrix
595 * @param m the matrix
596 * @param s the scalar
597 */
598 template<typename Real>
600 Real s) {
601 DynamicRectMatrix<Real> result(m.getNRow(), m.getNCol());
602
603 result.div(s, m);
604
605 return result;
606 }
607
608 /**
609 * Write to an output stream
610 */
611 template<typename Real>
612 std::ostream& operator<<(std::ostream& o, const DynamicRectMatrix<Real>& m) {
613 for (unsigned int i = 0; i < m.getNRow(); i++) {
614 o << "(";
615 for (unsigned int j = 0; j < m.getNCol(); j++) {
616 o << m(i, j);
617 if (j != m.getNCol() - 1) o << "\t";
618 }
619 o << ")" << std::endl;
620 }
621 return o;
622 }
623} // namespace OpenMD
624
625#endif // MATH_RECTMATRIX_HPP
rectangular matrix class
void add(const DynamicRectMatrix< Real > &m)
Sets the value of this matrix to the sum of itself and m (*this += m).
void mul(Real s, const DynamicRectMatrix< Real > &m)
Sets the value of this matrix to the scalar multiplication of matrix m (*this = s * m).
void swapColumn(unsigned int i, unsigned int j)
swap two Columns of this matrix
void negate()
Negates the value of this matrix in place.
DynamicRectMatrix< Real > operator-=(const DynamicRectMatrix< Real > m)
Sets the value of this matrix to the differerence of itself and the other matrix (*this -= m)
DynamicVector< Real > getRow(unsigned int row)
Returns a row of this matrix as a vector.
void swapRow(unsigned int i, unsigned int j)
swap two rows of this matrix
void div(Real s)
Sets the value of this matrix to the scalar division of itself (*this /= s ).
DynamicRectMatrix< Real > operator+=(const DynamicRectMatrix< Real > m)
Sets the value of this matrix to the sum of the other matrix and itself (*this += m).
Real & operator()(unsigned int i, unsigned int j)
Returns the reference of a single element of this matrix.
Real operator()(unsigned int i, unsigned int j) const
Returns the value of a single element of this matrix.
bool operator!=(const DynamicRectMatrix< Real > &m)
Tests if this matrix is not equal to matrix m.
void div(Real s, const DynamicRectMatrix< Real > &m)
Sets the value of this matrix to the scalar division of matrix m (*this = m /s).
void negate(const DynamicRectMatrix< Real > &m)
Sets the value of this matrix to the negation of matrix m.
void mul(Real s)
Sets the value of this matrix to the scalar multiplication of itself (*this *= s).
void setColumn(unsigned int col, const DynamicVector< Real > &v)
Sets a column of this matrix.
DynamicRectMatrix< Real > operator*=(const Real s)
Multiples a scalar onto every element of this matrix.
void sub(const DynamicRectMatrix< Real > &m)
Sets the value of this matrix to the difference of itself and m (*this -= m).
DynamicRectMatrix< Real > transpose() const
Return the transpose of this matrix.
bool operator==(const DynamicRectMatrix< Real > &m)
Tests if this matrix is identical to matrix m.
DynamicRectMatrix< Real > operator/=(const Real s)
Divides every element of this matrix by a scalar.
void setRow(unsigned int row, const DynamicVector< Real > &v)
Sets a row of this matrix.
void add(const DynamicRectMatrix< Real > &m1, const DynamicRectMatrix< Real > &m2)
Sets the value of this matrix to the sum of m1 and m2 (*this = m1 + m2).
DynamicVector< Real > getColumn(unsigned int col)
Returns a column of this matrix as a vector.
void sub(const DynamicRectMatrix< Real > &m1, const DynamicRectMatrix< Real > &m2)
Sets the value of this matrix to the difference of matrix m1 and m2 (*this = m1 - m2).
void getArray(Real *array)
Copies the internal data to an array.
DynamicRectMatrix()
default constructor
DynamicRectMatrix(const SelfType &m)
copy constructor
DynamicRectMatrix< Real > operator=(const DynamicRectMatrix< Real > &m)
copy assignment operator
DynamicRectMatrix(unsigned int nrow, unsigned int ncol, Real s)
Constructs and initializes every element of this matrix to a scalar.
Dynamically-sized vector class.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
DynamicRectMatrix< Real > operator-(const DynamicRectMatrix< Real > &m)
Negate the value of every element of this matrix.
bool equal(const Polynomial< Real > &p1, const Polynomial< Real > &p2)
Tests if two polynomial have the same exponents.
DynamicRectMatrix< Real > operator*(const DynamicRectMatrix< Real > &m, Real s)
Return the multiplication of scalar and matrix (m * s).
DynamicRectMatrix< Real > operator/(const DynamicRectMatrix< Real > &m, Real s)
Return the scalar division of matrix (m / s).