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;
262 typedef typename MulOpNonConforming::Type
MulNon;
267 typedef typename DvdOp::Type
Dvd;
272 typedef typename AddOp::Type
Add;
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; }
368 {
for (
int j=0;j<N;++j) (*
this)(j) =
E(0);
diag()=e; }
381 {assert(M*N==2);d[rIx(0)]=e0;d[rIx(1)]=e1;}
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;}
447 { assert(M==1); (*this)[0]=r0; }
449 { assert(M==2);(*this)[0]=r0;(*this)[1]=r1; }
451 { assert(M==3);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2; }
454 { assert(M==4);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;(*this)[3]=r3; }
457 { assert(M==5);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;
458 (*this)[3]=r3;(*this)[4]=r4; }
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; }
490 { assert(N==1); (*this)(0)=r0; }
492 { assert(N==2);(*this)(0)=r0;(*this)(1)=r1; }
494 { assert(N==3);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2; }
497 { assert(N==4);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;(*this)(3)=r3; }
500 { assert(N==5);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;
501 (*this)(3)=r3;(*this)(4)=r4; }
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
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
598 for (
int j=0;j<N;++j) result(j) = (*this)(j) - r(j);
602 template <
class E2,
int CS2,
int RS2>
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
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>
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>
713 for (
int j=0; j<N; ++j)
714 elementwiseNormalized(j) = (*this)(j).
normalize();
715 return elementwiseNormalized;
736 {
return *
reinterpret_cast<const TPosTrans*
>(
this); }
738 {
return *
reinterpret_cast<TPosTrans*
>(
this); }
757 return *
reinterpret_cast<const TImag*
>(p+offs);
762 return *
reinterpret_cast<TImag*
>(p+offs);
770 return *
reinterpret_cast<const TRow*
>(&d[i*RS]);
774 return *
reinterpret_cast<TRow*
>(&d[i*RS]);
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 {
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;
1248 template <
int M,
int N,
class EL,
int CSL,
int RSL,
class ER,
int CSR,
int RSR>
inline
1249 typename Mat<M,N,EL,CSL,RSL>::template Result<Mat<M,N,ER,CSR,RSR> >::Add
1252 ::AddOp::perform(l,r);
1255 template <
int M,
int N,
class EL,
int CSL,
int RSL,
class ER,
int CSR,
int RSR>
inline
1256 typename Mat<M,N,EL,CSL,RSL>::template Result<Mat<M,N,ER,CSR,RSR> >::Sub
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
1264 typename Mat<M,N,EL,CSL,RSL>::template Result<Mat<N,P,ER,CSR,RSR> >::Mul
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
1273 typename Mat<M,N,EL,CSL,RSL>::template Result<Mat<MM,NN,ER,CSR,RSR> >::MulNon
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
1299 typename Mat<M,N,E,CS,RS>::template Result<float>::Mul
1302 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1303 typename Mat<M,N,E,CS,RS>::template Result<float>::Mul
1306 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1307 typename Mat<M,N,E,CS,RS>::template Result<double>::Mul
1310 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1311 typename Mat<M,N,E,CS,RS>::template Result<double>::Mul
1315 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1316 typename Mat<M,N,E,CS,RS>::template Result<typename CNT<E>::Precision>::Mul
1318 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1319 typename Mat<M,N,E,CS,RS>::template Result<typename CNT<E>::Precision>::Mul
1325 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1326 typename Mat<M,N,E,CS,RS>::template Result<std::complex<R> >::Mul
1329 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1330 typename Mat<M,N,E,CS,RS>::template Result<std::complex<R> >::Mul
1334 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1335 typename Mat<M,N,E,CS,RS>::template Result<std::complex<R> >::Mul
1337 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1338 typename Mat<M,N,E,CS,RS>::template Result<std::complex<R> >::Mul
1342 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1343 typename Mat<M,N,E,CS,RS>::template Result<typename negator<R>::StdNumber>::Mul
1345 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1346 typename Mat<M,N,E,CS,RS>::template Result<typename negator<R>::StdNumber>::Mul
1357 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1358 typename Mat<M,N,E,CS,RS>::template Result<float>::Dvd
1362 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1363 typename CNT<float>::template Result<Mat<M,N,E,CS,RS> >::Dvd
1365 {
return l * r.
invert(); }
1367 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1368 typename Mat<M,N,E,CS,RS>::template Result<double>::Dvd
1372 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1373 typename CNT<double>::template Result<Mat<M,N,E,CS,RS> >::Dvd
1375 {
return l * r.
invert(); }
1378 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1379 typename Mat<M,N,E,CS,RS>::template Result<typename CNT<E>::Precision>::Dvd
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
1393 typename Mat<M,N,E,CS,RS>::template Result<std::complex<R> >::Dvd
1396 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1397 typename CNT<std::complex<R> >::template Result<Mat<M,N,E,CS,RS> >::Dvd
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
1403 typename Mat<M,N,E,CS,RS>::template Result<std::complex<R> >::Dvd
1405 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1406 typename CNT<std::complex<R> >::template Result<Mat<M,N,E,CS,RS> >::Dvd
1410 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1411 typename Mat<M,N,E,CS,RS>::template Result<typename negator<R>::StdNumber>::Dvd
1413 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1414 typename CNT<R>::template Result<Mat<M,N,E,CS,RS> >::Dvd
1425 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1426 typename Mat<M,N,E,CS,RS>::template Result<float>::Add
1429 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1430 typename Mat<M,N,E,CS,RS>::template Result<float>::Add
1433 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1434 typename Mat<M,N,E,CS,RS>::template Result<double>::Add
1437 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1438 typename Mat<M,N,E,CS,RS>::template Result<double>::Add
1442 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1443 typename Mat<M,N,E,CS,RS>::template Result<typename CNT<E>::Precision>::Add
1445 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1446 typename Mat<M,N,E,CS,RS>::template Result<typename CNT<E>::Precision>::Add
1452 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1453 typename Mat<M,N,E,CS,RS>::template Result<std::complex<R> >::Add
1456 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1457 typename Mat<M,N,E,CS,RS>::template Result<std::complex<R> >::Add
1461 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1462 typename Mat<M,N,E,CS,RS>::template Result<std::complex<R> >::Add
1464 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1465 typename Mat<M,N,E,CS,RS>::template Result<std::complex<R> >::Add
1469 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1470 typename Mat<M,N,E,CS,RS>::template Result<typename negator<R>::StdNumber>::Add
1472 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1473 typename Mat<M,N,E,CS,RS>::template Result<typename negator<R>::StdNumber>::Add
1479 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1480 typename Mat<M,N,E,CS,RS>::template Result<float>::Sub
1483 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1484 typename CNT<float>::template Result<Mat<M,N,E,CS,RS> >::Sub
1488 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1489 typename Mat<M,N,E,CS,RS>::template Result<double>::Sub
1492 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1493 typename CNT<double>::template Result<Mat<M,N,E,CS,RS> >::Sub
1498 template <
int M,
int N,
class E,
int CS,
int RS>
inline
1499 typename Mat<M,N,E,CS,RS>::template Result<typename CNT<E>::Precision>::Sub
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
1510 typename Mat<M,N,E,CS,RS>::template Result<std::complex<R> >::Sub
1513 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1514 typename CNT<std::complex<R> >::template Result<Mat<M,N,E,CS,RS> >::Sub
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
1520 typename Mat<M,N,E,CS,RS>::template Result<std::complex<R> >::Sub
1522 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1523 typename CNT<std::complex<R> >::template Result<Mat<M,N,E,CS,RS> >::Sub
1527 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1528 typename Mat<M,N,E,CS,RS>::template Result<typename negator<R>::StdNumber>::Sub
1530 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline
1531 typename CNT<R>::template Result<Mat<M,N,E,CS,RS> >::Sub
1536 template <
int M,
int N,
class E,
int CS,
int RS,
class CHAR,
class TRAITS>
inline
1537 std::basic_ostream<CHAR,TRAITS>&
1538 operator<<(std::basic_ostream<CHAR,TRAITS>& o,
const Mat<M,N,E,CS,RS>& m) {
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>&
#define SimTK_INDEXCHECK(ix, ub, where)
Definition: ExceptionMacros.h:145
Mandatory first inclusion for any Simbody source or header file.
Specialized information about Composite Numerical Types which allows us to define appropriate templat...
Definition: CompositeNumericalTypes.h:136
K::ULessScalar ULessScalar
Definition: CompositeNumericalTypes.h:161
static double getDefaultTolerance()
Definition: CompositeNumericalTypes.h:269
K::ScalarNormSq ScalarNormSq
Definition: CompositeNumericalTypes.h:166
K::StdNumber StdNumber
Definition: CompositeNumericalTypes.h:163
static TSqrt sqrt(const K &t)
Definition: CompositeNumericalTypes.h:239
K::TSqHermT TSqHermT
Definition: CompositeNumericalTypes.h:146
K::TSqrt TSqrt
Definition: CompositeNumericalTypes.h:154
K::TInvert TInvert
Definition: CompositeNumericalTypes.h:157
K::TNormalize TNormalize
Definition: CompositeNumericalTypes.h:158
K::TWithoutNegator TWithoutNegator
Definition: CompositeNumericalTypes.h:140
K::TReal TReal
Definition: CompositeNumericalTypes.h:141
K::THerm THerm
Definition: CompositeNumericalTypes.h:144
K::TPosTrans TPosTrans
Definition: CompositeNumericalTypes.h:145
K::TNeg TNeg
Definition: CompositeNumericalTypes.h:139
K::TStandard TStandard
Definition: CompositeNumericalTypes.h:156
K::TComplex TComplex
Definition: CompositeNumericalTypes.h:143
K::TSqTHerm TSqTHerm
Definition: CompositeNumericalTypes.h:147
K::TImag TImag
Definition: CompositeNumericalTypes.h:142
K::Precision Precision
Definition: CompositeNumericalTypes.h:164
K::Scalar Scalar
Definition: CompositeNumericalTypes.h:160
K::TAbs TAbs
Definition: CompositeNumericalTypes.h:155
K::Number Number
Definition: CompositeNumericalTypes.h:162
This class represents a small matrix whose size is known at compile time, containing elements of any ...
Definition: Mat.h:97
Mat()
Default construction initializes to NaN when debugging but is left uninitialized otherwise to ensure ...
Definition: Mat.h:287
CNT< E >::TImag EImag
Definition: Mat.h:103
const THerm & transpose() const
Definition: Mat.h:732
Mat(const SymMat< M, ELT > &src)
Explicit construction of a Mat from a SymMat (symmetric/Hermitian matrix).
Definition: Mat.h:316
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
static Mat< M, N, ELT, M, 1 > getNaN()
Definition: Mat.h:1085
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
void setSubMat(int i, int j, const typename SubMat< MM, NN >::Type &value)
Definition: Mat.h:934
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
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 & operator=(const EE *p)
Definition: Mat.h:543
Mat & operator+=(const Mat< M, N, EE, CSS, RSS > &mm)
Definition: Mat.h:550
Mat< M-1, N-1, E, M-1, 1 > TDropRowCol
Definition: Mat.h:182
Mat< M, N+1, E, M, 1 > TAppendCol
Definition: Mat.h:184
Mat(const TCol &r0, const TCol &r1, const TCol &r2, const TCol &r3)
Definition: Mat.h:495
static int nrow()
Return the number of rows in this Mat, echoing the value supplied for the template parameter M.
Definition: Mat.h:200
Mat(const TCol &r0)
Definition: Mat.h:489
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
CNT< E >::TComplex EComplex
Definition: Mat.h:104
CNT< E >::TStandard EStandard
Definition: Mat.h:112
EStdNumber StdNumber
Definition: Mat.h:190
const ELT & get(int i, int j) const
Variant of indexing operator that's scripting friendly to get entry (i, j)
Definition: Mat.h:1225
const SubMat< MM, NN >::Type & getSubMat(int i, int j) const
Definition: Mat.h:922
Mat< M, N, ENeg, CS, RS > TNeg
Definition: Mat.h:151
void setToNaN()
Definition: Mat.h:904
TInvert invert() const
Definition: SmallMatrixMixed.h:1004
Result< SymMat< M, E2, RS2 > >::Add conformingAdd(const SymMat< M, E2, RS2 > &sy) const
Definition: Mat.h:632
E & operator()(int i, int j)
Definition: Mat.h:687
THerm TransposeType
Definition: Mat.h:194
Mat(const TRow &r0, const TRow &r1, const TRow &r2, const TRow &r3, const TRow &r4)
Definition: Mat.h:455
static double getDefaultTolerance()
For approximate comparisons, the default tolerance to use for a matrix is its shortest dimension time...
Definition: Mat.h:1123
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, EAbs, M, 1 > TAbs
Definition: Mat.h:169
TRow sum() const
This is an alternate name for colSum(); behaves like the Matlab function of the same name.
Definition: Mat.h:1207
Mat & operator*=(const EE &e)
Definition: Mat.h:875
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,...
Definition: Mat.h:1128
CNT< E >::TWithoutNegator EWithoutNegator
Definition: Mat.h:101
CNT< E >::TSqHermT ESqHermT
Definition: Mat.h:107
Mat< M, N, EStandard, M, 1 > TStandard
Definition: Mat.h:170
EltResult< E2 >::Mul elementwiseMultiply(const Mat< M, N, E2, CS2, RS2 > &r) const
Definition: Mat.h:611
Mat(const E &e0, const E &e1, const E &e2, const E &e3)
Definition: Mat.h:384
TDropRow dropRow(int i) const
Return a matrix one row smaller than this one by dropping row i.
Definition: Mat.h:942
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
Mat< M, N, typename CNT< E >::template Result< EE >::Mul > scalarMultiply(const EE &e) const
Definition: Mat.h:819
CNT< E >::Number ENumber
Definition: Mat.h:118
Mat(const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1)
Definition: Mat.h:467
ScalarNormSq normSqr() const
Definition: Mat.h:690
SymMat< N, ESqHermT > TSqHermT
Definition: Mat.h:174
Mat & operator-=(const Mat< M, N, negator< EE >, CSS, RSS > &mm)
Definition: Mat.h:566
Mat(const Row< N, EE, SS > &r0)
Definition: Mat.h:465
EScalar Scalar
Definition: Mat.h:187
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
TStandard standardize() const
Definition: Mat.h:234
EScalarNormSq ScalarNormSq
Definition: Mat.h:192
EStandard trace() const
Definition: Mat.h:809
Mat & scalarEq(const EE &ee)
Definition: Mat.h:880
CNT< E >::TAbs EAbs
Definition: Mat.h:111
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
const THerm & operator~() const
Definition: Mat.h:726
Mat(const TCol &r0, const TCol &r1, const TCol &r2, const TCol &r3, const TCol &r4, const TCol &r5)
Definition: Mat.h:502
Mat< M, N, E, M, 1 > TPacked
Definition: Mat.h:179
Mat & operator=(const Mat< M, N, EE, CSS, RSS > &mm)
Definition: Mat.h:538
Vec< M, E, RS > TCol
Definition: Mat.h:163
Mat(const Vec< M, EE, SS > &r0)
Definition: Mat.h:508
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
CNT< E >::ScalarNormSq EScalarNormSq
Definition: Mat.h:121
THerm & operator~()
Definition: Mat.h:727
Mat< N, M, E, RS, CS > TPosTrans
Definition: Mat.h:160
Mat< M2, M, E2, CS2, RS2 >::template Result< Mat >::Mul conformingMultiplyFromLeft(const Mat< M2, M, E2, CS2, RS2 > &m) const
Definition: Mat.h:664
SymMat< M, E2, RS2 >::template Result< Mat >::Sub conformingSubtractFromLeft(const SymMat< M, E2, RS2 > &sy) const
Definition: Mat.h:646
ELT E
Definition: Mat.h:99
Mat & operator+=(const Mat< M, N, negator< EE >, CSS, RSS > &mm)
Definition: Mat.h:555
static int ncol()
Return the number of columns in this Mat, echoing the value supplied for the template parameter N.
Definition: Mat.h:203
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
TNeg & operator-()
Definition: Mat.h:725
TDiag & diag()
This non-const version of diag() is an alternate name for updDiag() available for historical reasons.
Definition: Mat.h:807
Mat(const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1, const Row< N, EE, SS > &r2)
Definition: Mat.h:470
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
CNT< E >::Precision EPrecision
Definition: Mat.h:120
const E & elt(int i, int j) const
Definition: Mat.h:786
CNT< E >::TPosTrans EPosTrans
Definition: Mat.h:106
CNT< E >::TNormalize ENormalize
Definition: Mat.h:114
SymMat< M, ESqTHerm > TSqTHerm
Definition: Mat.h:175
Row< N, E, CS > TRow
Definition: Mat.h:162
Mat< M, N, E, CS, RS > T
Definition: Mat.h:150
Mat(const TRow &r0, const TRow &r1, const TRow &r2)
Definition: Mat.h:450
Mat< M, N, ENormalize, M, 1 > TNormalize
Definition: Mat.h:172
static Mat & updAs(ELT *p)
Definition: Mat.h:1082
Mat(const TCol &r0, const TCol &r1, const TCol &r2, const TCol &r3, const TCol &r4)
Definition: Mat.h:498
TCol & operator()(int j)
Definition: Mat.h:684
Mat(const E &e0, const E &e1)
Definition: Mat.h:380
TRow & row(int i)
Definition: Mat.h:772
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5)
Definition: Mat.h:388
TRow colSum() const
Returns a row vector (Row) containing the column sums of this matrix.
Definition: Mat.h:1199
THerm & updTranspose()
Definition: Mat.h:733
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
Mat(const TRow &r0, const TRow &r1, const TRow &r2, const TRow &r3, const TRow &r4, const TRow &r5)
Definition: Mat.h:459
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
Mat< M, N, typename CNT< E >::template Result< EE >::Sub > scalarSubtract(const EE &e) const
Definition: Mat.h:856
Mat & operator+=(const EE &e)
Definition: Mat.h:873
static const Mat & getAs(const ELT *p)
Definition: Mat.h:1081
const TReal & real() const
Definition: Mat.h:744
CNT< E >::TSqrt ESqrt
Definition: Mat.h:110
Mat< M, N, typename CNT< E >::template Result< EE >::Dvd > scalarDivide(const EE &e) const
Definition: Mat.h:834
ENumber Number
Definition: Mat.h:189
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
TNormalize normalize() const
Definition: Mat.h:707
static int size()
Return the total number of elements M*N contained in this Mat.
Definition: Mat.h:197
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(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
CNT< E >::TInvert EInvert
Definition: Mat.h:113
Mat & scalarTimesEqFromLeft(const EE &ee)
Definition: Mat.h:896
void set(int i, int j, const ELT &value)
Variant of indexing operator that's scripting friendly to set entry (i, j)
Definition: Mat.h:1227
TReal & real()
Definition: Mat.h:745
Mat & operator*=(const Mat< N, N, EE, CSS, RSS > &mm)
Definition: Mat.h:574
TPosTrans & updPositionalTranspose()
Definition: Mat.h:737
const TWithoutNegator & castAwayNegatorIfAny() const
Definition: Mat.h:765
Mat< M+1, N, E, M+1, 1 > TAppendRow
Definition: Mat.h:183
CNT< E >::Scalar EScalar
Definition: Mat.h:116
Mat & scalarDivideEq(const EE &ee)
Definition: Mat.h:899
EltResult< E2 >::Dvd elementwiseDivide(const Mat< M, N, E2, CS2, RS2 > &r) const
Definition: Mat.h:621
Result< SymMat< M, E2, RS2 > >::Sub conformingSubtract(const SymMat< M, E2, RS2 > &sy) const
Definition: Mat.h:639
Mat< M, N, typename CNT< E >::template Result< EE >::Add > scalarAdd(const EE &e) const
Definition: Mat.h:848
bool isFinite() const
Return true if no element contains an Infinity or a NaN.
Definition: Mat.h:1114
Vec< MinDim, E, RS+CS > TDiag
Definition: Mat.h:164
const TRow & row(int i) const
Definition: Mat.h:768
Mat & scalarMinusEqFromLeft(const EE &ee)
Definition: Mat.h:891
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
CNT< E >::TReal EReal
Definition: Mat.h:102
bool isNumericallyEqual(const ELT &e, double tol=getDefaultTolerance()) const
Test whether this is numerically a "scalar" matrix, meaning that it is a diagonal matrix in which eac...
Definition: Mat.h:1150
@ NPackedElements
Definition: Mat.h:132
@ ImagOffset
Definition: Mat.h:135
@ ArgDepth
Definition: Mat.h:138
@ NCols
Definition: Mat.h:127
@ RowSpacing
Definition: Mat.h:130
@ RealStrideFactor
Definition: Mat.h:136
@ NActualElements
Definition: Mat.h:133
@ IsPrecision
Definition: Mat.h:145
@ IsScalar
Definition: Mat.h:141
@ IsNumber
Definition: Mat.h:143
@ ColSpacing
Definition: Mat.h:131
@ SignInterpretation
Definition: Mat.h:146
@ IsStdNumber
Definition: Mat.h:144
@ NActualScalars
Definition: Mat.h:134
@ NRows
Definition: Mat.h:126
@ MinDim
Definition: Mat.h:128
@ IsULessScalar
Definition: Mat.h:142
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
Mat(const EE *p)
Definition: Mat.h:532
TImag & imag()
Definition: Mat.h:759
Mat & scalarMinusEq(const EE &ee)
Definition: Mat.h:888
TNeg & updNegate()
Definition: Mat.h:730
TWithoutNegator & updCastAwayNegatorIfAny()
Definition: Mat.h:766
Mat< M, N, typename CNT< EE >::template Result< E >::Dvd > scalarDivideFromLeft(const EE &e) const
Definition: Mat.h:840
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
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-1, N, E, M-1, 1 > TDropRow
Definition: Mat.h:180
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
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
E & elt(int i, int j)
Definition: Mat.h:791
CNT< ScalarNormSq >::TSqrt norm() const
Definition: Mat.h:692
CNT< E >::TNeg ENeg
Definition: Mat.h:100
const E & operator()(int i, int j) const
Definition: Mat.h:686
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< N, M, EInvert, N, 1 > TInvert
Definition: Mat.h:171
Result< Mat< M, N, E2, CS2, RS2 > >::Add conformingAdd(const Mat< M, N, E2, CS2, RS2 > &r) const
Definition: Mat.h:588
CNT< E >::THerm EHerm
Definition: Mat.h:105
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
std::string toString() const
toString() returns a string representation of the Mat.
Definition: Mat.h:1219
bool isNaN() const
Return true if any element of this Mat contains a NaN anywhere.
Definition: Mat.h:1092
Mat & operator-=(const EE &e)
Definition: Mat.h:874
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
SubMat< MM, NN >::Type & updSubMat(int i, int j)
Definition: Mat.h:928
Result< Mat< M2, N, E2, CS2, RS2 > >::Dvd conformingDivide(const Mat< M2, N, E2, CS2, RS2 > &m) const
Definition: Mat.h:671
TCol rowSum() const
Returns a column vector (Vec) containing the row sums of this matrix.
Definition: Mat.h:1210
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 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
Result< Mat< N, N2, E2, CS2, RS2 > >::Mul conformingMultiply(const Mat< N, N2, E2, CS2, RS2 > &m) const
Definition: Mat.h:654
EULessScalar ULessScalar
Definition: Mat.h:188
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
Mat< M, N-1, E, M, 1 > TDropCol
Definition: Mat.h:181
Mat & scalarDivideEqFromLeft(const EE &ee)
Definition: Mat.h:901
Mat< M, N, typename CNT< EE >::template Result< E >::Mul > scalarMultiplyFromLeft(const EE &e) const
Definition: Mat.h:825
Mat< M, N, EReal, CS *CNT< E >::RealStrideFactor, RS *CNT< E >::RealStrideFactor > TReal
Definition: Mat.h:155
Mat< M, N, ESqrt, M, 1 > TSqrt
Definition: Mat.h:168
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
Mat & operator/=(const EE &e)
Definition: Mat.h:876
Mat & operator-=(const Mat< M, N, EE, CSS, RSS > &mm)
Definition: Mat.h:561
TDropCol dropCol(int j) const
Return a matrix one column smaller than this one by dropping column j.
Definition: Mat.h:954
const TCol & operator()(int j) const
Definition: Mat.h:683
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
Mat< M+1, N+1, E, M+1, 1 > TAppendRowCol
Definition: Mat.h:185
Mat< M, N, EComplex, CS, RS > TComplex
Definition: Mat.h:158
CNT< E >::ULessScalar EULessScalar
Definition: Mat.h:117
Mat(const TCol &r0, const TCol &r1, const TCol &r2)
Definition: Mat.h:493
const TPosTrans & positionalTranspose() const
Definition: Mat.h:735
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4)
Definition: Mat.h:386
const TImag & imag() const
Definition: Mat.h:754
const TNeg & negate() const
Definition: Mat.h:729
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
const TRow & operator[](int i) const
Definition: Mat.h:681
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
Mat(const TRow &r0)
Definition: Mat.h:446
Mat & scalarPlusEq(const EE &ee)
Definition: Mat.h:885
Mat(const TRow &r0, const TRow &r1)
Definition: Mat.h:448
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
CNT< E >::StdNumber EStdNumber
Definition: Mat.h:119
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< M, N, EImag, CS *CNT< E >::RealStrideFactor, RS *CNT< E >::RealStrideFactor > TImag
Definition: Mat.h:157
TRow & operator[](int i)
Definition: Mat.h:682
Mat< M, N, E2, CS2, RS2 >::template Result< Mat >::Sub conformingSubtractFromLeft(const Mat< M, N, E2, CS2, RS2 > &l) const
Definition: Mat.h:604
Mat(const TCol &r0, const TCol &r1)
Definition: Mat.h:491
Mat< M, N, typename CNT< EE >::template Result< E >::Sub > scalarSubtractFromLeft(const EE &e) const
Definition: Mat.h:863
TDiag & updDiag()
Select main diagonal (of largest leading square if rectangular) and return it as a writable view (as ...
Definition: Mat.h:804
Result< Mat< M, N, E2, CS2, RS2 > >::Sub conformingSubtract(const Mat< M, N, E2, CS2, RS2 > &r) const
Definition: Mat.h:596
TCol & col(int j)
Definition: Mat.h:781
const TNeg & operator-() const
Definition: Mat.h:724
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
Mat< M, N, EWithoutNegator, CS, RS > TWithoutNegator
Definition: Mat.h:152
const Mat & operator+() const
Definition: Mat.h:723
void setToZero()
Definition: Mat.h:909
Mat(const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1)
Definition: Mat.h:510
Mat< N, M, EHerm, RS, CS > THerm
Definition: Mat.h:159
Mat(const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1, const Vec< M, EE, SS > &r2)
Definition: Mat.h:513
EPrecision Precision
Definition: Mat.h:191
E TElement
Definition: Mat.h:161
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
Mat(const E &e0, const E &e1, const E &e2)
Definition: Mat.h:382
Mat & scalarTimesEq(const EE &ee)
Definition: Mat.h:894
const TCol & col(int j) const
Definition: Mat.h:777
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
Mat(const TRow &r0, const TRow &r1, const TRow &r2, const TRow &r3)
Definition: Mat.h:452
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
CNT< E >::TSqTHerm ESqTHerm
Definition: Mat.h:108
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,...
Definition: Mat.h:1139
Definition: NTraits.h:436
This is a fixed-length row vector designed for no-overhead inline computation.
Definition: Row.h:132
EStandard sum() const
Definition: Row.h:254
This is a small, fixed-size symmetric or Hermitian matrix designed for no-overhead inline computation...
Definition: SymMat.h:87
const TDiag & diag() const
Definition: SymMat.h:822
Result< SymMat< M, E2, RS2 > >::Sub conformingSubtract(const SymMat< M, E2, RS2 > &r) const
Definition: SymMat.h:519
const EHerm & getEltUpper(int i, int j) const
Definition: SymMat.h:842
Result< SymMat< M, E2, RS2 > >::Add conformingAdd(const SymMat< M, E2, RS2 > &r) const
Definition: SymMat.h:512
const E & getEltLower(int i, int j) const
Definition: SymMat.h:838
This is a fixed-length column vector designed for no-overhead inline computation.
Definition: Vec.h:184
Vec & scalarEq(const EE &ee)
Definition: Vec.h:783
Vec & scalarPlusEq(const EE &ee)
Definition: Vec.h:785
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
Vec & scalarMinusEq(const EE &ee)
Definition: Vec.h:787
Vec< M, typename CNT< E >::template Result< EE >::Add > scalarAdd(const EE &e) const
Definition: Vec.h:752
SimTK::conjugate<R> should be instantiated only for float, double.
Definition: conjugate.h:178
negator<N>, where N is a number type (real, complex, conjugate), is represented in memory identically...
Definition: negator.h:75
NTraits< N >::StdNumber StdNumber
Definition: negator.h:107
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
Matrix_< typename CNT< E1 >::template Result< E2 >::Sub > operator-(const MatrixBase< E1 > &l, const MatrixBase< E2 > &r)
Definition: BigMatrix.h:584
Matrix_< E > operator/(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:613
std::ostream & operator<<(std::ostream &o, const ContactForce &f)
Definition: CompliantContactSubsystem.h:387
std::basic_istream< CHAR, TRAITS > & operator>>(std::basic_istream< CHAR, TRAITS > &is, conjugate< R > &c)
Definition: conjugate.h:505
Matrix_< typename CNT< E1 >::template Result< E2 >::Add > operator+(const MatrixBase< E1 > &l, const MatrixBase< E2 > &r)
Definition: BigMatrix.h:568
ELEM max(const VectorBase< ELEM > &v)
Definition: VectorMath.h:251
@ MAX_RESOLVED_DEPTH
Definition: CompositeNumericalTypes.h:120
Matrix_< E > operator*(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:605
bool operator==(const PhiMatrix &p1, const PhiMatrix &p2)
Definition: SpatialAlgebra.h:791
bool operator!=(const L &left, const R &right)
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:645
Mat< M, N, typename CNT< E >::template Result< P >::Add, M, 1 > Add
Definition: Mat.h:247
Mat< M, N, typename CNT< E >::template Result< P >::Sub, M, 1 > Sub
Definition: Mat.h:248
Mat< M, N, typename CNT< E >::template Result< P >::Mul, M, 1 > Mul
Definition: Mat.h:245
Mat< M, N, typename CNT< E >::template Result< P >::Dvd, M, 1 > Dvd
Definition: Mat.h:246
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
DvdOp::Type Dvd
Definition: Mat.h:267
MulOpNonConforming::Type MulNon
Definition: Mat.h:262
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
MulOp::Type Mul
Definition: Mat.h:257
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
SubOp::Type Sub
Definition: Mat.h:277
AddOp::Type Add
Definition: Mat.h:272
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
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< MM, NN, ELT, CS, RS > Type
Definition: Mat.h:918
Mat< M, N, P > Type
Definition: Mat.h:282