Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
includeLinks/Matrix3D.hpp
Go to the documentation of this file.
1 /* *****************************************************************
2  MESQUITE -- The Mesh Quality Improvement Toolkit
3 
4  Copyright 2004 Sandia Corporation and Argonne National
5  Laboratory. Under the terms of Contract DE-AC04-94AL85000
6  with Sandia Corporation, the U.S. Government retains certain
7  rights in this software.
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  (lgpl.txt) along with this library; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 
23  diachin2@llnl.gov, djmelan@sandia.gov, mbrewer@sandia.gov,
24  pknupp@sandia.gov, tleurent@mcs.anl.gov, tmunson@mcs.anl.gov
25 
26  ***************************************************************** */
27 //
28 // AUTHOR: Thomas Leurent <tleurent@mcs.anl.gov>
29 // ORG: Argonne National Laboratory
30 // E-MAIL: tleurent@mcs.anl.gov
31 //
32 // ORIG-DATE: 18-Dec-02 at 11:08:22
33 // LAST-MOD: 27-May-04 at 14:48:56 by Thomas Leurent
34 //
35 // DESCRIPTION:
36 // ============
44 // DESCRIP-END.
45 //
46 
47 
48 
49 #ifndef Matrix3D_hpp
50 #define Matrix3D_hpp
51 
52 #ifndef MSQ_USE_OLD_IO_HEADERS
53 #include <iostream>
54 #include <sstream>
55 #else
56 #include <iostream.h>
57 #include <strstream.h>
58 #endif
59 
60 #ifndef MSQ_USE_OLD_C_HEADERS
61 #include <cstdlib>
62 #else
63 #include <stdlib.h>
64 #endif
65 
66 #include "Mesquite.hpp"
67 #include "Vector3D.hpp"
68 
69 namespace Mesquite
70 {
71 
78  class Matrix3D
79  {
80  protected:
81  double v_[9];
82 
83 
84  void copy(const double* v)
85  { memcpy(v_, v, 9*sizeof(double)); }
86 
87  void set(const double& val)
88  {
89  v_[0]=val; v_[1]=val; v_[2]=val;
90  v_[3]=val; v_[4]=val; v_[5]=val;
91  v_[6]=val; v_[7]=val; v_[8]=val;
92  }
93 
94  void set_values(const char *s)
95  {
96 #ifdef MSQ_USE_OLD_IO_HEADERS
97  ::istrstream ins(s);
98 #else
99  std::istringstream ins(s);
100 #endif
101  ins>>v_[0]; ins>>v_[1]; ins>>v_[2];
102  ins>>v_[3]; ins>>v_[4]; ins>>v_[5];
103  ins>>v_[6]; ins>>v_[7]; ins>>v_[8];
104  }
105 
106  public:
107 
108  // constructors
111  {
112  zero();
113  }
114 
116  {
117  copy(A.v_);
118  }
119 
121  Matrix3D(const double& value)
122  {
123  set(value);
124  }
125 
128  Matrix3D(const double* v)
129  {
130  copy(v);
131  }
132 
135  Matrix3D(const char *s)
136  {
137  set_values(s);
138  }
139 
140  // destructor
141  ~Matrix3D() { }
142 
143  // assignments
145  {
146  if (v_ == A.v_)
147  return *this;
148  copy(A.v_);
149  return *this;
150  }
151 
152  Matrix3D& operator=(const double& scalar)
153  {
154  set(scalar);
155  return *this;
156  }
157 
160  Matrix3D& operator=(const char* s)
161  {
162  set_values(s);
163  return *this;
164  }
165 
167  void zero()
168  {
169  v_[0]=0.; v_[1]=0.; v_[2]=0.;
170  v_[3]=0.; v_[4]=0.; v_[5]=0.;
171  v_[6]=0.; v_[7]=0.; v_[8]=0.;
172  }
173 
175  void set_column(int j, const Vector3D& c)
176  {
177  v_[0+j]=c[0];
178  v_[3+j]=c[1];
179  v_[6+j]=c[2];
180  }
181 
183  double column_length(int i) const
184  { return sqrt( v_[0+i]*v_[0+i] + v_[3+i]*v_[3+i] + v_[6+i]*v_[6+i] ); }
185 
186  // Matrix Operators
187  friend bool operator==(const Matrix3D &lhs, const Matrix3D &rhs);
188  friend bool operator!=(const Matrix3D &lhs, const Matrix3D &rhs);
189  friend double Frobenius_2(const Matrix3D &A);
190  friend Matrix3D transpose(const Matrix3D &A);
191  friend const Matrix3D operator+(const Matrix3D &A, const Matrix3D &B);
192  friend const Matrix3D operator-(const Matrix3D &A, const Matrix3D &B) ;
193  friend const Matrix3D operator*(const Matrix3D &A, const Matrix3D &B);
194  friend const Matrix3D mult_element(const Matrix3D &A, const Matrix3D &B);
195  friend int matmult(Matrix3D& C, const Matrix3D &A, const Matrix3D &B);
196  friend const Vector3D operator*(const Matrix3D &A, const Vector3D &x);
197  friend const Vector3D operator*(const Vector3D &x, const Matrix3D &A);
198  const Matrix3D operator*(const double &s) const;
199  friend const Matrix3D operator*(const double &s, const Matrix3D &A);
200  void operator+=(const Matrix3D &rhs);
201  void operator-=(const Matrix3D &rhs);
202  void operator*=(const double &s);
203  Matrix3D plus_transpose(const Matrix3D &B) const;
204  void plus_transpose_equal(const Matrix3D &B);
205  Matrix3D& outer_product(const Vector3D &v1, const Vector3D &v2);
206  void fill_lower_triangle();
207 
209  friend void eqAx(Vector3D& v, const Matrix3D& A, const Vector3D& x);
211  friend void plusEqAx(Vector3D& v, const Matrix3D& A, const Vector3D& x);
213  friend void plusEqTransAx(Vector3D& v, const Matrix3D& A, const Vector3D& x);
214 
216  friend void plusEqaA(Matrix3D& B, const double a, const Matrix3D &A);
217 
219  friend double det(const Matrix3D &A);
220 
222  friend void inv(Matrix3D& B, const Matrix3D &A);
223 
225  friend void timesInvA(Matrix3D& B, const Matrix3D &A);
226 
228  friend void QR(Matrix3D &Q, Matrix3D &R, const Matrix3D &A);
229 
230  size_t num_rows() const { return 3; }
231  size_t num_cols() const { return 3; }
232 
234  inline double* operator[](unsigned i)
235  {
236  return v_ + 3*i;
237  }
238 
240  inline const double* operator[](unsigned i) const
241  {
242  return v_ + 3*i;
243  }
244 
245  };
246 
247 
248  /* *********** I/O **************/
249 
250  inline msq_stdio::ostream& operator<<(msq_stdio::ostream &s, const Matrix3D &A)
251  {
252  for (size_t i=0; i<3; ++i)
253  {
254  for (size_t j=0; j<3; ++j)
255  s << A[i][j] << " ";
256  s << "\n";
257  }
258  return s;
259  }
260 
261  inline msq_stdio::istream& operator>>(msq_stdio::istream &s, Matrix3D &A)
262  {
263  for (size_t i=0; i<3; i++)
264  for (size_t j=0; j<3; j++)
265  {
266  s >> A[i][j];
267  }
268  return s;
269  }
270 
271  // *********** matrix operators *******************
272 
273  // comparison functions
274  inline bool operator==(const Matrix3D &lhs, const Matrix3D &rhs)
275  {
276  return (memcmp(lhs.v_, rhs.v_, 9*sizeof(double)) == 0);
277  }
278  inline bool operator!=(const Matrix3D &lhs, const Matrix3D &rhs)
279  {
280  return (memcmp(lhs.v_, rhs.v_, 9*sizeof(double)) != 0);
281  }
282 
284  inline const Matrix3D operator+(const Matrix3D &A,
285  const Matrix3D &B)
286  {
287  Matrix3D tmp;
288  size_t i;
289  for (i=0; i<3; ++i) {
290  tmp[i][0] = A[i][0] + B[i][0];
291  tmp[i][1] = A[i][1] + B[i][1];
292  tmp[i][2] = A[i][2] + B[i][2];
293  }
294  return tmp;
295  }
296 
298  inline const Matrix3D operator-(const Matrix3D &A,
299  const Matrix3D &B)
300  {
301  Matrix3D tmp;
302  size_t i;
303  for (i=0; i<3; ++i) {
304  tmp[i][0] = A[i][0] - B[i][0];
305  tmp[i][1] = A[i][1] - B[i][1];
306  tmp[i][2] = A[i][2] - B[i][2];
307  }
308  return tmp;
309  }
310 
312  inline const Matrix3D mult_element(const Matrix3D &A,
313  const Matrix3D &B)
314  {
315  Matrix3D tmp;
316  size_t i;
317  for (i=0; i<3; ++i) {
318  tmp[i][0] = A[i][0] * B[i][0];
319  tmp[i][1] = A[i][1] * B[i][1];
320  tmp[i][2] = A[i][2] * B[i][2];
321  }
322  return tmp;
323  }
324 
326  inline double Frobenius_2(const Matrix3D &A)
327  {
328  double fro=0.;
329  for (int i=0; i<3; ++i) {
330  fro += A[0][i]*A[0][i] + A[1][i]*A[1][i] + A[2][i]*A[2][i] ;
331  }
332  return fro;
333  }
334 
335  inline Matrix3D transpose(const Matrix3D &A)
336  {
337  Matrix3D S;
338  size_t i;
339  for (i=0; i<3; ++i) {
340  S[size_t(0)][i] = A[i][0];
341  S[size_t(1)][i] = A[i][1];
342  S[size_t(2)][i] = A[i][2];
343  }
344  return S;
345  }
346 
347  inline void Matrix3D::operator+=(const Matrix3D &rhs)
348  {
349  v_[0] += rhs.v_[0]; v_[1] += rhs.v_[1]; v_[2] += rhs.v_[2];
350  v_[3] += rhs.v_[3]; v_[4] += rhs.v_[4]; v_[5] += rhs.v_[5];
351  v_[6] += rhs.v_[6]; v_[7] += rhs.v_[7]; v_[8] += rhs.v_[8];
352  }
353 
354  inline void Matrix3D::operator-=(const Matrix3D &rhs)
355  {
356  v_[0] -= rhs.v_[0]; v_[1] -= rhs.v_[1]; v_[2] -= rhs.v_[2];
357  v_[3] -= rhs.v_[3]; v_[4] -= rhs.v_[4]; v_[5] -= rhs.v_[5];
358  v_[6] -= rhs.v_[6]; v_[7] -= rhs.v_[7]; v_[8] -= rhs.v_[8];
359  }
360 
362  inline void Matrix3D::operator*=(const double &s)
363  {
364  v_[0] *= s; v_[1] *= s; v_[2] *= s;
365  v_[3] *= s; v_[4] *= s; v_[5] *= s;
366  v_[6] *= s; v_[7] *= s; v_[8] *= s;
367  }
368 
371  {
372  Matrix3D tmp;
373 
374  tmp.v_[0] = v_[0] + B.v_[0];
375  tmp.v_[1] = v_[1] + B.v_[3];
376  tmp.v_[2] = v_[2] + B.v_[6];
377 
378  tmp.v_[3] = v_[3] + B.v_[1];
379  tmp.v_[4] = v_[4] + B.v_[4];
380  tmp.v_[5] = v_[5] + B.v_[7];
381 
382  tmp.v_[6] = v_[6] + B.v_[2];
383  tmp.v_[7] = v_[7] + B.v_[5];
384  tmp.v_[8] = v_[8] + B.v_[8];
385 
386  return tmp;
387  }
388 
391  {
392  v_[0] += B.v_[0];
393  v_[1] += B.v_[3];
394  v_[2] += B.v_[6];
395 
396  v_[3] += B.v_[1];
397  v_[4] += B.v_[4];
398  v_[5] += B.v_[7];
399 
400  v_[6] += B.v_[2];
401  v_[7] += B.v_[5];
402  v_[8] += B.v_[8];
403  }
404 
406  inline Matrix3D& Matrix3D::outer_product(const Vector3D &v1, const Vector3D &v2)
407  {
408  // remember, matrix entries are v_[0] to v_[8].
409 
410  // diagonal
411  v_[0] = v1[0]*v2[0];
412  v_[4] = v1[1]*v2[1];
413  v_[8] = v1[2]*v2[2];
414 
415  // upper triangular part
416  v_[1] = v1[0]*v2[1];
417  v_[2] = v1[0]*v2[2];
418  v_[5] = v1[1]*v2[2];
419 
420  // lower triangular part
421  v_[3] = v2[0]*v1[1];
422  v_[6] = v2[0]*v1[2];
423  v_[7] = v2[1]*v1[2];
424 
425  return *this;
426  }
427 
429  {
430  v_[3] = v_[1];
431  v_[6] = v_[2];
432  v_[7] = v_[5];
433  }
434 
436  inline const Matrix3D operator*(const Matrix3D &A,
437  const Matrix3D &B)
438  {
439  Matrix3D tmp;
440  double sum;
441  for (size_t i=0; i<3; ++i)
442  for (size_t k=0; k<3; ++k)
443  {
444  sum = 0;
445  for (size_t j=0; j<3; j++)
446  sum = sum + A[i][j] * B[j][k];
447  tmp[i][k] = sum;
448  }
449  return tmp;
450  }
451 
453  inline const Matrix3D Matrix3D::operator*(const double &s) const
454  {
455  Matrix3D temp;
456  temp[0][0]=v_[0] * s; temp[0][1]=v_[1] * s; temp[0][2]=v_[2] * s;
457  temp[1][0]=v_[3] * s; temp[1][1]=v_[4] * s; temp[1][2]=v_[5] * s;
458  temp[2][0]=v_[6] * s; temp[2][1]=v_[7] * s; temp[2][2]=v_[8] * s;
459  return temp;
460  }
463  inline const Matrix3D operator*(const double &s, const Matrix3D &A)
464  {
465  return (A.operator*(s));
466  }
467 
468 
470  inline int matmult(Matrix3D& C, const Matrix3D &A,
471  const Matrix3D &B)
472  {
473  double sum;
474  const double* row_i;
475  const double* col_k;
476  for (size_t i=0; i<3; ++i)
477  for (size_t k=0; k<3; ++k)
478  {
479  row_i = &(A[i][0]);
480  col_k = &(B[0][k]);
481  sum = 0;
482  for (size_t j=0; j<3; ++j)
483  {
484  sum += *row_i * *col_k;
485  row_i++;
486  col_k += 3;
487  }
488  C[i][k] = sum;
489  }
490  return 0;
491  }
492 
494  inline const Vector3D operator*(const Matrix3D &A, const Vector3D &x)
495  {
496  Vector3D tmp; // initializes to 0
497  for (size_t i=0; i<3; ++i)
498  {
499  const double* rowi = A[i];
500  tmp[i] = rowi[0]*x[0] + rowi[1]*x[1] + rowi[2]*x[2];
501  }
502  return tmp;
503  }
504 
510  inline const Vector3D operator*(const Vector3D &x, const Matrix3D &A)
511  {
512  Vector3D res(0., 0., 0.);
513  for (size_t i=0; i<3; ++i)
514  {
515  const double* rowi = A[i];
516  for (size_t j=0; j<3; ++j)
517  res[j] += rowi[j] * x[i];
518  }
519  return res;
520  }
521 
522  inline void eqAx(Vector3D& v, const Matrix3D& A, const Vector3D& x)
523  {
524  v.mCoords[0] = A.v_[0]*x[0] + A.v_[1]*x.mCoords[1] + A.v_[2]*x.mCoords[2];
525  v.mCoords[1] = A.v_[3]*x[0] + A.v_[4]*x.mCoords[1] + A.v_[5]*x.mCoords[2];
526  v.mCoords[2] = A.v_[6]*x[0] + A.v_[7]*x.mCoords[1] + A.v_[8]*x.mCoords[2];
527  }
528 
529  inline void plusEqAx(Vector3D& v, const Matrix3D& A, const Vector3D& x)
530  {
531  v.mCoords[0] += A.v_[0]*x[0] + A.v_[1]*x.mCoords[1] + A.v_[2]*x.mCoords[2];
532  v.mCoords[1] += A.v_[3]*x[0] + A.v_[4]*x.mCoords[1] + A.v_[5]*x.mCoords[2];
533  v.mCoords[2] += A.v_[6]*x[0] + A.v_[7]*x.mCoords[1] + A.v_[8]*x.mCoords[2];
534  }
535 
536  inline void plusEqTransAx(Vector3D& v, const Matrix3D& A, const Vector3D& x)
537  {
538  v.mCoords[0] += A.v_[0]*x.mCoords[0] + A.v_[3]*x.mCoords[1] + A.v_[6]*x.mCoords[2];
539  v.mCoords[1] += A.v_[1]*x.mCoords[0] + A.v_[4]*x.mCoords[1] + A.v_[7]*x.mCoords[2];
540  v.mCoords[2] += A.v_[2]*x.mCoords[0] + A.v_[5]*x.mCoords[1] + A.v_[8]*x.mCoords[2];
541  }
542 
543  inline void plusEqaA(Matrix3D& B, const double a, const Matrix3D &A) {
544  B.v_[0] += a*A.v_[0]; B.v_[1] += a*A.v_[1]; B.v_[2] += a*A.v_[2];
545  B.v_[3] += a*A.v_[3]; B.v_[4] += a*A.v_[4]; B.v_[5] += a*A.v_[5];
546  B.v_[6] += a*A.v_[6]; B.v_[7] += a*A.v_[7]; B.v_[8] += a*A.v_[8];
547  }
548 
549  inline double det(const Matrix3D &A) {
550  return ( A.v_[0]*(A.v_[4]*A.v_[8]-A.v_[7]*A.v_[5])
551  -A.v_[1]*(A.v_[3]*A.v_[8]-A.v_[6]*A.v_[5])
552  +A.v_[2]*(A.v_[3]*A.v_[7]-A.v_[6]*A.v_[4]) );
553  }
554 
555  inline void inv(Matrix3D &Ainv, const Matrix3D &A) {
556  double inv_detA = 1 / (det(A));
557 
558  Ainv[0][0] = inv_detA*( A.v_[4]*A.v_[8]-A.v_[5]*A.v_[7] );
559  Ainv[0][1] = inv_detA*( A.v_[2]*A.v_[7]-A.v_[8]*A.v_[1] );
560  Ainv[0][2] = inv_detA*( A.v_[1]*A.v_[5]-A.v_[4]*A.v_[2] );
561 
562  Ainv[1][0] = inv_detA*( A.v_[5]*A.v_[6]-A.v_[8]*A.v_[3] );
563  Ainv[1][1] = inv_detA*( A.v_[0]*A.v_[8]-A.v_[6]*A.v_[2] );
564  Ainv[1][2] = inv_detA*( A.v_[2]*A.v_[3]-A.v_[5]*A.v_[0] );
565 
566  Ainv[2][0] = inv_detA*( A.v_[3]*A.v_[7]-A.v_[6]*A.v_[4] );
567  Ainv[2][1] = inv_detA*( A.v_[1]*A.v_[6]-A.v_[7]*A.v_[0] );
568  Ainv[2][2] = inv_detA*( A.v_[0]*A.v_[4]-A.v_[3]*A.v_[1] );
569  return;
570  }
571 
572  inline void timesInvA(Matrix3D& B, const Matrix3D &A) {
573 
574  Matrix3D Ainv;
575 
576  double inv_detA = 1 / ( det(A) );
577 
578  Ainv[0][0] = inv_detA*( A.v_[4]*A.v_[8]-A.v_[5]*A.v_[7] );
579  Ainv[0][1] = inv_detA*( A.v_[2]*A.v_[7]-A.v_[8]*A.v_[1] );
580  Ainv[0][2] = inv_detA*( A.v_[1]*A.v_[5]-A.v_[4]*A.v_[2] );
581 
582  Ainv[1][0] = inv_detA*( A.v_[5]*A.v_[6]-A.v_[8]*A.v_[3] );
583  Ainv[1][1] = inv_detA*( A.v_[0]*A.v_[8]-A.v_[6]*A.v_[2] );
584  Ainv[1][2] = inv_detA*( A.v_[2]*A.v_[3]-A.v_[5]*A.v_[0] );
585 
586  Ainv[2][0] = inv_detA*( A.v_[3]*A.v_[7]-A.v_[6]*A.v_[4] );
587  Ainv[2][1] = inv_detA*( A.v_[1]*A.v_[6]-A.v_[7]*A.v_[0] );
588  Ainv[2][2] = inv_detA*( A.v_[0]*A.v_[4]-A.v_[3]*A.v_[1] );
589 
590  B = B*Ainv;
591  }
592 
593  inline void QR(Matrix3D &Q, Matrix3D &R, const Matrix3D &A) {
594  // Compute the QR factorization of A. This code uses the
595  // Modified Gram-Schmidt method for computing the factorization.
596  // The Householder version is more stable, but costs twice as many
597  // floating point operations.
598 
599  Q = A;
600 
601  R[0][0] = sqrt(Q[0][0]*Q[0][0] + Q[1][0]*Q[1][0] + Q[2][0]*Q[2][0]);
602  R[1][0] = 0.0L;
603  R[2][0] = 0.0L;
604  Q[0][0] /= R[0][0];
605  Q[1][0] /= R[0][0];
606  Q[2][0] /= R[0][0];
607 
608  R[0][1] = Q[0][0]*Q[0][1] + Q[1][0]*Q[1][1] + Q[2][0]*Q[2][1];
609  Q[0][1] -= Q[0][0]*R[0][1];
610  Q[1][1] -= Q[1][0]*R[0][1];
611  Q[2][1] -= Q[2][0]*R[0][1];
612 
613  R[0][2] = Q[0][0]*Q[0][2] + Q[1][0]*Q[1][2] + Q[2][0]*Q[2][2];
614  Q[0][2] -= Q[0][0]*R[0][2];
615  Q[1][2] -= Q[1][0]*R[0][2];
616  Q[2][2] -= Q[2][0]*R[0][2];
617 
618  R[1][1] = sqrt(Q[0][1]*Q[0][1] + Q[1][1]*Q[1][1] + Q[2][1]*Q[2][1]);
619  R[2][1] = 0.0L;
620  Q[0][1] /= R[1][1];
621  Q[1][1] /= R[1][1];
622  Q[2][1] /= R[1][1];
623 
624  R[1][2] = Q[0][1]*Q[0][2] + Q[1][1]*Q[1][2] + Q[2][1]*Q[2][2];
625  Q[0][2] -= Q[0][1]*R[1][2];
626  Q[1][2] -= Q[1][1]*R[1][2];
627  Q[2][2] -= Q[2][1]*R[1][2];
628 
629  R[2][2] = sqrt(Q[0][2]*Q[0][2] + Q[1][2]*Q[1][2] + Q[2][2]*Q[2][2]);
630  Q[0][2] /= R[2][2];
631  Q[1][2] /= R[2][2];
632  Q[2][2] /= R[2][2];
633  return;
634  }
635 
636 } // namespace Mesquite
637 
638 #endif // Matrix3D_hpp
Matrix3D()
Default constructor sets all entries to 0.
Matrix3D & operator=(const char *s)
for test purposes, matrices can be assigned as follows
Matrix3D(const Matrix3D &A)
Matrix3D & operator=(const double &scalar)
void plusEqaA(Matrix3D &B, const double a, const Matrix3D &A)
friend void inv(Matrix3D &B, const Matrix3D &A)
void zero()
Sets all entries to zero (more efficient than assignement).
const Matrix3D operator*(const Matrix3D &A, const Matrix3D &B)
Matrix3D(const char *s)
for test purposes, matrices can be instantiated as
friend const Matrix3D operator*(const Matrix3D &A, const Matrix3D &B)
msq_stdio::istream & operator>>(msq_stdio::istream &s, Matrix3D &A)
bool operator!=(const Matrix3D &lhs, const Matrix3D &rhs)
void operator-=(const Matrix3D &rhs)
j indices k indices k
Definition: Indexing.h:6
NT rhs
void plusEqAx(Vector3D &v, const Matrix3D &A, const Vector3D &x)
double s
Definition: blastest.C:80
const double * operator[](unsigned i) const
returns a pointer to a row.
friend const Matrix3D operator-(const Matrix3D &A, const Matrix3D &B)
Matrix3D transpose(const Matrix3D &A)
friend void timesInvA(Matrix3D &B, const Matrix3D &A)
friend int matmult(Matrix3D &C, const Matrix3D &A, const Matrix3D &B)
Matrix3D & outer_product(const Vector3D &v1, const Vector3D &v2)
Computes .
void plusEqTransAx(Vector3D &v, const Matrix3D &A, const Vector3D &x)
Vector3D is the object that effeciently stores information about about three-deminsional vectors...
double sqrt(double d)
Definition: double.h:73
friend double det(const Matrix3D &A)
determinant of matrix A, det(A).
friend double Frobenius_2(const Matrix3D &A)
Return the square of the Frobenius norm of A, i.e. sum (diag (A&#39; * A))
void copy(const double *v)
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
friend void plusEqaA(Matrix3D &B, const double a, const Matrix3D &A)
double Frobenius_2(const Matrix3D &A)
Return the square of the Frobenius norm of A, i.e. sum (diag (A&#39; * A))
int matmult(Matrix3D &C, const Matrix3D &A, const Matrix3D &B)
rational * A
Definition: vinci_lass.c:67
void plus_transpose_equal(const Matrix3D &B)
friend bool operator!=(const Matrix3D &lhs, const Matrix3D &rhs)
void QR(Matrix3D &Q, Matrix3D &R, const Matrix3D &A)
Matrix3D(const double &value)
sets all entries of the matrix to value.
3*3 Matric class, row-oriented, 0-based [i][j] indexing.
bool operator==(const Matrix3D &lhs, const Matrix3D &rhs)
double column_length(int i) const
returns the column length – i is 0-based.
const Matrix3D operator-(const Matrix3D &A, const Matrix3D &B)
blockLoc i
Definition: read.cpp:79
void timesInvA(Matrix3D &B, const Matrix3D &A)
void int int REAL * x
Definition: read.cpp:74
friend void eqAx(Vector3D &v, const Matrix3D &A, const Vector3D &x)
friend Matrix3D transpose(const Matrix3D &A)
Matrix3D plus_transpose(const Matrix3D &B) const
const Matrix3D mult_element(const Matrix3D &A, const Matrix3D &B)
Multiplies entry by entry. This is NOT a matrix multiplication.
friend const Matrix3D mult_element(const Matrix3D &A, const Matrix3D &B)
Multiplies entry by entry. This is NOT a matrix multiplication.
void set(const double &val)
friend void plusEqTransAx(Vector3D &v, const Matrix3D &A, const Vector3D &x)
void operator+=(const Matrix3D &rhs)
const Matrix3D operator+(const Matrix3D &A, const Matrix3D &B)
double det(const Matrix3D &A)
friend const Matrix3D operator+(const Matrix3D &A, const Matrix3D &B)
void set_column(int j, const Vector3D &c)
Sets column j (0, 1 or 2) to Vector3D c.
Matrix3D & operator=(const Matrix3D &A)
j indices j
Definition: Indexing.h:6
void inv(Matrix3D &Ainv, const Matrix3D &A)
friend void QR(Matrix3D &Q, Matrix3D &R, const Matrix3D &A)
msq_stdio::ostream & operator<<(msq_stdio::ostream &s, const Matrix3D &A)
double * operator[](unsigned i)
returns a pointer to a row.
Matrix3D(const double *v)
sets matrix entries to values in array.
friend bool operator==(const Matrix3D &lhs, const Matrix3D &rhs)
friend void plusEqAx(Vector3D &v, const Matrix3D &A, const Vector3D &x)
void operator*=(const double &s)
multiplies each entry by the scalar s
void set_values(const char *s)
void eqAx(Vector3D &v, const Matrix3D &A, const Vector3D &x)