FreeFem 3.5.x
Public Member Functions | Public Attributes | Friends | List of all members
fem::cmat Class Reference

Public Member Functions

 cmat (const cmat &r)
 
 cmat (ccreal r)
 cmat(cmat& r) { val[0]=r.val[0]; val[1]=r.val[1]; val[2]=r.val[2]; val[3]=r.val[3]; } // copy constructor More...
 
ccreal & operator() (int i, int j)
 
ccreal & operator[] (int i)
 
const ccreal & operator[] (int i) const
 
float modul2 ()
 
cmat operator*= (const cmat &a)
 
cmatoperator*= (const ccreal a)
 
cmatoperator/= (const ccreal a)
 
cmatoperator+= (const cmat &a)
 
cmatoperator+= (const ccreal a)
 
cmatoperator-= (const cmat &a)
 
cmatoperator-= (const ccreal a)
 
cmatoperator= (const cmat &a)
 
cmatoperator= (const ccreal a)
 
cmatoperator- ()
 

Public Attributes

ccreal val [4]
 

Friends

cmat operator* (const cmat &a, const cmat &b)
 
cmat operator* (const cmat &a, const ccreal b)
 
cmat operator* (const ccreal b, const cmat &a)
 
cmat operator/ (const cmat &a, const ccreal b)
 
cmat operator+ (const cmat &a, const cmat &b)
 
cmat operator+ (const cmat &a, const ccreal b)
 
cmat operator+ (const ccreal b, const cmat &a)
 
cmat operator- (const cmat &a, const cmat &b)
 
cmat operator- (const cmat &a, const ccreal b)
 
cmat operator- (const ccreal b, const cmat &a)
 
float norm2 (cmat &a)
 
cvect operator* (const cmat &a, const cvect &b)
 
cvect operator* (const cvect &b, const cmat &a)
 
cvect operator/ (const cvect &b, const cmat &a)
 
cmat operator/ (const cmat &b, const cmat &a)
 
std::ostream & operator<< (std::ostream &os, cmat &a)
 
std::istream & operator>> (std::istream &os, cmat &a)
 
cmat id (const cvect &a)
 

Constructor & Destructor Documentation

◆ cmat() [1/3]

fem::cmat::cmat ( )
inline
215{val[0]=0.F;val[1]=0.F;val[2]=0.F;val[3]=0.F; } // constructor

◆ cmat() [2/3]

fem::cmat::cmat ( const cmat r)
inline
216{val[0]=r.val[0];val[1]=r.val[1];val[2]=r.val[2];val[3]=r.val[3];} // copy constructor

◆ cmat() [3/3]

fem::cmat::cmat ( ccreal  r)
inline

cmat(cmat& r) { val[0]=r.val[0]; val[1]=r.val[1]; val[2]=r.val[2]; val[3]=r.val[3]; } // copy constructor

218{ val[0] = r;val[1] = r;val[2] = r;val[3] = r;} // copy constructor from a creal produces a diag mat

Member Function Documentation

◆ modul2()

float fem::cmat::modul2 ( )
inline
222{return val[0]+val[1]+val[2]+val[3];} // public fnct

◆ operator()()

ccreal & fem::cmat::operator() ( int  i,
int  j 
)
inline
219{ /*myassert((i< N)&&(i>=0)&&(j<N)&&(j>=0));*/ return val[i+i+j];}

◆ operator*=() [1/2]

cmat & fem::cmat::operator*= ( const ccreal  a)
inline
231{ val[0] *= a; val[1] *= a; val[2] *= a; val[3] *= a; return *this; }

◆ operator*=() [2/2]

cmat fem::cmat::operator*= ( const cmat a)
inline
224 { cmat b;
225 b.val[0] =val[0]*a.val[0]+val[1]*a.val[2];
226 b.val[1] =val[0]*a.val[1]+val[1]*a.val[3];
227 b.val[2] =val[2]*a.val[0]+val[3]*a.val[2];
228 b.val[3] =val[2]*a.val[1]+val[3]*a.val[3];
229 return b;
230 }

◆ operator+=() [1/2]

cmat & fem::cmat::operator+= ( const ccreal  a)
inline
238{ val[0] += a; val[1] += a; val[2] += a; val[3] += a; return *this; }

◆ operator+=() [2/2]

cmat & fem::cmat::operator+= ( const cmat a)
inline
237{val[0]+=a.val[0];val[1]+=a.val[1];val[2]+=a.val[2];val[3]+=a.val[3]; return *this; }

◆ operator-()

cmat & fem::cmat::operator- ( )
inline
250{ val[0] = -val[0];val[1] = -val[1];val[2] = -val[2];val[3] = -val[3]; return *this; }

◆ operator-=() [1/2]

cmat & fem::cmat::operator-= ( const ccreal  a)
inline
244{ val[0] -= a; val[2] -= a; val[1] -= a; val[3] -= a; return *this; }

◆ operator-=() [2/2]

cmat & fem::cmat::operator-= ( const cmat a)
inline
243{val[0]-=a.val[0];val[1]-=a.val[1];val[2]-=a.val[2];val[3]-=a.val[3]; return *this; }

