1 #ifndef SimTK_SIMMATRIX_SMALLMATRIX_MAT_H_ 2 #define SimTK_SIMMATRIX_SMALLMATRIX_MAT_H_ 97 template <
int M,
int N,
class ELT,
int CS,
int RS>
class Mat {
129 MaxDim = N > M ? N : M,
197 static int size() {
return M*N; }
200 static int nrow() {
return M; }
203 static int ncol() {
return N; }
212 for(
int j=0;j<N;++j) sum += CNT<TCol>::scalarNormSqr((*this)(j));
221 for(
int j=0;j<N;++j) msqrt(j) = (*this)(j).
sqrt();
230 for(
int j=0;j<N;++j) mabs(j) = (*this)(j).
abs();
236 for(
int j=0;j<N;++j) mstd(j) = (*this)(j).
standardize();
257 typedef typename MulOp::Type
Mul;
260 CNT<P>::NRows, CNT<P>::NCols, CNT<P>::ArgDepth,
262 typedef typename MulOpNonConforming::Type
MulNon;
265 CNT<P>::NRows, CNT<P>::NCols, CNT<P>::ArgDepth,
267 typedef typename DvdOp::Type
Dvd;
270 CNT<P>::NRows, CNT<P>::NCols, CNT<P>::ArgDepth,
272 typedef typename AddOp::Type
Add;
275 CNT<P>::NRows, CNT<P>::NCols, CNT<P>::ArgDepth,
277 typedef typename SubOp::Type
Sub;
300 for (
int j=0; j<N; ++j)
307 for (
int j=0; j<N; ++j)
318 for (
int j = 0; j < M; ++j)
319 for (
int i = j+1; i < M; ++i) {
329 template <
int CSS,
int RSS>
331 for (
int j=0; j<N; ++j)
340 template <
int CSS,
int RSS>
342 for (
int j=0; j<N; ++j)
353 template <
class EE,
int CSS,
int RSS>
355 {
for (
int j=0;j<N;++j) (*
this)(j) = mm(j);}
361 {
for (
int j=0;j<N;++j) (*
this)(j) =
E(0);
diag()=e; }
367 explicit Mat(
const ENeg& e)
368 {
for (
int j=0;j<N;++j) (*
this)(j) =
E(0);
diag()=e; }
380 Mat(
const E& e0,
const E& e1)
381 {assert(M*N==2);d[rIx(0)]=e0;d[rIx(1)]=e1;}
382 Mat(
const E& e0,
const E& e1,
const E& e2)
383 {assert(M*N==3);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;}
384 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3)
385 {assert(M*N==4);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;}
386 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4)
387 {assert(M*N==5);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;}
388 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
390 {assert(M*N==6);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
392 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
393 const E& e5,
const E& e6)
394 {assert(M*N==7);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
395 d[rIx(5)]=e5;d[rIx(6)]=e6;}
396 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
397 const E& e5,
const E& e6,
const E& e7)
398 {assert(M*N==8);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
399 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;}
400 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
401 const E& e5,
const E& e6,
const E& e7,
const E& e8)
402 {assert(M*N==9);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
403 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;}
404 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
405 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9)
406 {assert(M*N==10);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
407 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;}
408 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
409 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9,
411 {assert(M*N==11);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
412 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;d[rIx(10)]=e10;}
413 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
414 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9,
415 const E& e10,
const E& e11)
416 {assert(M*N==12);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
417 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;d[rIx(10)]=e10;
419 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
420 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9,
421 const E& e10,
const E& e11,
const E& e12)
422 {assert(M*N==13);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
423 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;d[rIx(10)]=e10;
424 d[rIx(11)]=e11;d[rIx(12)]=e12;}
425 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
426 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9,
427 const E& e10,
const E& e11,
const E& e12,
const E& e13)
428 {assert(M*N==14);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
429 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;d[rIx(10)]=e10;
430 d[rIx(11)]=e11;d[rIx(12)]=e12;d[rIx(13)]=e13;}
431 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
432 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9,
433 const E& e10,
const E& e11,
const E& e12,
const E& e13,
const E& e14)
434 {assert(M*N==15);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
435 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;d[rIx(10)]=e10;
436 d[rIx(11)]=e11;d[rIx(12)]=e12;d[rIx(13)]=e13;d[rIx(14)]=e14;}
437 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
438 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9,
439 const E& e10,
const E& e11,
const E& e12,
const E& e13,
const E& e14,
441 {assert(M*N==16);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
442 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;d[rIx(10)]=e10;
443 d[rIx(11)]=e11;d[rIx(12)]=e12;d[rIx(13)]=e13;d[rIx(14)]=e14;d[rIx(15)]=e15;}
446 explicit Mat(
const TRow& r0)
447 { assert(M==1); (*this)[0]=r0; }
448 Mat(
const TRow& r0,
const TRow& r1)
449 { assert(M==2);(*this)[0]=r0;(*this)[1]=r1; }
450 Mat(
const TRow& r0,
const TRow& r1,
const TRow& r2)
451 { assert(M==3);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2; }
452 Mat(
const TRow& r0,
const TRow& r1,
const TRow& r2,
454 { assert(M==4);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;(*this)[3]=r3; }
455 Mat(
const TRow& r0,
const TRow& r1,
const TRow& r2,
456 const TRow& r3,
const TRow& r4)
457 { assert(M==5);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;
458 (*this)[3]=r3;(*this)[4]=r4; }
459 Mat(
const TRow& r0,
const TRow& r1,
const TRow& r2,
460 const TRow& r3,
const TRow& r4,
const TRow& r5)
461 { assert(M==6);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;
462 (*this)[3]=r3;(*this)[4]=r4;(*this)[5]=r5; }
466 { assert(M==1); (*this)[0]=r0; }
468 { assert(M==2);(*this)[0]=r0;(*this)[1]=r1; }
469 template <
class EE,
int SS>
471 { assert(M==3);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2; }
472 template <
class EE,
int SS>
475 { assert(M==4);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;(*this)[3]=r3; }
476 template <
class EE,
int SS>
479 { assert(M==5);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;
480 (*this)[3]=r3;(*this)[4]=r4; }
481 template <
class EE,
int SS>
484 { assert(M==6);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;
485 (*this)[3]=r3;(*this)[4]=r4;(*this)[5]=r5; }
489 explicit Mat(
const TCol& r0)
490 { assert(N==1); (*this)(0)=r0; }
491 Mat(
const TCol& r0,
const TCol& r1)
492 { assert(N==2);(*this)(0)=r0;(*this)(1)=r1; }
493 Mat(
const TCol& r0,
const TCol& r1,
const TCol& r2)
494 { assert(N==3);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2; }
495 Mat(
const TCol& r0,
const TCol& r1,
const TCol& r2,
497 { assert(N==4);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;(*this)(3)=r3; }
498 Mat(
const TCol& r0,
const TCol& r1,
const TCol& r2,
499 const TCol& r3,
const TCol& r4)
500 { assert(N==5);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;
501 (*this)(3)=r3;(*this)(4)=r4; }
502 Mat(
const TCol& r0,
const TCol& r1,
const TCol& r2,
503 const TCol& r3,
const TCol& r4,
const TCol& r5)
504 { assert(N==6);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;
505 (*this)(3)=r3;(*this)(4)=r4;(*this)(5)=r5; }
509 { assert(N==1); (*this)(0)=r0; }
511 { assert(N==2);(*this)(0)=r0;(*this)(1)=r1; }
512 template <
class EE,
int SS>
514 { assert(N==3);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2; }
515 template <
class EE,
int SS>
518 { assert(N==4);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;(*this)(3)=r3; }
519 template <
class EE,
int SS>
522 { assert(N==5);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;
523 (*this)(3)=r3;(*this)(4)=r4; }
524 template <
class EE,
int SS>
527 { assert(N==6);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;
528 (*this)(3)=r3;(*this)(4)=r4;(*this)(5)=r5; }
532 template <
class EE>
explicit Mat(
const EE* p)
533 { assert(p);
for(
int i=0;i<M;++i) (*
this)[i]=&p[i*N]; }
539 for (
int j=0; j<N; ++j) (*
this)(j) = mm(j);
544 assert(p);
for(
int i=0;i<M;++i) (*
this)[i]=&p[i*N];
549 template <
class EE,
int CSS,
int RSS>
Mat&
551 for (
int j=0; j<N; ++j) (*
this)(j) += mm(j);
554 template <
class EE,
int CSS,
int RSS>
Mat&
556 for (
int j=0; j<N; ++j) (*
this)(j) -= -(mm(j));
560 template <
class EE,
int CSS,
int RSS>
Mat&
562 for (
int j=0; j<N; ++j) (*
this)(j) -= mm(j);
565 template <
class EE,
int CSS,
int RSS>
Mat&
567 for (
int j=0; j<N; ++j) (*
this)(j) += -(mm(j));
573 template <
class EE,
int CSS,
int RSS>
Mat&
576 for (
int j=0; j<N; ++j)
577 for (
int i=0; i<M; ++i)
578 (*
this)(i,j) = t[i] * mm(j);
586 template <
class E2,
int CS2,
int RS2>
587 typename Result<Mat<M,N,E2,CS2,RS2> >
::Add 589 typename Result<Mat<M,N,E2,CS2,RS2> >
::Add result;
590 for (
int j=0;j<N;++j) result(j) = (*this)(j) + r(j);
594 template <
class E2,
int CS2,
int RS2>
595 typename Result<Mat<M,N,E2,CS2,RS2> >
::Sub 597 typename Result<Mat<M,N,E2,CS2,RS2> >
::Sub result;
598 for (
int j=0;j<N;++j) result(j) = (*this)(j) - r(j);
602 template <
class E2,
int CS2,
int RS2>
605 return l.conformingSubtract(*
this);
609 template <
class E2,
int CS2,
int RS2>
613 for (
int j=0;j<N;++j)
619 template <
class E2,
int CS2,
int RS2>
623 for (
int j=0;j<N;++j)
630 template <
class E2,
int RS2>
631 typename Result<SymMat<M,E2,RS2> >
::Add 637 template <
class E2,
int RS2>
638 typename Result<SymMat<M,E2,RS2> >
::Sub 641 return sy.conformingSubtractFromLeft(*
this);
644 template <
class E2,
int RS2>
652 template <
int N2,
class E2,
int CS2,
int RS2>
653 typename Result<Mat<N,N2,E2,CS2,RS2> >
::Mul 655 typename Result<Mat<N,N2,E2,CS2,RS2> >
::Mul result;
656 for (
int j=0;j<N2;++j)
657 for (
int i=0;i<M;++i)
658 result(i,j) = (*this)[i].conformingMultiply(m(j));
662 template <
int M2,
class E2,
int CS2,
int RS2>
665 return m.conformingMultiply(*
this);
669 template <
int M2,
class E2,
int CS2,
int RS2>
670 typename Result<Mat<M2,N,E2,CS2,RS2> >
::Dvd 675 template <
int M2,
class E2,
int CS2,
int RS2>
678 return m.conformingMultiply((*this).invert());
711 TNormalize elementwiseNormalized;
713 for (
int j=0; j<N; ++j)
714 elementwiseNormalized(j) = (*this)(j).
normalize();
715 return elementwiseNormalized;
729 const TNeg&
negate()
const {
return *
reinterpret_cast<const TNeg*
>(
this); }
730 TNeg&
updNegate() {
return *
reinterpret_cast<TNeg*
>(
this); }
732 const THerm&
transpose()
const {
return *
reinterpret_cast<const THerm*
>(
this); }
736 {
return *
reinterpret_cast<const TPosTrans*
>(
this); }
738 {
return *
reinterpret_cast<TPosTrans*
>(
this); }
756 const Precision* p =
reinterpret_cast<const Precision*
>(
this);
757 return *
reinterpret_cast<const TImag*
>(p+offs);
761 Precision* p =
reinterpret_cast<Precision*
>(
this);
762 return *
reinterpret_cast<TImag*
>(p+offs);
768 const TRow&
row(
int i)
const {
770 return *
reinterpret_cast<const TRow*
>(&d[i*RS]);
774 return *
reinterpret_cast<TRow*
>(&d[i*RS]);
777 const TCol&
col(
int j)
const {
779 return *
reinterpret_cast<const TCol*
>(&d[j*CS]);
783 return *
reinterpret_cast<TCol*
>(&d[j*CS]);
786 const E&
elt(
int i,
int j)
const {
800 const TDiag&
diag()
const {
return *
reinterpret_cast<const TDiag*
>(d); }
804 TDiag&
updDiag() {
return *
reinterpret_cast<TDiag*
>(d); }
807 TDiag&
diag() {
return *
reinterpret_cast<TDiag*
>(d); }
836 for (
int j=0; j<N; ++j) result(j) = (*this)(j).
scalarDivide(e);
881 {
for(
int j=0; j<N; ++j) (*
this)(j).
scalarEq(EE(0));
895 {
for(
int j=0; j<N; ++j) (*
this)(j).
scalarTimesEq(ee);
return *
this; }
900 {
for(
int j=0; j<N; ++j) (*
this)(j).
scalarDivideEq(ee);
return *
this; }
905 for (
int j=0; j<N; ++j)
910 for (
int j=0; j<N; ++j)
917 template <
int MM,
int NN>
struct SubMat {
921 template <
int MM,
int NN>
923 assert(0 <= i && i + MM <= M);
924 assert(0 <= j && j + NN <= N);
927 template <
int MM,
int NN>
929 assert(0 <= i && i + MM <= M);
930 assert(0 <= j && j + NN <= N);
933 template <
int MM,
int NN>
935 assert(0 <= i && i + MM <= M);
936 assert(0 <= j && j + NN <= N);
943 assert(0 <= i && i < M);
945 for (
int r=0, nxt=0; r<M-1; ++r, ++nxt) {
947 out[r] = (*this)[nxt];
955 assert(0 <= j && j < N);
957 for (
int c=0, nxt=0; c<N-1; ++c, ++nxt) {
959 out(c) = (*this)(nxt);
968 assert(0 <= i && i < M);
969 assert(0 <= j && j < N);
971 for (
int c=0, nxtc=0; c<N-1; ++c, ++nxtc) {
973 for (
int r=0, nxtr=0; r<M-1; ++r, ++nxtr) {
975 out(r,c) = (*this)(nxtr,nxtc);
984 template <
class EE,
int SS>
987 out.template updSubMat<M,N>(0,0) = (*
this);
995 template <
class EE,
int SS>
998 out.template updSubMat<M,N>(0,0) = (*
this);
1009 template <
class ER,
int SR,
class EC,
int SC>
1014 out.template updSubMat<M,N>(0,0) = (*
this);
1015 out[M].template updSubRow<N>(0) =
1016 row.template getSubRow<N>(0);
1026 template <
class EE,
int SS>
1028 assert(0 <= i && i <= M);
1031 for (
int r=0, nxt=0; r<M; ++r, ++nxt) {
1032 if (nxt==i) out[nxt++] =
row;
1033 out[nxt] = (*this)[r];
1043 template <
class EE,
int SS>
1045 assert(0 <= j && j <= N);
1048 for (
int c=0, nxt=0; c<N; ++c, ++nxt) {
1049 if (nxt==j) out(nxt++) =
col;
1050 out(nxt) = (*this)(c);
1062 template <
class ER,
int SR,
class EC,
int SC>
1065 assert(0 <= i && i <= M);
1066 assert(0 <= j && j <= N);
1068 for (
int c=0, nxtc=0; c<N; ++c, ++nxtc) {
1069 if (nxtc==j) ++nxtc;
1070 for (
int r=0, nxtr=0; r<M; ++r, ++nxtr) {
1071 if (nxtr==i) ++nxtr;
1072 out(nxtr,nxtc) = (*this)(r,c);
1081 static const Mat&
getAs(
const ELT* p) {
return *
reinterpret_cast<const Mat*
>(p);}
1093 for (
int j=0; j<N; ++j)
1102 bool seenInf =
false;
1103 for (
int j=0; j<N; ++j) {
1115 for (
int j=0; j<N; ++j)
1127 template <
class E2,
int CS2,
int RS2>
1129 for (
int j=0; j < N; ++j)
1138 template <
class E2,
int CS2,
int RS2>
1153 for (
int i=0; i<M; ++i)
1154 for (
int j=0; j<N; ++j) {
1175 if (M != N)
return false;
1176 for (
int j=0; j<M; ++j)
1177 for (
int i=j; i<M; ++i)
1190 if (M != N)
return false;
1191 for (
int j=0; j<M; ++j)
1192 for (
int i=j; i<M; ++i)
1201 for (
int j = 0; j < N; ++j)
1212 for (
int i = 0; i < M; ++i)
1220 std::stringstream stream;
1222 return stream.str();
1225 const ELT&
get(
int i,
int j)
const {
return elt(i,j); }
1227 void set(
int i,
int j,
const ELT& value) {
elt(i,j)=value; }
1236 int rIx(
int k)
const {
1237 const int row = k / N;
1238 const int col = k % N;
1239 return row*RS + col*CS;
1248 template <
int M,
int N,
class EL,
int CSL,
int RSL,
class ER,
int CSR,
int RSR>
inline 1252 ::AddOp::perform(l,r);
1255 template <
int M,
int N,
class EL,
int CSL,
int RSL,
class ER,
int CSR,
int RSR>
inline 1259 ::SubOp::perform(l,r);
1263 template <
int M,
int N,
class EL,
int CSL,
int RSL,
int P,
class ER,
int CSR,
int RSR>
inline 1267 ::MulOp::perform(l,r);
1272 template <
int M,
int N,
class EL,
int CSL,
int RSL,
int MM,
int NN,
class ER,
int CSR,
int RSR>
inline 1276 ::MulOpNonConforming::perform(l,r);
1279 template <
int M,
int N,
class EL,
int CSL,
int RSL,
class ER,
int CSR,
int RSR>
inline 1281 for (
int j=0; j<N; ++j)
1282 if (l(j) != r(j))
return false;
1285 template <
int M,
int N,
class EL,
int CSL,
int RSL,
class ER,
int CSR,
int RSR>
inline 1298 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1302 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1306 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1310 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1315 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1318 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1325 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1329 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1334 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1337 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1342 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1345 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1357 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1362 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1365 {
return l * r.invert(); }
1367 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1372 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1375 {
return l * r.invert(); }
1378 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1383 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1392 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1396 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1399 {
return CNT<std::complex<R> >::template Result<Mat<M,N,E,CS,RS> >::DvdOp::perform(l,r); }
1402 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1405 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1410 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1413 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1425 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1429 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1433 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1437 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1442 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1445 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1452 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1456 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1461 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1464 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1469 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1472 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1479 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1483 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1488 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1492 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1498 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1501 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1509 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1513 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1516 {
return CNT<std::complex<R> >::template Result<Mat<M,N,E,CS,RS> >::SubOp::perform(l,r); }
1519 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1522 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1527 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1530 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1536 template <
int M,
int N,
class E,
int CS,
int RS,
class CHAR,
class TRAITS>
inline 1537 std::basic_ostream<CHAR,TRAITS>&
1539 for (
int i=0;i<M;++i) {
1540 o << std::endl <<
"[";
1541 for (
int j=0;j<N;++j)
1542 o << (j>0?
",":
"") << m(i,j);
1545 if (M) o << std::endl;
1549 template <
int M,
int N,
class E,
int CS,
int RS,
class CHAR,
class TRAITS>
inline 1550 std::basic_istream<CHAR,TRAITS>&
1560 #endif //SimTK_SIMMATRIX_SMALLMATRIX_MAT_H_ EltResult< E2 >::Dvd elementwiseDivide(const Mat< M, N, E2, CS2, RS2 > &r) const
Definition: Mat.h:621
CNT< E >::TNormalize ENormalize
Definition: Mat.h:114
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9, const E &e10)
Definition: Mat.h:408
Matrix_< E > operator/(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:613
TAbs abs() const
Elementwise absolute value; that is, the return value has the same dimensions as this Mat but with ea...
Definition: Mat.h:228
bool isFinite() const
Return true if no element contains an Infinity or a NaN.
Definition: Mat.h:1114
Mat & operator=(const EE *p)
Definition: Mat.h:543
Mat & scalarDivideEq(const EE &ee)
Definition: Mat.h:899
Mat(const TRow &r0)
Definition: Mat.h:446
SymMat< M, E2, RS2 >::template Result< Mat >::Sub conformingSubtractFromLeft(const SymMat< M, E2, RS2 > &sy) const
Definition: Mat.h:646
CNT< E >::TStandard EStandard
Definition: Mat.h:112
K::ScalarNormSq ScalarNormSq
Definition: CompositeNumericalTypes.h:166
Mat(const TCol &r0, const TCol &r1, const TCol &r2, const TCol &r3)
Definition: Mat.h:495
Mat & scalarTimesEq(const EE &ee)
Definition: Mat.h:894
K::ULessScalar ULessScalar
Definition: CompositeNumericalTypes.h:161
Mat(const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1, const Row< N, EE, SS > &r2, const Row< N, EE, SS > &r3, const Row< N, EE, SS > &r4)
Definition: Mat.h:477
Mat< M, N, typename CNT< E >::template Result< EE >::Add > scalarAdd(const EE &e) const
Definition: Mat.h:848
Mat< M+1, N+1, E, M+1, 1 > TAppendRowCol
Definition: Mat.h:185
Mat< M, N, typename CNT< EE >::template Result< E >::Dvd > scalarDivideFromLeft(const EE &e) const
Definition: Mat.h:840
Mat & operator/=(const EE &e)
Definition: Mat.h:876
K::TReal TReal
Definition: CompositeNumericalTypes.h:141
EScalar Scalar
Definition: Mat.h:187
TStandard standardize() const
Definition: Mat.h:234
TDiag & diag()
This non-const version of diag() is an alternate name for updDiag() available for historical reasons...
Definition: Mat.h:807
Mat(const TRow &r0, const TRow &r1, const TRow &r2, const TRow &r3, const TRow &r4)
Definition: Mat.h:455
MulCNTs< M, N, ArgDepth, Mat, ColSpacing, RowSpacing, CNT< P >::NRows, CNT< P >::NCols, CNT< P >::ArgDepth, P, CNT< P >::ColSpacing, CNT< P >::RowSpacing > MulOp
Definition: Mat.h:256
This is a small, fixed-size symmetric or Hermitian matrix designed for no-overhead inline computation...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:621
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9, const E &e10, const E &e11, const E &e12, const E &e13)
Definition: Mat.h:425
bool isInf() const
Return true if any element of this Mat contains a +Inf or -Inf somewhere but no element contains a Na...
Definition: Mat.h:1101
void setToZero()
Definition: Mat.h:909
CNT< E >::StdNumber EStdNumber
Definition: Mat.h:119
Vec & scalarEq(const EE &ee)
Definition: Vec.h:783
Mat(int i)
Explicit construction from an int value means we convert the int into an object of this Mat's element...
Definition: Mat.h:376
Mat< M, N, ENeg, CS, RS > TNeg
Definition: Mat.h:151
TRow sum() const
This is an alternate name for colSum(); behaves like the Matlab function of the same name...
Definition: Mat.h:1207
CNT< E >::ULessScalar EULessScalar
Definition: Mat.h:117
Mat< M, N, ENormalize, M, 1 > TNormalize
Definition: Mat.h:172
Mat< M, N+1, E, M, 1 > TAppendCol
Definition: Mat.h:184
Mat(const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1, const Row< N, EE, SS > &r2, const Row< N, EE, SS > &r3)
Definition: Mat.h:473
Mat(const EE *p)
Definition: Mat.h:532
Vec< MinDim, E, RS+CS > TDiag
Definition: Mat.h:164
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
Mat(const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1, const Vec< M, EE, SS > &r2, const Vec< M, EE, SS > &r3, const Vec< M, EE, SS > &r4, const Vec< M, EE, SS > &r5)
Definition: Mat.h:525
NTraits< N >::StdNumber StdNumber
Definition: negator.h:107
SimTK::conjugate<R> should be instantiated only for float, double.
Definition: String.h:45
K::TSqrt TSqrt
Definition: CompositeNumericalTypes.h:154
TReal & real()
Definition: Mat.h:745
static TSqrt sqrt(const K &t)
Definition: CompositeNumericalTypes.h:239
Mat< M+1, N, E, M+1, 1 > TAppendRow
Definition: Mat.h:183
static int nrow()
Return the number of rows in this Mat, echoing the value supplied for the template parameter M...
Definition: Mat.h:200
CNT< E >::TNeg ENeg
Definition: Mat.h:100
Mat & operator*=(const EE &e)
Definition: Mat.h:875
Mat< M, N, typename CNT< E >::template Result< EE >::Sub > scalarSubtract(const EE &e) const
Definition: Mat.h:856
Mat & operator=(const Mat< M, N, EE, CSS, RSS > &mm)
Definition: Mat.h:538
K::Scalar Scalar
Definition: CompositeNumericalTypes.h:160
EStdNumber StdNumber
Definition: Mat.h:190
static const Mat & getAs(const ELT *p)
Definition: Mat.h:1081
K::TNormalize TNormalize
Definition: CompositeNumericalTypes.h:158
Mat(const Row< N, EE, SS > &r0)
Definition: Mat.h:465
CNT< E >::TSqHermT ESqHermT
Definition: Mat.h:107
const THerm & transpose() const
Definition: Mat.h:732
DvdOp::Type Dvd
Definition: Mat.h:267
MulOp::Type Mul
Definition: Mat.h:257
Mat(const E &e0, const E &e1)
Definition: Mat.h:380
CNT< E >::TWithoutNegator EWithoutNegator
Definition: Mat.h:101
const TCol & col(int j) const
Definition: Mat.h:777
TRow colSum() const
Returns a row vector (Row) containing the column sums of this matrix.
Definition: Mat.h:1199
Result< Mat< M, N, E2, CS2, RS2 > >::Sub conformingSubtract(const Mat< M, N, E2, CS2, RS2 > &r) const
Definition: Mat.h:596
TRow & operator[](int i)
Definition: Mat.h:682
K::TImag TImag
Definition: CompositeNumericalTypes.h:142
Mat(const SymMat< M, ELT > &src)
Explicit construction of a Mat from a SymMat (symmetric/Hermitian matrix).
Definition: Mat.h:316
Mat(const Mat< M, N, ENeg, CSS, RSS > &src)
This provides an implicit conversion from a Mat of the same dimensions and negated element type...
Definition: Mat.h:341
const TCol & operator()(int j) const
Definition: Mat.h:683
Mat()
Default construction initializes to NaN when debugging but is left uninitialized otherwise to ensure ...
Definition: Mat.h:287
E & operator()(int i, int j)
Definition: Mat.h:687
EStandard sum() const
Sum just adds up all the elements into a single return element that is the same type as this Vec's el...
Definition: Vec.h:366
AddCNTs< M, N, ArgDepth, Mat, ColSpacing, RowSpacing, CNT< P >::NRows, CNT< P >::NCols, CNT< P >::ArgDepth, P, CNT< P >::ColSpacing, CNT< P >::RowSpacing > AddOp
Definition: Mat.h:271
Mat< M, N, E, M, 1 > TPacked
Definition: Mat.h:179
std::basic_istream< CHAR, TRAITS > & operator>>(std::basic_istream< CHAR, TRAITS > &is, conjugate< R > &c)
Definition: conjugate.h:505
CNT< E >::ScalarNormSq EScalarNormSq
Definition: Mat.h:121
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9, const E &e10, const E &e11, const E &e12)
Definition: Mat.h:419
Result< Mat< M, N, E2, CS2, RS2 > >::Add conformingAdd(const Mat< M, N, E2, CS2, RS2 > &r) const
Definition: Mat.h:588
negator<N>, where N is a number type (real, complex, conjugate), is represented in memory identically...
Definition: String.h:44
Mat(const E &e)
Explicit construction from a single element e of this Mat's element type E sets all the main diagonal...
Definition: Mat.h:360
Definition: CompositeNumericalTypes.h:120
Mat< M, N, ESqrt, M, 1 > TSqrt
Definition: Mat.h:168
TWithoutNegator & updCastAwayNegatorIfAny()
Definition: Mat.h:766
const EHerm & getEltUpper(int i, int j) const
Definition: SymMat.h:842
static double getDefaultTolerance()
Definition: CompositeNumericalTypes.h:269
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5)
Definition: Mat.h:388
Mat< M, N, EStandard, M, 1 > TStandard
Definition: Mat.h:170
bool operator==(const PhiMatrix &p1, const PhiMatrix &p2)
Definition: SpatialAlgebra.h:791
THerm TransposeType
Definition: Mat.h:194
Mat< M, N, EImag, CS *CNT< E >::RealStrideFactor, RS *CNT< E >::RealStrideFactor > TImag
Definition: Mat.h:157
TDiag & updDiag()
Select main diagonal (of largest leading square if rectangular) and return it as a writable view (as ...
Definition: Mat.h:804
Mat< M, N, typename CNT< EE >::template Result< E >::Mul > scalarMultiplyFromLeft(const EE &e) const
Definition: Mat.h:825
Mat< M, N, P > Type
Definition: Mat.h:282
Mat< M2, N, E2, CS2, RS2 >::template Result< Mat >::Dvd conformingDivideFromLeft(const Mat< M2, N, E2, CS2, RS2 > &m) const
Definition: Mat.h:677
Mat(const Mat< M, N, EE, CSS, RSS > &mm)
Explicit construction of a Mat from a source Mat of the same dimensions and an assignment-compatible ...
Definition: Mat.h:354
const TNeg & negate() const
Definition: Mat.h:729
Mat< M, N, EReal, CS *CNT< E >::RealStrideFactor, RS *CNT< E >::RealStrideFactor > TReal
Definition: Mat.h:155
Mat< M, N, typename CNT< EE >::template Result< E >::Sub > scalarSubtractFromLeft(const EE &e) const
Definition: Mat.h:863
static int size()
Return the total number of elements M*N contained in this Mat.
Definition: Mat.h:197
const E & getEltLower(int i, int j) const
Definition: SymMat.h:838
TAppendRow insertRow(int i, const Row< N, EE, SS > &row) const
Return a matrix one row larger than this one by inserting a row before row i.
Definition: Mat.h:1027
Vec & scalarPlusEq(const EE &ee)
Definition: Vec.h:785
Mat & operator+=(const EE &e)
Definition: Mat.h:873
Mat(const ENeg &e)
Explicit construction from a single element e whose type is negator<E> (abbreviated ENeg here) where ...
Definition: Mat.h:367
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9, const E &e10, const E &e11, const E &e12, const E &e13, const E &e14, const E &e15)
Definition: Mat.h:437
TDropCol dropCol(int j) const
Return a matrix one column smaller than this one by dropping column j.
Definition: Mat.h:954
TCol & operator()(int j)
Definition: Mat.h:684
K::TSqTHerm TSqTHerm
Definition: CompositeNumericalTypes.h:147
const TRow & operator[](int i) const
Definition: Mat.h:681
ENumber Number
Definition: Mat.h:189
Mat< M-1, N-1, E, M-1, 1 > TDropRowCol
Definition: Mat.h:182
TNormalize normalize() const
Definition: Mat.h:707
Mat(const TRow &r0, const TRow &r1, const TRow &r2, const TRow &r3, const TRow &r4, const TRow &r5)
Definition: Mat.h:459
bool isNumericallySymmetric(double tol=getDefaultTolerance()) const
A Matrix is symmetric (actually Hermitian) if it is square and each element (i,j) is the Hermitian tr...
Definition: Mat.h:1174
bool isNumericallyEqual(const Mat< M, N, E2, CS2, RS2 > &m, double tol) const
Test whether this matrix is numerically equal to some other matrix with the same shape, using a specified tolerance.
Definition: Mat.h:1128
static int ncol()
Return the number of columns in this Mat, echoing the value supplied for the template parameter N...
Definition: Mat.h:203
This is a fixed-length column vector designed for no-overhead inline computation. ...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:618
TInvert invert() const
Definition: SmallMatrixMixed.h:1004
TImag & imag()
Definition: Mat.h:759
TAppendCol appendCol(const Vec< M, EE, SS > &col) const
Return a matrix one column larger than this one by adding a column to the end.
Definition: Mat.h:996
Mat(const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1, const Vec< M, EE, SS > &r2, const Vec< M, EE, SS > &r3, const Vec< M, EE, SS > &r4)
Definition: Mat.h:520
TCol rowSum() const
Returns a column vector (Vec) containing the row sums of this matrix.
Definition: Mat.h:1210
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9)
Definition: Mat.h:404
TAppendRowCol appendRowCol(const Row< N+1, ER, SR > &row, const Vec< M+1, EC, SC > &col) const
Return a matrix one row and one column larger than this one by adding a row to the bottom and a colum...
Definition: Mat.h:1010
const TRow & row(int i) const
Definition: Mat.h:768
K::Precision Precision
Definition: CompositeNumericalTypes.h:164
EltResult< E2 >::Mul elementwiseMultiply(const Mat< M, N, E2, CS2, RS2 > &r) const
Definition: Mat.h:611
CNT< E >::TReal EReal
Definition: Mat.h:102
Mat & scalarEq(const EE &ee)
Definition: Mat.h:880
Matrix_< E > operator*(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:605
TDropRowCol dropRowCol(int i, int j) const
Return a matrix one row and one column smaller than this one by dropping row i and column j...
Definition: Mat.h:967
ELT E
Definition: Mat.h:99
Mat(const TCol &r0)
Definition: Mat.h:489
K::TInvert TInvert
Definition: CompositeNumericalTypes.h:157
Mat< MM, NN, ELT, CS, RS > Type
Definition: Mat.h:918
CNT< E >::TSqTHerm ESqTHerm
Definition: Mat.h:108
Mat< M, N, typename CNT< E >::template Result< P >::Sub, M, 1 > Sub
Definition: Mat.h:248
Mat(const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1, const Vec< M, EE, SS > &r2, const Vec< M, EE, SS > &r3)
Definition: Mat.h:516
Mat & operator*=(const Mat< N, N, EE, CSS, RSS > &mm)
Definition: Mat.h:574
THerm & operator~()
Definition: Mat.h:727
ELEM max(const VectorBase< ELEM > &v)
Definition: VectorMath.h:251
EScalarNormSq ScalarNormSq
Definition: Mat.h:192
Mat & operator-=(const Mat< M, N, negator< EE >, CSS, RSS > &mm)
Definition: Mat.h:566
const TNeg & operator-() const
Definition: Mat.h:724
const SubMat< MM, NN >::Type & getSubMat(int i, int j) const
Definition: Mat.h:922
Mat(const TCol &r0, const TCol &r1, const TCol &r2)
Definition: Mat.h:493
Result< SymMat< M, E2, RS2 > >::Sub conformingSubtract(const SymMat< M, E2, RS2 > &sy) const
Definition: Mat.h:639
SubOp::Type Sub
Definition: Mat.h:277
TAppendCol insertCol(int j, const Vec< M, EE, SS > &col) const
Return a matrix one column larger than this one by inserting a column before column j...
Definition: Mat.h:1044
Mat & scalarDivideEqFromLeft(const EE &ee)
Definition: Mat.h:901
Mat(const E &e0, const E &e1, const E &e2, const E &e3)
Definition: Mat.h:384
K::TPosTrans TPosTrans
Definition: CompositeNumericalTypes.h:145
Mat(const TRow &r0, const TRow &r1, const TRow &r2, const TRow &r3)
Definition: Mat.h:452
Vec< M, typename CNT< E >::template Result< EE >::Add > scalarAdd(const EE &e) const
Definition: Vec.h:752
Mat(const E &e0, const E &e1, const E &e2)
Definition: Mat.h:382
TAppendRow appendRow(const Row< N, EE, SS > &row) const
Return a matrix one row larger than this one by adding a row to the end.
Definition: Mat.h:985
Mat< M, N, E2, CS2, RS2 >::template Result< Mat >::Sub conformingSubtractFromLeft(const Mat< M, N, E2, CS2, RS2 > &l) const
Definition: Mat.h:604
bool isExactlySymmetric() const
A Matrix is symmetric (actually Hermitian) if it is square and each element (i,j) is the Hermitian (c...
Definition: Mat.h:1189
void setToNaN()
Definition: Mat.h:904
Mat< M, N, typename CNT< E >::template Result< EE >::Mul > scalarMultiply(const EE &e) const
Definition: Mat.h:819
Result< SymMat< M, E2, RS2 > >::Sub conformingSubtract(const SymMat< M, E2, RS2 > &r) const
Definition: SymMat.h:519
Mat(const TRow &r0, const TRow &r1)
Definition: Mat.h:448
static Mat< M, N, ELT, M, 1 > getNaN()
Definition: Mat.h:1085
Mat & operator+=(const Mat< M, N, EE, CSS, RSS > &mm)
Definition: Mat.h:550
ScalarNormSq normSqr() const
Definition: Mat.h:690
const E & elt(int i, int j) const
Definition: Mat.h:786
TSqrt sqrt() const
Elementwise square root; that is, the return value has the same dimensions as this Mat but with each ...
Definition: Mat.h:219
MulCNTsNonConforming< M, N, ArgDepth, Mat, ColSpacing, RowSpacing, CNT< P >::NRows, CNT< P >::NCols, CNT< P >::ArgDepth, P, CNT< P >::ColSpacing, CNT< P >::RowSpacing > MulOpNonConforming
Definition: Mat.h:261
bool isNumericallyEqual(const Mat< M, N, E2, CS2, RS2 > &m) const
Test whether this matrix is numerically equal to some other matrix with the same shape, using a default tolerance which is the looser of the default tolerances of the two objects being compared.
Definition: Mat.h:1139
K::StdNumber StdNumber
Definition: CompositeNumericalTypes.h:163
CNT< E >::THerm EHerm
Definition: Mat.h:105
bool isNaN() const
Return true if any element of this Mat contains a NaN anywhere.
Definition: Mat.h:1092
void setSubMat(int i, int j, const typename SubMat< MM, NN >::Type &value)
Definition: Mat.h:934
DvdCNTs< M, N, ArgDepth, Mat, ColSpacing, RowSpacing, CNT< P >::NRows, CNT< P >::NCols, CNT< P >::ArgDepth, P, CNT< P >::ColSpacing, CNT< P >::RowSpacing > DvdOp
Definition: Mat.h:266
SymMat< N, ESqHermT > TSqHermT
Definition: Mat.h:174
const TReal & real() const
Definition: Mat.h:744
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8)
Definition: Mat.h:400
Specialized information about Composite Numerical Types which allows us to define appropriate templat...
Definition: CompositeNumericalTypes.h:136
CNT< E >::TInvert EInvert
Definition: Mat.h:113
Mat(const Vec< M, EE, SS > &r0)
Definition: Mat.h:508
EStandard sum() const
Definition: Row.h:254
Mat(const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1, const Vec< M, EE, SS > &r2)
Definition: Mat.h:513
This is a fixed-length row vector designed for no-overhead inline computation.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:619
Mat & operator=(const Mat &src)
Copy assignment copies only the elements that are present and does not touch any unused memory space ...
Definition: Mat.h:306
THerm & updTranspose()
Definition: Mat.h:733
CNT< E >::TAbs EAbs
Definition: Mat.h:111
SymMat< M, ESqTHerm > TSqTHerm
Definition: Mat.h:175
E & elt(int i, int j)
Definition: Mat.h:791
CNT< E >::TSqrt ESqrt
Definition: Mat.h:110
Mat(const Mat &src)
Copy constructor copies only the elements that are present and does not touch any unused memory space...
Definition: Mat.h:299
SubMat< MM, NN >::Type & updSubMat(int i, int j)
Definition: Mat.h:928
Mandatory first inclusion for any Simbody source or header file.
std::string toString() const
toString() returns a string representation of the Mat.
Definition: Mat.h:1219
TPosTrans & updPositionalTranspose()
Definition: Mat.h:737
Mat & operator+=(const Mat< M, N, negator< EE >, CSS, RSS > &mm)
Definition: Mat.h:555
Mat(const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1, const Row< N, EE, SS > &r2)
Definition: Mat.h:470
Mat< M2, M, E2, CS2, RS2 >::template Result< Mat >::Mul conformingMultiplyFromLeft(const Mat< M2, M, E2, CS2, RS2 > &m) const
Definition: Mat.h:664
CNT< E >::Scalar EScalar
Definition: Mat.h:116
Mat(const TCol &r0, const TCol &r1)
Definition: Mat.h:491
Mat< M, N, typename CNT< E >::template Result< EE >::Dvd > scalarDivide(const EE &e) const
Definition: Mat.h:834
TAppendRowCol insertRowCol(int i, int j, const Row< N+1, ER, SR > &row, const Vec< M+1, EC, SC > &col) const
Return a matrix one row and one column larger than this one by inserting a row before row i and a col...
Definition: Mat.h:1063
K::TNeg TNeg
Definition: CompositeNumericalTypes.h:139
Mat< M, N, E, CS, RS > T
Definition: Mat.h:150
static double getDefaultTolerance()
For approximate comparisons, the default tolerance to use for a matrix is its shortest dimension time...
Definition: Mat.h:1123
Result< SymMat< M, E2, RS2 > >::Add conformingAdd(const SymMat< M, E2, RS2 > &sy) const
Definition: Mat.h:632
K::TStandard TStandard
Definition: CompositeNumericalTypes.h:156
CNT< E >::TComplex EComplex
Definition: Mat.h:104
Mat< M, N, typename CNT< E >::template Result< P >::Mul, M, 1 > Mul
Definition: Mat.h:245
#define SimTK_INDEXCHECK(ix, ub, where)
Definition: ExceptionMacros.h:145
Mat< N, M, EInvert, N, 1 > TInvert
Definition: Mat.h:171
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6)
Definition: Mat.h:392
EPrecision Precision
Definition: Mat.h:191
MulOpNonConforming::Type MulNon
Definition: Mat.h:262
K::TWithoutNegator TWithoutNegator
Definition: CompositeNumericalTypes.h:140
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9, const E &e10, const E &e11, const E &e12, const E &e13, const E &e14)
Definition: Mat.h:431
const TImag & imag() const
Definition: Mat.h:754
Result< SymMat< M, E2, RS2 > >::Add conformingAdd(const SymMat< M, E2, RS2 > &r) const
Definition: SymMat.h:512
Vec< M, E, RS > TCol
Definition: Mat.h:163
EULessScalar ULessScalar
Definition: Mat.h:188
const TDiag & diag() const
Select main diagonal (of largest leading square if rectangular) and return it as a read-only view (as...
Definition: Mat.h:800
CNT< E >::TPosTrans EPosTrans
Definition: Mat.h:106
TDropRow dropRow(int i) const
Return a matrix one row smaller than this one by dropping row i.
Definition: Mat.h:942
Mat(const TRow &r0, const TRow &r1, const TRow &r2)
Definition: Mat.h:450
CNT< E >::TImag EImag
Definition: Mat.h:103
Mat< M, N, typename CNT< E >::template Result< P >::Dvd, M, 1 > Dvd
Definition: Mat.h:246
Row< N, E, CS > TRow
Definition: Mat.h:162
const THerm & operator~() const
Definition: Mat.h:726
const TWithoutNegator & castAwayNegatorIfAny() const
Definition: Mat.h:765
Mat< M, N, EComplex, CS, RS > TComplex
Definition: Mat.h:158
Mat & scalarMinusEqFromLeft(const EE &ee)
Definition: Mat.h:891
Mat(const Mat< M, N, E, CSS, RSS > &src)
This provides an implicit conversion from a Mat of the same dimensions and element type but with diff...
Definition: Mat.h:330
bool operator!=(const L &left, const R &right)
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:641
Mat< M-1, N, E, M-1, 1 > TDropRow
Definition: Mat.h:180
This class represents a small matrix whose size is known at compile time, containing elements of any ...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:620
K::TComplex TComplex
Definition: CompositeNumericalTypes.h:143
TNeg & operator-()
Definition: Mat.h:725
Mat< M, N, typename CNT< E >::template Result< P >::Add, M, 1 > Add
Definition: Mat.h:247
Mat(const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1, const Row< N, EE, SS > &r2, const Row< N, EE, SS > &r3, const Row< N, EE, SS > &r4, const Row< N, EE, SS > &r5)
Definition: Mat.h:482
Mat & operator-=(const Mat< M, N, EE, CSS, RSS > &mm)
Definition: Mat.h:561
Mat(const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1)
Definition: Mat.h:510
K::Number Number
Definition: CompositeNumericalTypes.h:162
Mat< N, M, E, RS, CS > TPosTrans
Definition: Mat.h:160
AddOp::Type Add
Definition: Mat.h:272
Mat(const TCol &r0, const TCol &r1, const TCol &r2, const TCol &r3, const TCol &r4)
Definition: Mat.h:498
Mat & operator-=(const EE &e)
Definition: Mat.h:874
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4)
Definition: Mat.h:386
CNT< E >::Precision EPrecision
Definition: Mat.h:120
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7)
Definition: Mat.h:396
ScalarNormSq scalarNormSqr() const
Scalar norm square is the sum of squares of all the scalars that comprise the value of this Mat...
Definition: Mat.h:210
Mat(const TCol &r0, const TCol &r1, const TCol &r2, const TCol &r3, const TCol &r4, const TCol &r5)
Definition: Mat.h:502
Mat & scalarMinusEq(const EE &ee)
Definition: Mat.h:888
const E & operator()(int i, int j) const
Definition: Mat.h:686
TRow & row(int i)
Definition: Mat.h:772
const Mat & operator+() const
Definition: Mat.h:723
Result< Mat< M2, N, E2, CS2, RS2 > >::Dvd conformingDivide(const Mat< M2, N, E2, CS2, RS2 > &m) const
Definition: Mat.h:671
SubCNTs< M, N, ArgDepth, Mat, ColSpacing, RowSpacing, CNT< P >::NRows, CNT< P >::NCols, CNT< P >::ArgDepth, P, CNT< P >::ColSpacing, CNT< P >::RowSpacing > SubOp
Definition: Mat.h:276
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6, const E &e7, const E &e8, const E &e9, const E &e10, const E &e11)
Definition: Mat.h:413
K::TSqHermT TSqHermT
Definition: CompositeNumericalTypes.h:146
TNeg & updNegate()
Definition: Mat.h:730
const TPosTrans & positionalTranspose() const
Definition: Mat.h:735
TCol & col(int j)
Definition: Mat.h:781
K::THerm THerm
Definition: CompositeNumericalTypes.h:144
EStandard trace() const
Definition: Mat.h:809
Vec & scalarMinusEq(const EE &ee)
Definition: Vec.h:787
Result< Mat< N, N2, E2, CS2, RS2 > >::Mul conformingMultiply(const Mat< N, N2, E2, CS2, RS2 > &m) const
Definition: Mat.h:654
Mat & scalarPlusEq(const EE &ee)
Definition: Mat.h:885
CNT< ScalarNormSq >::TSqrt norm() const
Definition: Mat.h:692
const TDiag & diag() const
Definition: SymMat.h:822
CNT< E >::Number ENumber
Definition: Mat.h:118
Mat & scalarTimesEqFromLeft(const EE &ee)
Definition: Mat.h:896
Mat(const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1)
Definition: Mat.h:467
E TElement
Definition: Mat.h:161
Mat< M, N, EAbs, M, 1 > TAbs
Definition: Mat.h:169
K::TAbs TAbs
Definition: CompositeNumericalTypes.h:155
Mat< N, M, EHerm, RS, CS > THerm
Definition: Mat.h:159
static Mat & updAs(ELT *p)
Definition: Mat.h:1082
Mat< M, N, EWithoutNegator, CS, RS > TWithoutNegator
Definition: Mat.h:152
Mat< M, N-1, E, M, 1 > TDropCol
Definition: Mat.h:181