Jpp  test_elongated_shower_pde
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JMatrixND.hh
Go to the documentation of this file.
1 #ifndef __JMATH__JMATRIXND__
2 #define __JMATH__JMATRIXND__
3 
4 #include <cstring>
5 #include <limits>
6 #include <cmath>
7 #include <algorithm>
8 
9 #include "JIO/JSerialisable.hh"
10 #include "JLang/JException.hh"
11 #include "JLang/JEquals.hh"
12 #include "JLang/JSingleton.hh"
13 #include "JLang/JManip.hh"
14 #include "JMath/JMath.hh"
15 #include "JMath/JVectorND.hh"
16 
17 /**
18  * \author mdejong
19  */
20 
21 namespace JMATH {}
22 namespace JPP { using namespace JMATH; }
23 
24 namespace JMATH {
25 
26  using JIO::JReader;
27  using JIO::JWriter;
28  using JLANG::JEquals;
29  using JLANG::JSingleton;
30  using JLANG::JException;
33 
34 
35  /**
36  * Basic NxN matrix.
37  */
38  struct JMatrixND_t :
39  public JSingleton<JMatrixND_t>
40  {
41  /**
42  * Default constructor.
43  */
45  __p(NULL),
46  __n(0),
47  __m(0)
48  {}
49 
50 
51  /**
52  * Copy constructor.
53  *
54  * \param A matrix
55  */
57  JMatrixND_t()
58  {
59  set(A);
60  }
61 
62 
63  /**
64  * Move constructor.
65  *
66  * \param A matrix
67  */
69  JMatrixND_t()
70  {
71  swap(A);
72  }
73 
74 
75  /**
76  * Destructor.
77  */
79  {
80  clear();
81  }
82 
83 
84  /**
85  * Clear memory.
86  */
87  void clear()
88  {
89  if (__p != NULL) {
90  delete [] __p;
91  }
92 
93  __p = NULL;
94  __n = 0;
95  __m = 0;
96  }
97 
98 
99  /**
100  * Resize matrix.
101  *
102  * Note that this method does not maintain data in the matrix.
103  *
104  * \param size dimension
105  */
106  void resize(const size_t size)
107  {
108  if (size != this->__n) {
109 
110  if (size > this->__m) {
111 
112  if (__p != NULL) {
113  delete[] __p;
114  }
115 
116  __m = size;
117  __p = new double[__m*__m];
118 
119  if (__p == NULL) {
120  THROW(JNewException, "JMatrixND::resize(" << size << "): Memory allocation failure.");
121  }
122  }
123 
124  __n = size;
125  }
126  }
127 
128 
129  /**
130  * Set matrix.
131  *
132  * \param A matrix
133  */
134  void set(const JMatrixND_t& A)
135  {
136  this->resize(A.size());
137 
138  memcpy(this->data(), A.data(), A.size() * A.size() * sizeof(double));
139  }
140 
141 
142  /**
143  * Swap matrices
144  *
145  * \param A matrix
146  */
148  {
149  using std::swap;
150 
151  swap(this->__p, A.__p);
152  swap(this->__n, A.__n);
153  swap(this->__m, A.__m);
154  }
155 
156 
157  /**
158  * Transpose.
159  *
160  * \return this matrix
161  */
163  {
164  using std::swap;
165 
166  for (size_t row = 0; row != this->size(); ++row) {
167  for (size_t col = 0; col != row; ++col) {
168  swap((*this)(row,col), (*this)(col,row));
169  }
170  }
171 
172  return *this;
173  }
174 
175 
176  /**
177  * Get dimension of matrix.
178  *
179  * \return dimension
180  */
181  size_t size() const
182  {
183  return __n;
184  }
185 
186 
187  /**
188  * Get capacity of dimension.
189  *
190  * \return capacity
191  */
192  size_t capacity() const
193  {
194  return __m;
195  }
196 
197 
198  /**
199  * Check emptyness.
200  *
201  * \return true if empty; else false
202  */
203  bool empty() const
204  {
205  return __n == 0;
206  }
207 
208 
209  /**
210  * Get pointer to data.
211  *
212  * \return pointer to data.
213  */
214  const double* data() const
215  {
216  return __p;
217  }
218 
219 
220  /**
221  * Get pointer to data.
222  *
223  * \return pointer to data.
224  */
225  double* data()
226  {
227  return __p;
228  }
229 
230 
231  /**
232  * Get row data.
233  *
234  * \param row row number
235  * \return pointer to row data
236  */
237  const double* operator[](size_t row) const
238  {
239  return __p + row*__n;
240  }
241 
242 
243  /**
244  * Get row data.
245  *
246  * \param row row number
247  * \return pointer to row data
248  */
249  double* operator[](size_t row)
250  {
251  return __p + row*__n;
252  }
253 
254 
255  /**
256  * Get matrix element.
257  *
258  * \param row row number
259  * \param col column number
260  * \return matrix element at (row,col)
261  */
262  double operator()(const size_t row, const size_t col) const
263  {
264  return *(__p + row*__n + col);
265  }
266 
267 
268  /**
269  * Get matrix element.
270  *
271  * \param row row number
272  * \param col column number
273  * \return matrix element at (row,col)
274  */
275  double& operator()(const size_t row, const size_t col)
276  {
277  return *(__p + row*__n + col);
278  }
279 
280 
281  /**
282  * Get matrix element.
283  *
284  * \param row row number
285  * \param col column number
286  * \return matrix element at (row,col)
287  */
288  double at(size_t row, size_t col) const
289  {
290  if (row >= this->size() ||
291  col >= this->size()) {
292  THROW(JIndexOutOfRange, "JMatrixND::at(" << row << "," << col << "): index out of range.");
293  }
294 
295  return (*this)(row, col);
296  }
297 
298 
299  /**
300  * Get matrix element.
301  *
302  * \param row row number
303  * \param col column number
304  * \return matrix element at (row,col)
305  */
306  double& at(size_t row, size_t col)
307  {
308  if (row >= this->size() ||
309  col >= this->size()) {
310  THROW(JIndexOutOfRange, "JMatrixND::at(" << row << "," << col << "): index out of range.");
311  }
312 
313  return (*this)(row, col);
314  }
315 
316 
317  protected:
318  double* __p; //!< pointer to data
319  size_t __n; //!< dimension of matrix
320  size_t __m; //!< capacity of matrix
321  };
322 
323 
324  /**
325  * NxN matrix.
326  */
327  struct JMatrixND :
328  public JMatrixND_t,
329  public JMath <JMatrixND>,
330  public JEquals<JMatrixND>
331  {
332  using JMath<JMatrixND>::mul;
333 
334  /**
335  * Default constructor.
336  */
338  {}
339 
340 
341  /**
342  * Constructor.
343  *
344  * The matrix is set to zero.
345  *
346  * \param size dimension
347  */
348  JMatrixND(const size_t size)
349  {
350  resize(size);
351  reset();
352  }
353 
354 
355  /**
356  * Copy constructor.
357  *
358  * \param A matrix
359  */
361  {
362  set(A);
363  }
364 
365 
366  /**
367  * Move constructor.
368  *
369  * \param A matrix
370  */
372  {
373  swap(A);
374  }
375 
376 
377  /**
378  * Assignment operator.
379  *
380  * \param A matrix
381  */
383  {
384  this->set(A);
385 
386  return *this;
387  }
388 
389 
390  /**
391  * Move assignment operator.
392  *
393  * \param A matrix
394  */
396  {
397  this->swap(A);
398 
399  return *this;
400  }
401 
402 
403  /**
404  * Resize matrix.
405  *
406  * Note that this method does not maintain data in the matrix.
407  *
408  * \param size dimension
409  */
410  void resize(const size_t size)
411  {
412  static_cast<JMatrixND_t&>(*this).resize(size);
413 
414  getInstance().resize(size);
415  }
416 
417 
418  /**
419  * Set matrix to the null matrix.
420  *
421  * \return this matrix
422  */
424  {
426 
427  double* p = A.data();
428 
429  for (size_t i = this->size(); i != 0; --i, ++p) {
430  *p = 0.0;
431  }
432 
433  p = this->data();
434 
435  for (size_t i = this->size(); i != 0; --i, p += this->size()) {
436  memcpy(p, A.data(), this->size() * sizeof(double));
437  }
438 
439  return *this;
440  }
441 
442 
443  /**
444  * Set to identity matrix
445  *
446  * \return this matrix
447  */
449  {
450  reset();
451 
452  for (size_t i = 0; i != this->size(); ++i) {
453  (*this)(i,i) = 1.0;
454  }
455 
456  return *this;
457  }
458 
459 
460  /**
461  * Negate matrix.
462  *
463  * \return this matrix
464  */
466  {
467  double* p = this->data();
468 
469  for (size_t i = this->size()*this->size(); i != 0; --i, ++p) {
470  *p = -*p;
471  }
472 
473  return *this;
474  }
475 
476 
477  /**
478  * Matrix addition.
479  *
480  * \param A matrix
481  * \return this matrix
482  */
484  {
485  if (this->size() == A.size()) {
486 
487  double* p = this->data();
488  const double* q = A.data();
489 
490  for (size_t i = this->size()*this->size(); i != 0; --i, ++p, ++q) {
491  *p += *q;
492  }
493 
494  } else {
495  THROW(JException, "JMatrixND::add() inconsistent matrix dimensions " << this->size() << ' ' << A.size());
496  }
497  }
498 
499 
500  /**
501  * Matrix subtraction.
502  *
503  * \param A matrix
504  * \return this matrix
505  */
507  {
508  if (this->size() == A.size()) {
509 
510  double* p = this->data();
511  const double* q = A.data();
512 
513  for (size_t i = this->size()*this->size(); i != 0; --i, ++p, ++q) {
514  *p -= *q;
515  }
516 
517  } else {
518  THROW(JException, "JMatrixND::sub() inconsistent matrix dimensions " << this->size() << ' ' << A.size());
519  }
520 
521  return *this;
522  }
523 
524 
525  /**
526  * Scale matrix.
527  *
528  * \param factor factor
529  * \return this matrix
530  */
531  JMatrixND& mul(const double factor)
532  {
533  double* p = this->data();
534 
535  for (size_t i = this->size()*this->size(); i != 0; --i, ++p) {
536  *p *= factor;
537  }
538 
539  return *this;
540  }
541 
542 
543  /**
544  * Scale matrix.
545  *
546  * \param factor factor
547  * \return this matrix
548  */
549  JMatrixND& div(const double factor)
550  {
551  double* p = this->data();
552 
553  for (size_t i = this->size()*this->size(); i != 0; --i, ++p) {
554  *p /= factor;
555  }
556 
557  return *this;
558  }
559 
560 
561  /**
562  * Matrix multiplication.
563  *
564  * \param A matrix
565  * \param B matrix
566  * \return this matrix
567  */
569  const JMatrixND& B)
570  {
571  if (A.size() == B.size()) {
572 
573  this->resize(A.size());
574 
575  if (!this->empty()) {
576 
578 
579  C.set(B);
580  C.transpose();
581 
582  size_t i, row;
583 
584  for (row = 0; row + 4 <= this->size(); row += 4) { // process rows by four
585 
586  double* p0 = (*this)[row + 0];
587  double* p1 = (*this)[row + 1];
588  double* p2 = (*this)[row + 2];
589  double* p3 = (*this)[row + 3];
590 
591  for (size_t col = 0; col != this->size(); ++col, ++p0, ++p1, ++p2, ++p3) {
592 
593  double w0 = 0.0;
594  double w1 = 0.0;
595  double w2 = 0.0;
596  double w3 = 0.0;
597 
598  const double* a0 = A[row + 0];
599  const double* a1 = A[row + 1];
600  const double* a2 = A[row + 2];
601  const double* a3 = A[row + 3];
602 
603  const double* c0 = C[col];
604 
605  for (i = 0; i + 4 <= this->size(); i += 4, a0 += 4, a1 += 4, a2 += 4, a3 += 4, c0 += 4) {
606  w0 += a0[0] * c0[0] + a0[1] * c0[1] + a0[2] * c0[2] + a0[3] * c0[3];
607  w1 += a1[0] * c0[0] + a1[1] * c0[1] + a1[2] * c0[2] + a1[3] * c0[3];
608  w2 += a2[0] * c0[0] + a2[1] * c0[1] + a2[2] * c0[2] + a2[3] * c0[3];
609  w3 += a3[0] * c0[0] + a3[1] * c0[1] + a3[2] * c0[2] + a3[3] * c0[3];
610  }
611 
612  for ( ; i != this->size(); ++i, ++a0, ++a1, ++a2, ++a3, ++c0) {
613  w0 += (*a0) * (*c0);
614  w1 += (*a1) * (*c0);
615  w2 += (*a2) * (*c0);
616  w3 += (*a3) * (*c0);
617  }
618 
619  *p0 = w0;
620  *p1 = w1;
621  *p2 = w2;
622  *p3 = w3;
623  }
624  }
625 
626  for ( ; row != this->size(); ++row) { // remaining rows
627 
628  double* p0 = (*this)[row + 0];
629 
630  for (size_t col = 0; col != this->size(); ++col, ++p0) {
631 
632  double w0 = 0.0;
633 
634  const double* a0 = A[row + 0];
635  const double* c0 = C[col];
636 
637  for (i = 0; i + 4 <= this->size(); i += 4, a0 += 4, c0 += 4) {
638  w0 += a0[0] * c0[0] + a0[1] * c0[1] + a0[2] * c0[2] + a0[3] * c0[3];
639  }
640 
641  for ( ; i != this->size(); ++i, ++a0, ++c0) {
642  w0 += (*a0) * (*c0);
643  }
644 
645  *p0 = w0;
646  }
647  }
648  }
649 
650  } else {
651  THROW(JException, "JMatrixND::mul() inconsistent matrix dimensions " << A.size() << ' ' << B.size());
652  }
653 
654  return *this;
655  }
656 
657 
658  /**
659  * Equality.
660  *
661  * \param A matrix
662  * \param eps numerical precision
663  * \return true if matrices identical; else false
664  */
665  bool equals(const JMatrixND& A,
666  const double eps = std::numeric_limits<double>::min()) const
667  {
668  if (this->size() == A.size()) {
669 
670  for (size_t row = 0; row != this->size(); ++row) {
671 
672  const double* p = (*this)[row];
673  const double* q = A [row];
674 
675  for (size_t i = this->size(); i != 0; --i, ++p, ++q) {
676  if (fabs(*p - *q) > eps) {
677  return false;
678  }
679  }
680  }
681 
682  return true;
683 
684  } else {
685  THROW(JException, "JMatrixND::equals() inconsistent matrix dimensions " << this->size() << ' ' << A.size());
686  }
687  }
688 
689 
690  /**
691  * Test identity.
692  *
693  * \param eps numerical precision
694  * \return true if identity matrix; else false
695  */
696  bool isIdentity(const double eps = std::numeric_limits<double>::min()) const
697  {
698  for (size_t i = 0; i != this->size(); ++i) {
699 
700  if (fabs(1.0 - (*this)(i,i)) > eps) {
701  return false;
702  };
703 
704  for (size_t j = 0; j != i; ++j) {
705  if (fabs((*this)(i,j)) > eps || fabs((*this)(j,i)) > eps) {
706  return false;
707  };
708  }
709  }
710 
711  return true;
712  }
713 
714 
715  /**
716  * Test symmetry.
717  *
718  * \param eps numerical precision
719  * \return true if symmetric matrix; else false
720  */
721  bool isSymmetric(const double eps = std::numeric_limits<double>::min()) const
722  {
723  for (size_t i = 0; i != this->size(); ++i) {
724  for (size_t j = 0; j != i; ++j) {
725  if (fabs((*this)(i,j) - (*this)(j,i)) > eps) {
726  return false;
727  };
728  }
729  }
730 
731  return true;
732  }
733 
734 
735  /**
736  * Get dot product.
737  *
738  * The dot product corresponds to \f[ v^{T} \times A \times v \f].
739  *
740  * \param v vector
741  * \return dot product
742  */
743  double getDot(const JVectorND& v) const
744  {
745  double dot = 0.0;
746 
747  for (size_t i = 0; i != v.size(); ++i) {
748 
749  const double* p = (*this)[i];
750 
751  double w = 0.0;
752 
753  for (JVectorND::const_iterator y = v.begin(); y != v.end(); ++y, ++p) {
754  w += (*p) * (*y);
755  }
756 
757  dot += v[i] * w;
758  }
759 
760  return dot;
761  }
762 
763 
764  /**
765  * Read matrix from input.
766  *
767  * \param in reader
768  * \param A matrix
769  * \return reader
770  */
771  friend inline JReader& operator>>(JReader& in, JMatrixND& A)
772  {
773  size_t size;
774 
775  in >> size;
776 
777  A.resize(size);
778 
779  size_t n = A.size() * A.size();
780 
781  for (double* p = A.data(); n != 0; --n, ++p) {
782  in >> *p;
783  }
784 
785  return in;
786  }
787 
788 
789  /**
790  * Write matrix to output.
791  *
792  * \param out writer
793  * \param A matrix
794  * \return writer
795  */
796  friend inline JWriter& operator<<(JWriter& out, const JMatrixND& A)
797  {
798  out << A.size();
799 
800  size_t n = A.size() * A.size();
801 
802  for (const double* p = A.data(); n != 0; --n, ++p) {
803  out << *p;
804  }
805 
806  return out;
807  }
808 
809 
810  /**
811  * Print ASCII formatted output.
812  *
813  * \param out output stream
814  * \param A matrix
815  * \return output stream
816  */
817  friend inline std::ostream& operator<<(std::ostream& out, const JMatrixND& A)
818  {
819  using namespace std;
820 
821  const JFormat format(out, getFormat<JMatrixND>(JFormat_t(10, 3, std::ios::fixed | std::ios::showpos)));
822 
823  for (size_t row = 0; row != A.size(); ++row) {
824 
825  for (size_t col = 0; col != A.size(); ++col) {
826  out << format << A(row,col) << ' ';
827  }
828 
829  out << endl;
830  }
831 
832  return out;
833  }
834 
835 
836  protected:
837  /*
838  * Swap rows.
839  *
840  * \param r1 row
841  * \param r2 row
842  */
843  void rswap(size_t r1, size_t r2)
844  {
845  JMatrixND_t& A = getInstance();
846 
847  memcpy(A.data(), (*this)[r1], this->size() * sizeof(double));
848  memcpy((*this)[r1], (*this)[r2], this->size() * sizeof(double));
849  memcpy((*this)[r2], A.data(), this->size() * sizeof(double));
850  }
851 
852 
853  /**
854  * Swap columns.
855  *
856  * \param c1 column
857  * \param c2 column
858  */
859  void cswap(size_t c1, size_t c2)
860  {
861  using std::swap;
862 
863  double* p1 = this->data() + c1;
864  double* p2 = this->data() + c2;
865 
866  for (size_t i = this->size(); i != 0; --i, p1 += this->size(), p2 += this->size()) {
867  swap(*p1, *p2);
868  }
869  }
870  };
871 }
872 
873 #endif
JMatrixND(const JMatrixND &A)
Copy constructor.
Definition: JMatrixND.hh:360
Exception for failure of memory allocation.
Definition: JException.hh:306
General exception.
Definition: JException.hh:23
data_type w[N+1][M+1]
Definition: JPolint.hh:757
Exceptions.
Simple singleton class.
Definition: JSingleton.hh:18
Interface for binary output.
Auxiliary base class for aritmetic operations of derived class types.
Definition: JMath.hh:110
TPaveText * p1
JMatrixND_t(const JMatrixND_t &A)
Copy constructor.
Definition: JMatrixND.hh:56
JMatrixND & sub(const JMatrixND &A)
Matrix subtraction.
Definition: JMatrixND.hh:506
double at(size_t row, size_t col) const
Get matrix element.
Definition: JMatrixND.hh:288
void clear()
Clear memory.
Definition: JMatrixND.hh:87
JMatrixND & mul(const double factor)
Scale matrix.
Definition: JMatrixND.hh:531
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
JMatrixND & reset()
Set matrix to the null matrix.
Definition: JMatrixND.hh:423
void resize(const size_t size)
Resize matrix.
Definition: JMatrixND.hh:410
const double * operator[](size_t row) const
Get row data.
Definition: JMatrixND.hh:237
JMatrixND & operator=(const JMatrixND &A)
Assignment operator.
Definition: JMatrixND.hh:382
~JMatrixND_t()
Destructor.
Definition: JMatrixND.hh:78
Auxiliary class to temporarily define format specifications.
Definition: JManip.hh:632
double operator()(const size_t row, const size_t col) const
Get matrix element.
Definition: JMatrixND.hh:262
JMatrixND(const size_t size)
Constructor.
Definition: JMatrixND.hh:348
NxN matrix.
Definition: JMatrixND.hh:327
friend JWriter & operator<<(JWriter &out, const JMatrixND &A)
Write matrix to output.
Definition: JMatrixND.hh:796
static const double C
Physics constants.
const int n
Definition: JPolint.hh:676
void set(const JMatrixND_t &A)
Set matrix.
Definition: JMatrixND.hh:134
JMatrixND_t()
Default constructor.
Definition: JMatrixND.hh:44
bool isIdentity(const double eps=std::numeric_limits< double >::min()) const
Test identity.
Definition: JMatrixND.hh:696
Template definition of auxiliary base class for comparison of data structures.
Definition: JEquals.hh:24
double * data()
Get pointer to data.
Definition: JMatrixND.hh:225
JMatrixND & add(const JMatrixND &A)
Matrix addition.
Definition: JMatrixND.hh:483
Interface for binary input.
bool equals(const JMatrixND &A, const double eps=std::numeric_limits< double >::min()) const
Equality.
Definition: JMatrixND.hh:665
void rswap(size_t r1, size_t r2)
Definition: JMatrixND.hh:843
friend JReader & operator>>(JReader &in, JMatrixND &A)
Read matrix from input.
Definition: JMatrixND.hh:771
I/O manipulators.
size_t size() const
Get dimension of matrix.
Definition: JMatrixND.hh:181
TCanvas * c1
Global variables to handle mouse events.
p2
Definition: module-Z:fit.sh:74
JMatrixND & negate()
Negate matrix.
Definition: JMatrixND.hh:465
double & at(size_t row, size_t col)
Get matrix element.
Definition: JMatrixND.hh:306
size_t __n
dimension of matrix
Definition: JMatrixND.hh:319
JMatrixND & operator=(JMatrixND &&A)
Move assignment operator.
Definition: JMatrixND.hh:395
static data_type & getInstance()
Get unique instance of template class.
Definition: JSingleton.hh:27
JMatrixND_t(JMatrixND_t &&A)
Move constructor.
Definition: JMatrixND.hh:68
double * __p
pointer to data
Definition: JMatrixND.hh:318
bool isSymmetric(const double eps=std::numeric_limits< double >::min()) const
Test symmetry.
Definition: JMatrixND.hh:721
void resize(const size_t size)
Resize matrix.
Definition: JMatrixND.hh:106
JMatrixND_t & transpose()
Transpose.
Definition: JMatrixND.hh:162
Base class for data structures with artithmetic capabilities.
void cswap(size_t c1, size_t c2)
Swap columns.
Definition: JMatrixND.hh:859
size_t capacity() const
Get capacity of dimension.
Definition: JMatrixND.hh:192
JMatrixND()
Default constructor.
Definition: JMatrixND.hh:337
void swap(JMatrixND_t &A)
Swap matrices.
Definition: JMatrixND.hh:147
int j
Definition: JPolint.hh:682
JMatrixND(JMatrixND &&A)
Move constructor.
Definition: JMatrixND.hh:371
Exception for accessing an index in a collection that is outside of its range.
Definition: JException.hh:90
data_type v[N+1][M+1]
Definition: JPolint.hh:756
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:42
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
double getDot(const JVectorND &v) const
Get dot product.
Definition: JMatrixND.hh:743
const double * data() const
Get pointer to data.
Definition: JMatrixND.hh:214
bool empty() const
Check emptyness.
Definition: JMatrixND.hh:203
Data structure for format specifications.
Definition: JManip.hh:522
double & operator()(const size_t row, const size_t col)
Get matrix element.
Definition: JMatrixND.hh:275
size_t __m
capacity of matrix
Definition: JMatrixND.hh:320
p3
Definition: module-Z:fit.sh:74
Basic NxN matrix.
Definition: JMatrixND.hh:38
JMatrixND & setIdentity()
Set to identity matrix.
Definition: JMatrixND.hh:448
double * operator[](size_t row)
Get row data.
Definition: JMatrixND.hh:249
Nx1 matrix.
Definition: JVectorND.hh:21
JMatrixND & div(const double factor)
Scale matrix.
Definition: JMatrixND.hh:549
friend std::ostream & operator<<(std::ostream &out, const JMatrixND &A)
Print ASCII formatted output.
Definition: JMatrixND.hh:817
JMatrixND & mul(const JMatrixND &A, const JMatrixND &B)
Matrix multiplication.
Definition: JMatrixND.hh:568