39 #ifndef MAT_MATRIX_PROXY
40 #define MAT_MATRIX_PROXY
48 template<
typename TX,
typename TY>
54 XY(TX
const & AA, TY
const & BB,
55 bool const tAA =
false,
bool const tBB =
false)
56 :
A(AA),
B(BB),
tA(tAA),
tB(tBB)
64 template<
typename TX,
typename TY,
typename TZ>
72 XYZ(TX
const & AA, TY
const & BB, TZ
const & CC,
73 bool const tAA =
false,
74 bool const tBB =
false,
75 bool const tCC =
false)
76 :
A(AA),
B(BB),
C(CC),
tA(tAA),
tB(tBB),
tC(tCC)
85 template<
typename TX,
typename TY,
typename TZ,
typename TU,
typename TV>
97 XYZpUV(TX
const & AA, TY
const & BB, TZ
const & CC,
98 TU
const & DD, TV
const & EE,
99 bool const tAA =
false,
100 bool const tBB =
false,
101 bool const tCC =
false,
102 bool const tDD =
false,
103 bool const tEE =
false)
104 :
A(AA),
B(BB),
C(CC),
D(DD),
E(EE),
115 template<
typename TX>
119 explicit Xtrans(TX
const & AA,
bool const tAA =
false)
128 template<
typename TX>
139 template<
typename TX>
154 template<
typename TX,
typename TY>
169 template<
typename TX,
typename TY>
184 template<
typename TX,
typename TY>
197 template<
typename TX,
typename TY>
210 template<
typename TX,
typename TY,
typename TZ>
211 inline XYZ<TX, TY, TZ>
221 template<
typename TX,
typename TY,
typename TZ>
222 inline XYZ<TX, TY, TZ>
233 template<
typename TX,
typename TY,
typename TZ,
typename TU,
typename TV>
234 inline XYZpUV<TX, TY, TZ, TU, TV>
236 return XYZpUV<TX, TY, TZ, TU, TV>(ABC.
A, ABC.
B, ABC.
C, DE.
A, DE.
B, ABC.
tA, ABC.
tB, ABC.
tC, DE.
tA, DE.
tB);
243 template<
typename TX,
typename TY>
247 XpY(
const TX& AA,
const TY& BB)
254 template<
typename TX,
typename TY>
263 template<
typename TX,
typename TY>
267 XmY(
const TX& AA,
const TY& BB)
274 template<
typename TX,
typename TY>
293 inline M2<MAT> square(
const MAT& A) {
297 template<
class SCAL,
class MAT>
301 SM2(
const MAT& AA,
const SCAL a = 1)
304 SM2(
const M2<MAT>& m2)
309 template<
class SCAL,
class MAT>
310 inline SM2<SCAL, MAT>
311 operator*(
const SCAL s,
const M2<MAT>& m2) {
312 return SM2<SCAL, MAT>(m2.A, s);
322 MT(
const MAT& AA,
const bool tAA =
false)
329 return MT<MAT>(A,
true);
332 inline MT<MAT>
transpose(
const MT<MAT>& mt) {
333 return MT<MAT>(mt.A, !mt.tA);
337 template<
class SCAL,
class MAT>
342 SM(
const MAT& AA,
const SCAL scalar = 1,
const bool tAA =
false)
343 :
A(AA),alpha(scalar), tA(tAA)
347 template<
class SCAL,
class MAT>
348 inline SM<SCAL, MAT>
operator*(
const SCAL scalar,
const MT<MAT>& mta) {
349 return SM<SCAL, MAT>(mta.A,scalar, mta.tA);
352 template<
class SCAL,
class MAT>
353 inline SM<SCAL, MAT>
operator*(
const SCAL scalar,
const MAT& AA) {
354 return SM<SCAL, MAT>(AA, scalar,
false);
359 template<
class MAT,
class MATB = MAT>
365 MM(
const MAT& AA,
const MATB& BB,
const bool tAA,
const bool tBB)
366 :
A(AA),
B(BB), tA(tAA), tB(tBB)
370 template<
class MAT,
class MATB = MAT>
374 MpM(
const MAT& AA,
const MATB& BB)
379 template<
class MAT,
class MATB>
380 inline MpM<MAT, MATB>
operator+(
const MAT& AA,
const MATB& BB) {
381 return MpM<MAT, MATB>(AA, BB);
405 template<
class SCAL,
class MAT,
class MATB = MAT>
412 SMM(
const MM<MAT, MATB>& mm)
413 :
A(mm.
A),
B(mm.
B),alpha(1), tA(mm.tA), tB(mm.tB)
415 SMM(
const MAT& AA,
const MATB& BB,
416 const bool tAA,
const bool tBB,
418 :
A(AA),
B(BB), tA(tAA), tB(tBB), alpha(a)
422 template<
class SCAL,
class MAT,
class MATB>
423 inline SMM<SCAL, MAT, MATB>
424 operator*(
const SM<SCAL, MAT>& sm,
const MT<MATB>& mtb) {
425 return SMM<SCAL, MAT, MATB>(sm.A, mtb.A, sm.tA, mtb.tA, sm.alpha);
428 template<
class SCAL,
class MAT,
class MATB>
429 inline SMM<SCAL, MAT, MATB>
430 operator*(
const SM<SCAL, MAT>& sm,
const MATB& BB) {
431 return SMM<SCAL, MAT, MATB>(sm.A, BB, sm.tA,
false, sm.alpha);
434 template<
class SCAL,
class MATC,
class MATA = MATC,
class MATB = MATC>
443 SMMpSM(
const MATA& AA,
const MATB& BB,
const MATC& CC,
444 const bool tAA,
const bool tBB,
445 const SCAL a=1,
const SCAL b=1)
446 :
A(AA),
B(BB), C(CC), alpha(a), beta(b), tA(tAA), tB(tBB)
450 template<
class SCAL,
class MATC,
class MATA,
class MATB>
451 inline SMMpSM<SCAL, MATC, MATA, MATB>
452 operator+(
const SMM<SCAL, MATA, MATB>& smm,
const SM<SCAL, MATC>& sm) {
453 return SMMpSM<SCAL, MATC, MATA, MATB>
454 (smm.A, smm.B, sm.A, smm.tA, smm.tB, smm.alpha, sm.alpha);
458 template<
class SCAL,
class MATC,
class MATA,
class MATB>
459 inline SMMpSM<SCAL, MATC, MATA, MATB>
460 operator+(
const SMM<SCAL, MATA, MATB>& smm, MATC& CC) {
461 return SMMpSM<SCAL, MATC, MATA, MATB>
462 (smm.A, smm.B, CC, smm.tA, smm.tB, smm.alpha, 1);
464 template<
class SCAL,
class MATC,
class MATA,
class MATB>
465 inline SMMpSM<SCAL, MATC, MATA, MATB>
466 operator+(
const MM<MATA, MATB>& mm,
const SM<SCAL, MATC>& sm) {
467 return SMMpSM<SCAL, MATC, MATA, MATB>
468 (mm.A, mm.B, sm.A, mm.tA, mm.tB, 1, sm.alpha);
473 template<
class SCAL,
class MAT>
479 SM2pSM(
const MAT& AA,
const MAT& CC,
const SCAL a = 1,
const SCAL b = 0)
480 :
A(AA), alpha(a), C(CC), beta(b)
484 template<
class SCAL,
class MAT>
485 inline SM2pSM<SCAL, MAT>
486 operator+(
const SM2<SCAL, MAT>& sm2,
const SM<SCAL, MAT> sm) {
487 return SM2pSM<SCAL, MAT>(sm2.A, sm.A, sm2.alpha, sm.alpha);
499 MMpM(
const MAT& AA,
const MAT& BB,
const MAT& CC)
505 template<
class SCAL,
class MAT>
507 const SCAL alpha, beta;
509 SMpSM(
const MAT& AA,
const MAT& BB,
510 const SCAL scalar_a=1,
const SCAL scalar_b=1)
511 :
A(AA),
B(BB), alpha(scalar_a), beta(scalar_b)
515 template<
class SCAL,
class MAT>
516 inline SMpSM<SCAL, MAT>
517 operator+(
const SM<SCAL, MAT> sm1,
const SM<SCAL, MAT> sm2 ) {
518 return SMpSM<SCAL, MAT>(sm1.A, sm2.A, sm1.alpha, sm2.alpha);
540 MmM(
const MAT& AA,
const MAT& BB)
546 inline MmM<MAT>
operator-(
const MAT& A,
const MAT& B) {
547 return MmM<MAT>(A,B);