◆ operator/=()

cmat & fem::cmat::operator/= ( const ccreal  a)
inline
235{ val[0] /= a; val[1] /= a; val[2] /= a; val[3] /= a; return *this; }

◆ operator=() [1/2]

cmat & fem::cmat::operator= ( const ccreal  a)
inline
249{ val[0] = a; val[1] = a; val[2] = a; val[3] = a; return *this; }

◆ operator=() [2/2]

cmat & fem::cmat::operator= ( const cmat a)
inline
248{val[0]=a.val[0];val[1]=a.val[1];val[2]=a.val[2]; val[3] = a.val[3]; return *this; }

◆ operator[]() [1/2]

ccreal & fem::cmat::operator[] ( int  i)
inline
220{ /*myassert((i< N2)&&(i>=0));*/ return val[i];}

◆ operator[]() [2/2]

const ccreal & fem::cmat::operator[] ( int  i) const
inline
221{ /*myassert((i< N2)&&(i>=0));*/ return val[i];}

Friends And Related Function Documentation

◆ id

cmat id ( const cvect a)
friend
108{
109 cmat c (0.F);
110 for (int i = 0; i < N; i++)
111 if (norm2 (a.val[i]) != 0.F)
112 c (i, i) = 1.F;
113 return c;
114}

◆ norm2

float norm2 ( cmat a)
friend
251{ return a.modul2();}

◆ operator* [1/5]

cmat operator* ( const ccreal  b,
const cmat a 
)
friend
234{ cmat c(a); return c *= b; }

◆ operator* [2/5]

cmat operator* ( const cmat a,
const ccreal  b 
)
friend
233{ cmat c(a); return c *= b; }

◆ operator* [3/5]

cmat operator* ( const cmat a,
const cmat b 
)
friend
232{ cmat c(a); return c *= b; }

◆ operator* [4/5]

cvect operator* ( const cmat a,
const cvect b 
)
friend
254 { cvect c; c.val[0] = a.val[0]*b.val[0]+a.val[1]*b.val[1];
255 c.val[1] = a.val[2]*b.val[0]+a.val[3]*b.val[1];
256 return c ; }

◆ operator* [5/5]

cvect operator* ( const cvect b,
const cmat a 
)
friend
258 { cvect c; c.val[0] = a.val[0]*b.val[0]+a.val[2]*b.val[1];
259 c.val[1] = a.val[1]*b.val[0]+a.val[3]*b.val[1];
260 return c ; } //transposed

◆ operator+ [1/3]

cmat operator+ ( const ccreal  b,
const cmat a 
)
friend
241{ cmat c(a); return c += b; }

◆ operator+ [2/3]

cmat operator+ ( const cmat a,
const ccreal  b 
)
friend
240{ cmat c(a); return c += b; }

◆ operator+ [3/3]

cmat operator+ ( const cmat a,
const cmat b 
)
friend
239{ cmat c(a); return c += b; }

◆ operator- [1/3]

cmat operator- ( const ccreal  b,
const cmat a 
)
friend
247{ cmat c(b); return c -= a; }

◆ operator- [2/3]

cmat operator- ( const cmat a,
const ccreal  b 
)
friend
246{ cmat c(a); return c -= b; }

◆ operator- [3/3]

cmat operator- ( const cmat a,
const cmat b 
)
friend
245{ cmat c(a); return c -= b; }

◆ operator/ [1/3]

cmat operator/ ( const cmat a,
const ccreal  b 
)
friend
236{ cmat c(a); return c /= b; }

◆ operator/ [2/3]

cmat operator/ ( const cmat b,
const cmat a 
)
friend
269 {
270 cmat c; ccreal s = deter2(a.val[0],a.val[1], a.val[2],a.val[3]);
271 if(norm2(s)<epsilon){ s = epsilon;}
272 c.val[0] = deter2(b.val[0],a.val[1], b.val[2],a.val[3]) / s;
273 c.val[2] = deter2(a.val[0],b.val[0], a.val[2],b.val[2]) / s;
274 c.val[1] = deter2(b.val[1],a.val[1], b.val[3],a.val[3]) / s;
275 c.val[3] = deter2(a.val[0],b.val[1], a.val[2],b.val[3]) / s;
276 return c;
277 }

◆ operator/ [3/3]

cvect operator/ ( const cvect b,
const cmat a 
)
friend
262 { cvect c; ccreal s = deter2(a.val[0],a.val[1], a.val[2],a.val[3]);
263 if(norm2(s)<epsilon) { s = epsilon;}
264 c.val[0] = deter2(b.val[0],a.val[1], b.val[1],a.val[3]) / s;
265 c.val[1] = deter2(a.val[0],b.val[0], a.val[2],b.val[1]) / s;
266 return c;
267 }

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
cmat a 
)
friend
91{
92 for (int i = 0; i < N; i++)
93 for (int j = 0; j < N; j++)
94 os << a (i, j) << " ";
95 return os;
96}

The documentation for this class was generated from the following file:

This is the FreeFEM reference manual
Provided by The KFEM project