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 {
128 MaxDim = N > M ? N : M,
195 static int size() {
return M*N; }
198 static int nrow() {
return M; }
201 static int ncol() {
return N; }
210 for(
int j=0;j<N;++j) sum += CNT<TCol>::scalarNormSqr((*this)(j));
219 for(
int j=0;j<N;++j) msqrt(j) = (*this)(j).
sqrt();
228 for(
int j=0;j<N;++j) mabs(j) = (*this)(j).
abs();
234 for(
int j=0;j<N;++j) mstd(j) = (*this)(j).
standardize();
255 typedef typename MulOp::Type
Mul;
258 CNT<P>::NRows, CNT<P>::NCols, CNT<P>::ArgDepth,
260 typedef typename MulOpNonConforming::Type
MulNon;
263 CNT<P>::NRows, CNT<P>::NCols, CNT<P>::ArgDepth,
265 typedef typename DvdOp::Type
Dvd;
268 CNT<P>::NRows, CNT<P>::NCols, CNT<P>::ArgDepth,
270 typedef typename AddOp::Type
Add;
273 CNT<P>::NRows, CNT<P>::NCols, CNT<P>::ArgDepth,
275 typedef typename SubOp::Type
Sub;
298 for (
int j=0; j<N; ++j)
305 for (
int j=0; j<N; ++j)
316 for (
int j = 0; j < M; ++j)
317 for (
int i = j+1; i < M; ++i) {
327 template <
int CSS,
int RSS>
329 for (
int j=0; j<N; ++j)
338 template <
int CSS,
int RSS>
340 for (
int j=0; j<N; ++j)
351 template <
class EE,
int CSS,
int RSS>
353 {
for (
int j=0;j<N;++j) (*
this)(j) = mm(j);}
359 {
for (
int j=0;j<N;++j) (*
this)(j) = E(0);
diag()=e; }
365 explicit Mat(
const ENeg& e)
366 {
for (
int j=0;j<N;++j) (*
this)(j) = E(0);
diag()=e; }
378 Mat(
const E& e0,
const E& e1)
379 {assert(M*N==2);d[rIx(0)]=e0;d[rIx(1)]=e1;}
380 Mat(
const E& e0,
const E& e1,
const E& e2)
381 {assert(M*N==3);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;}
382 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3)
383 {assert(M*N==4);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;}
384 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4)
385 {assert(M*N==5);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;}
386 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
388 {assert(M*N==6);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
390 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
391 const E& e5,
const E& e6)
392 {assert(M*N==7);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
393 d[rIx(5)]=e5;d[rIx(6)]=e6;}
394 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
395 const E& e5,
const E& e6,
const E& e7)
396 {assert(M*N==8);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
397 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;}
398 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
399 const E& e5,
const E& e6,
const E& e7,
const E& e8)
400 {assert(M*N==9);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
401 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;}
402 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
403 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9)
404 {assert(M*N==10);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
405 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;}
406 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
407 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9,
409 {assert(M*N==11);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
410 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;d[rIx(10)]=e10;}
411 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
412 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9,
413 const E& e10,
const E& e11)
414 {assert(M*N==12);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
415 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;d[rIx(10)]=e10;
417 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
418 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9,
419 const E& e10,
const E& e11,
const E& e12)
420 {assert(M*N==13);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
421 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;d[rIx(10)]=e10;
422 d[rIx(11)]=e11;d[rIx(12)]=e12;}
423 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
424 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9,
425 const E& e10,
const E& e11,
const E& e12,
const E& e13)
426 {assert(M*N==14);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
427 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;d[rIx(10)]=e10;
428 d[rIx(11)]=e11;d[rIx(12)]=e12;d[rIx(13)]=e13;}
429 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
430 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9,
431 const E& e10,
const E& e11,
const E& e12,
const E& e13,
const E& e14)
432 {assert(M*N==15);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
433 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;d[rIx(10)]=e10;
434 d[rIx(11)]=e11;d[rIx(12)]=e12;d[rIx(13)]=e13;d[rIx(14)]=e14;}
435 Mat(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
436 const E& e5,
const E& e6,
const E& e7,
const E& e8,
const E& e9,
437 const E& e10,
const E& e11,
const E& e12,
const E& e13,
const E& e14,
439 {assert(M*N==16);d[rIx(0)]=e0;d[rIx(1)]=e1;d[rIx(2)]=e2;d[rIx(3)]=e3;d[rIx(4)]=e4;
440 d[rIx(5)]=e5;d[rIx(6)]=e6;d[rIx(7)]=e7;d[rIx(8)]=e8;d[rIx(9)]=e9;d[rIx(10)]=e10;
441 d[rIx(11)]=e11;d[rIx(12)]=e12;d[rIx(13)]=e13;d[rIx(14)]=e14;d[rIx(15)]=e15;}
444 explicit Mat(
const TRow& r0)
445 { assert(M==1); (*this)[0]=r0; }
446 Mat(
const TRow& r0,
const TRow& r1)
447 { assert(M==2);(*this)[0]=r0;(*this)[1]=r1; }
448 Mat(
const TRow& r0,
const TRow& r1,
const TRow& r2)
449 { assert(M==3);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2; }
450 Mat(
const TRow& r0,
const TRow& r1,
const TRow& r2,
452 { assert(M==4);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;(*this)[3]=r3; }
453 Mat(
const TRow& r0,
const TRow& r1,
const TRow& r2,
454 const TRow& r3,
const TRow& r4)
455 { assert(M==5);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;
456 (*this)[3]=r3;(*this)[4]=r4; }
457 Mat(
const TRow& r0,
const TRow& r1,
const TRow& r2,
458 const TRow& r3,
const TRow& r4,
const TRow& r5)
459 { assert(M==6);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;
460 (*this)[3]=r3;(*this)[4]=r4;(*this)[5]=r5; }
464 { assert(M==1); (*this)[0]=r0; }
466 { assert(M==2);(*this)[0]=r0;(*this)[1]=r1; }
467 template <
class EE,
int SS>
469 { assert(M==3);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2; }
470 template <
class EE,
int SS>
473 { assert(M==4);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;(*this)[3]=r3; }
474 template <
class EE,
int SS>
477 { assert(M==5);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;
478 (*this)[3]=r3;(*this)[4]=r4; }
479 template <
class EE,
int SS>
482 { assert(M==6);(*this)[0]=r0;(*this)[1]=r1;(*this)[2]=r2;
483 (*this)[3]=r3;(*this)[4]=r4;(*this)[5]=r5; }
487 explicit Mat(
const TCol& r0)
488 { assert(N==1); (*this)(0)=r0; }
489 Mat(
const TCol& r0,
const TCol& r1)
490 { assert(N==2);(*this)(0)=r0;(*this)(1)=r1; }
491 Mat(
const TCol& r0,
const TCol& r1,
const TCol& r2)
492 { assert(N==3);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2; }
493 Mat(
const TCol& r0,
const TCol& r1,
const TCol& r2,
495 { assert(N==4);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;(*this)(3)=r3; }
496 Mat(
const TCol& r0,
const TCol& r1,
const TCol& r2,
497 const TCol& r3,
const TCol& r4)
498 { assert(N==5);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;
499 (*this)(3)=r3;(*this)(4)=r4; }
500 Mat(
const TCol& r0,
const TCol& r1,
const TCol& r2,
501 const TCol& r3,
const TCol& r4,
const TCol& r5)
502 { assert(N==6);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;
503 (*this)(3)=r3;(*this)(4)=r4;(*this)(5)=r5; }
507 { assert(N==1); (*this)(0)=r0; }
509 { assert(N==2);(*this)(0)=r0;(*this)(1)=r1; }
510 template <
class EE,
int SS>
512 { assert(N==3);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2; }
513 template <
class EE,
int SS>
516 { assert(N==4);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;(*this)(3)=r3; }
517 template <
class EE,
int SS>
520 { assert(N==5);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;
521 (*this)(3)=r3;(*this)(4)=r4; }
522 template <
class EE,
int SS>
525 { assert(N==6);(*this)(0)=r0;(*this)(1)=r1;(*this)(2)=r2;
526 (*this)(3)=r3;(*this)(4)=r4;(*this)(5)=r5; }
530 template <
class EE>
explicit Mat(
const EE* p)
531 { assert(p);
for(
int i=0;i<M;++i) (*
this)[i]=&p[i*N]; }
537 for (
int j=0; j<N; ++j) (*
this)(j) = mm(j);
542 assert(p);
for(
int i=0;i<M;++i) (*
this)[i]=&p[i*N];
547 template <
class EE,
int CSS,
int RSS>
Mat&
549 for (
int j=0; j<N; ++j) (*
this)(j) += mm(j);
552 template <
class EE,
int CSS,
int RSS>
Mat&
554 for (
int j=0; j<N; ++j) (*
this)(j) -= -(mm(j));
558 template <
class EE,
int CSS,
int RSS>
Mat&
560 for (
int j=0; j<N; ++j) (*
this)(j) -= mm(j);
563 template <
class EE,
int CSS,
int RSS>
Mat&
565 for (
int j=0; j<N; ++j) (*
this)(j) += -(mm(j));
571 template <
class EE,
int CSS,
int RSS>
Mat&
574 for (
int j=0; j<N; ++j)
575 for (
int i=0; i<M; ++i)
576 (*
this)(i,j) = t[i] * mm(j);
584 template <
class E2,
int CS2,
int RS2>
585 typename Result<Mat<M,N,E2,CS2,RS2> >
::Add 587 typename Result<Mat<M,N,E2,CS2,RS2> >
::Add result;
588 for (
int j=0;j<N;++j) result(j) = (*this)(j) +
r(j);
592 template <
class E2,
int CS2,
int RS2>
593 typename Result<Mat<M,N,E2,CS2,RS2> >
::Sub 595 typename Result<Mat<M,N,E2,CS2,RS2> >
::Sub result;
596 for (
int j=0;j<N;++j) result(j) = (*this)(j) -
r(j);
600 template <
class E2,
int CS2,
int RS2>
603 return l.conformingSubtract(*
this);
607 template <
class E2,
int CS2,
int RS2>
611 for (
int j=0;j<N;++j)
617 template <
class E2,
int CS2,
int RS2>
621 for (
int j=0;j<N;++j)
628 template <
class E2,
int RS2>
629 typename Result<SymMat<M,E2,RS2> >
::Add 635 template <
class E2,
int RS2>
636 typename Result<SymMat<M,E2,RS2> >
::Sub 639 return sy.conformingSubtractFromLeft(*
this);
642 template <
class E2,
int RS2>
650 template <
int N2,
class E2,
int CS2,
int RS2>
651 typename Result<Mat<N,N2,E2,CS2,RS2> >
::Mul 653 typename Result<Mat<N,N2,E2,CS2,RS2> >
::Mul result;
654 for (
int j=0;j<N2;++j)
655 for (
int i=0;i<M;++i)
656 result(i,j) = (*this)[i].conformingMultiply(
m(j));
660 template <
int M2,
class E2,
int CS2,
int RS2>
663 return m.conformingMultiply(*
this);
667 template <
int M2,
class E2,
int CS2,
int RS2>
668 typename Result<Mat<M2,N,E2,CS2,RS2> >
::Dvd 673 template <
int M2,
class E2,
int CS2,
int RS2>
676 return m.conformingMultiply((*this).invert());
709 TNormalize elementwiseNormalized;
711 for (
int j=0; j<N; ++j)
712 elementwiseNormalized(j) = (*this)(j).
normalize();
713 return elementwiseNormalized;
727 const TNeg&
negate()
const {
return *
reinterpret_cast<const TNeg*
>(
this); }
728 TNeg&
updNegate() {
return *
reinterpret_cast<TNeg*
>(
this); }
730 const THerm&
transpose()
const {
return *
reinterpret_cast<const THerm*
>(
this); }
734 {
return *
reinterpret_cast<const TPosTrans*
>(
this); }
736 {
return *
reinterpret_cast<TPosTrans*
>(
this); }
754 const Precision* p =
reinterpret_cast<const Precision*
>(
this);
755 return *
reinterpret_cast<const TImag*
>(p+offs);
759 Precision* p =
reinterpret_cast<Precision*
>(
this);
760 return *
reinterpret_cast<TImag*
>(p+offs);
766 const TRow&
row(
int i)
const {
768 return *
reinterpret_cast<const TRow*
>(&d[i*RS]);
772 return *
reinterpret_cast<TRow*
>(&d[i*RS]);
775 const TCol&
col(
int j)
const {
777 return *
reinterpret_cast<const TCol*
>(&d[j*CS]);
781 return *
reinterpret_cast<TCol*
>(&d[j*CS]);
784 const E&
elt(
int i,
int j)
const {
798 const TDiag&
diag()
const {
return *
reinterpret_cast<const TDiag*
>(d); }
802 TDiag&
updDiag() {
return *
reinterpret_cast<TDiag*
>(d); }
805 TDiag&
diag() {
return *
reinterpret_cast<TDiag*
>(d); }
834 for (
int j=0; j<N; ++j) result(j) = (*this)(j).
scalarDivide(e);
879 {
for(
int j=0; j<N; ++j) (*
this)(j).
scalarEq(EE(0));
893 {
for(
int j=0; j<N; ++j) (*
this)(j).
scalarTimesEq(ee);
return *
this; }
898 {
for(
int j=0; j<N; ++j) (*
this)(j).
scalarDivideEq(ee);
return *
this; }
903 for (
int j=0; j<N; ++j)
908 for (
int j=0; j<N; ++j)
915 template <
int MM,
int NN>
struct SubMat {
919 template <
int MM,
int NN>
921 assert(0 <= i && i + MM <= M);
922 assert(0 <= j && j + NN <= N);
925 template <
int MM,
int NN>
927 assert(0 <= i && i + MM <= M);
928 assert(0 <= j && j + NN <= N);
931 template <
int MM,
int NN>
933 assert(0 <= i && i + MM <= M);
934 assert(0 <= j && j + NN <= N);
941 assert(0 <= i && i < M);
943 for (
int r=0, nxt=0;
r<M-1; ++
r, ++nxt) {
945 out[
r] = (*this)[nxt];
953 assert(0 <= j && j < N);
955 for (
int c=0, nxt=0; c<N-1; ++c, ++nxt) {
957 out(c) = (*this)(nxt);
966 assert(0 <= i && i < M);
967 assert(0 <= j && j < N);
969 for (
int c=0, nxtc=0; c<N-1; ++c, ++nxtc) {
971 for (
int r=0, nxtr=0;
r<M-1; ++
r, ++nxtr) {
973 out(
r,c) = (*this)(nxtr,nxtc);
982 template <
class EE,
int SS>
985 out.template updSubMat<M,N>(0,0) = (*
this);
993 template <
class EE,
int SS>
996 out.template updSubMat<M,N>(0,0) = (*
this);
1007 template <
class ER,
int SR,
class EC,
int SC>
1012 out.template updSubMat<M,N>(0,0) = (*
this);
1013 out[M].template updSubRow<N>(0) =
1014 row.template getSubRow<N>(0);
1024 template <
class EE,
int SS>
1026 assert(0 <= i && i <= M);
1029 for (
int r=0, nxt=0;
r<M; ++
r, ++nxt) {
1030 if (nxt==i) out[nxt++] =
row;
1031 out[nxt] = (*this)[
r];
1041 template <
class EE,
int SS>
1043 assert(0 <= j && j <= N);
1046 for (
int c=0, nxt=0; c<N; ++c, ++nxt) {
1047 if (nxt==j) out(nxt++) =
col;
1048 out(nxt) = (*this)(c);
1060 template <
class ER,
int SR,
class EC,
int SC>
1063 assert(0 <= i && i <= M);
1064 assert(0 <= j && j <= N);
1066 for (
int c=0, nxtc=0; c<N; ++c, ++nxtc) {
1067 if (nxtc==j) ++nxtc;
1068 for (
int r=0, nxtr=0;
r<M; ++
r, ++nxtr) {
1069 if (nxtr==i) ++nxtr;
1070 out(nxtr,nxtc) = (*this)(
r,c);
1079 static const Mat&
getAs(
const ELT* p) {
return *
reinterpret_cast<const Mat*
>(p);}
1091 for (
int j=0; j<N; ++j)
1100 bool seenInf =
false;
1101 for (
int j=0; j<N; ++j) {
1113 for (
int j=0; j<N; ++j)
1125 template <
class E2,
int CS2,
int RS2>
1127 for (
int j=0; j < N; ++j)
1136 template <
class E2,
int CS2,
int RS2>
1151 for (
int i=0; i<M; ++i)
1152 for (
int j=0; j<N; ++j) {
1173 if (M != N)
return false;
1174 for (
int j=0; j<M; ++j)
1175 for (
int i=j; i<M; ++i)
1188 if (M != N)
return false;
1189 for (
int j=0; j<M; ++j)
1190 for (
int i=j; i<M; ++i)
1199 for (
int j = 0; j < N; ++j)
1210 for (
int i = 0; i < M; ++i)
1218 std::stringstream stream;
1220 return stream.str();
1223 const ELT&
get(
int i,
int j)
const {
return elt(i,j); }
1225 void set(
int i,
int j,
const ELT& value) {
elt(i,j)=value; }
1234 int rIx(
int k)
const {
1235 const int row = k / N;
1236 const int col = k % N;
1237 return row*RS + col*CS;
1246 template <
int M,
int N,
class EL,
int CSL,
int RSL,
class ER,
int CSR,
int RSR>
inline 1253 template <
int M,
int N,
class EL,
int CSL,
int RSL,
class ER,
int CSR,
int RSR>
inline 1261 template <
int M,
int N,
class EL,
int CSL,
int RSL,
int P,
class ER,
int CSR,
int RSR>
inline 1270 template <
int M,
int N,
class EL,
int CSL,
int RSL,
int MM,
int NN,
class ER,
int CSR,
int RSR>
inline 1277 template <
int M,
int N,
class EL,
int CSL,
int RSL,
class ER,
int CSR,
int RSR>
inline 1279 for (
int j=0; j<N; ++j)
1280 if (l(j) !=
r(j))
return false;
1283 template <
int M,
int N,
class EL,
int CSL,
int RSL,
class ER,
int CSR,
int RSR>
inline 1296 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1300 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1304 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1308 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1312 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1316 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1321 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1324 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1331 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1335 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1340 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1343 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1348 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1351 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1363 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1368 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1371 {
return l * r.invert(); }
1373 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1378 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1381 {
return l * r.invert(); }
1383 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1388 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1391 {
return l * r.invert(); }
1394 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1399 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1408 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1412 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1418 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1421 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1426 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1429 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1441 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 1449 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1453 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1457 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1461 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1466 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1469 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1476 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1480 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1485 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1488 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1493 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1496 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1503 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1507 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1512 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1516 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1521 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1525 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1531 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1534 template <
int M,
int N,
class E,
int CS,
int RS>
inline 1542 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1546 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1552 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1555 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1560 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1563 template <
int M,
int N,
class E,
int CS,
int RS,
class R>
inline 1569 template <
int M,
int N,
class E,
int CS,
int RS,
class CHAR,
class TRAITS>
inline 1570 std::basic_ostream<CHAR,TRAITS>&
1572 for (
int i=0;i<M;++i) {
1573 o << std::endl <<
"[";
1574 for (
int j=0;j<N;++j)
1575 o << (j>0?
",":
"") <<
m(i,j);
1578 if (M) o << std::endl;
1582 template <
int M,
int N,
class E,
int CS,
int RS,
class CHAR,
class TRAITS>
inline 1583 std::basic_istream<CHAR,TRAITS>&
1593 #endif //SimTK_SIMMATRIX_SMALLMATRIX_MAT_H_ std::string toString() const
toString() returns a string representation of the Mat.
Definition: Mat.h:1217
TInvert invert() const
Definition: SmallMatrixMixed.h:1003
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:406
Matrix_< E > operator/(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:613
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:1172
Mat & operator=(const EE *p)
Definition: Mat.h:541
Mat & scalarDivideEq(const EE &ee)
Definition: Mat.h:897
Mat(const TRow &r0)
Definition: Mat.h:444
Mat< M2, M, E2, CS2, RS2 >::template Result< Mat >::Mul conformingMultiplyFromLeft(const Mat< M2, M, E2, CS2, RS2 > &m) const
Definition: Mat.h:662
const E & operator()(int i, int j) const
Definition: Mat.h:684
K::ScalarNormSq ScalarNormSq
Definition: CompositeNumericalTypes.h:166
Mat< M, N, typename CNT< EE >::template Result< E >::Mul > scalarMultiplyFromLeft(const EE &e) const
Definition: Mat.h:823
EStandard trace() const
Definition: Mat.h:807
Mat(const TCol &r0, const TCol &r1, const TCol &r2, const TCol &r3)
Definition: Mat.h:493
Mat & scalarTimesEq(const EE &ee)
Definition: Mat.h:892
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:475
Mat< M+1, N+1, E, M+1, 1 > TAppendRowCol
Definition: Mat.h:183
bool isNaN() const
Return true if any element of this Mat contains a NaN anywhere.
Definition: Mat.h:1090
const TReal & real() const
Definition: Mat.h:742
Mat & operator/=(const EE &e)
Definition: Mat.h:874
K::TReal TReal
Definition: CompositeNumericalTypes.h:141
EScalar Scalar
Definition: Mat.h:185
EStandard sum() const
Definition: Row.h:254
Result< SymMat< M, E2, RS2 > >::Sub conformingSubtract(const SymMat< M, E2, RS2 > &r) const
Definition: SymMat.h:519
TDiag & diag()
This non-const version of diag() is an alternate name for updDiag() available for historical reasons...
Definition: Mat.h:805
Mat(const TRow &r0, const TRow &r1, const TRow &r2, const TRow &r3, const TRow &r4)
Definition: Mat.h:453
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:254
const E & getEltLower(int i, int j) const
Definition: SymMat.h:838
This is a small, fixed-size symmetric or Hermitian matrix designed for no-overhead inline computation...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:608
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:423
that is
Definition: SimmathUserGuide.doc:215
void setToZero()
Definition: Mat.h:907
const TNeg & operator-() const
Definition: Mat.h:722
Vec & scalarEq(const EE &ee)
Definition: Vec.h:781
TDropRow dropRow(int i) const
Return a matrix one row smaller than this one by dropping row i.
Definition: Mat.h:940
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:374
Mat< M, N, ENeg, CS, RS > TNeg
Definition: Mat.h:149
Mat< M, N, ENormalize, M, 1 > TNormalize
Definition: Mat.h:170
const TImag & imag() const
Definition: Mat.h:752
Mat< M, N+1, E, M, 1 > TAppendCol
Definition: Mat.h:182
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:471
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:965
Mat(const EE *p)
Definition: Mat.h:530
Vec< MinDim, E, RS+CS > TDiag
Definition: Mat.h:162
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:523
NTraits< N >::StdNumber StdNumber
Definition: negator.h:107
SimTK::conjugate<R> should be instantiated only for float, double, long double.
Definition: String.h:45
const THerm & transpose() const
Definition: Mat.h:730
K::TSqrt TSqrt
Definition: CompositeNumericalTypes.h:154
TReal & real()
Definition: Mat.h:743
static TSqrt sqrt(const K &t)
Definition: CompositeNumericalTypes.h:239
Mat< M+1, N, E, M+1, 1 > TAppendRow
Definition: Mat.h:181
static int nrow()
Return the number of rows in this Mat, echoing the value supplied for the template paramter M...
Definition: Mat.h:198
Mat & operator*=(const EE &e)
Definition: Mat.h:873
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:1137
Mat & operator=(const Mat< M, N, EE, CSS, RSS > &mm)
Definition: Mat.h:536
K::Scalar Scalar
Definition: CompositeNumericalTypes.h:160
EStdNumber StdNumber
Definition: Mat.h:188
static const Mat & getAs(const ELT *p)
Definition: Mat.h:1079
K::TNormalize TNormalize
Definition: CompositeNumericalTypes.h:158
Mat(const Row< N, EE, SS > &r0)
Definition: Mat.h:463
Mat< M, N, typename CNT< EE >::template Result< E >::Dvd > scalarDivideFromLeft(const EE &e) const
Definition: Mat.h:838
Result< Mat< M, N, E2, CS2, RS2 > >::Sub conformingSubtract(const Mat< M, N, E2, CS2, RS2 > &r) const
Definition: Mat.h:594
DvdOp::Type Dvd
Definition: Mat.h:265
MulOp::Type Mul
Definition: Mat.h:255
Mat(const E &e0, const E &e1)
Definition: Mat.h:378
TRow & operator[](int i)
Definition: Mat.h:680
Mat< M, N, typename CNT< E >::template Result< EE >::Sub > scalarSubtract(const EE &e) const
Definition: Mat.h:854
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:314
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:339
Result< Mat< M, N, E2, CS2, RS2 > >::Add conformingAdd(const Mat< M, N, E2, CS2, RS2 > &r) const
Definition: Mat.h:586
Mat()
Default construction initializes to NaN when debugging but is left uninitialized otherwise to ensure ...
Definition: Mat.h:285
E & operator()(int i, int j)
Definition: Mat.h:685
Mat< M2, N, E2, CS2, RS2 >::template Result< Mat >::Dvd conformingDivideFromLeft(const Mat< M2, N, E2, CS2, RS2 > &m) const
Definition: Mat.h:675
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:269
Mat< M, N, E, M, 1 > TPacked
Definition: Mat.h:177
std::basic_istream< CHAR, TRAITS > & operator>>(std::basic_istream< CHAR, TRAITS > &is, conjugate< R > &c)
Definition: conjugate.h:800
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:417
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:358
Definition: CompositeNumericalTypes.h:120
Mat< M, N, ESqrt, M, 1 > TSqrt
Definition: Mat.h:166
TWithoutNegator & updCastAwayNegatorIfAny()
Definition: Mat.h:764
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:386
CNT< ScalarNormSq >::TSqrt norm() const
Definition: Mat.h:690
Mat< M, N, EStandard, M, 1 > TStandard
Definition: Mat.h:168
Result< Mat< M2, N, E2, CS2, RS2 > >::Dvd conformingDivide(const Mat< M2, N, E2, CS2, RS2 > &m) const
Definition: Mat.h:669
Mat< M, N, typename CNT< E >::template Result< EE >::Mul > scalarMultiply(const EE &e) const
Definition: Mat.h:817
TSqrt sqrt() const
Elementwise square root; that is, the return value has the same dimensions as this Mat but with each ...
Definition: Mat.h:217
bool operator==(const PhiMatrix &p1, const PhiMatrix &p2)
Definition: SpatialAlgebra.h:774
THerm TransposeType
Definition: Mat.h:192
Mat< M, N, EImag, CS *CNT< E >::RealStrideFactor, RS *CNT< E >::RealStrideFactor > TImag
Definition: Mat.h:155
TDiag & updDiag()
Select main diagonal (of largest leading square if rectangular) and return it as a writable view (as ...
Definition: Mat.h:802
Mat< M, N, P > Type
Definition: Mat.h:280
Result< Mat< N, N2, E2, CS2, RS2 > >::Mul conformingMultiply(const Mat< N, N2, E2, CS2, RS2 > &m) const
Definition: Mat.h:652
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:352
const E & elt(int i, int j) const
Definition: Mat.h:784
Mat< M, N, EReal, CS *CNT< E >::RealStrideFactor, RS *CNT< E >::RealStrideFactor > TReal
Definition: Mat.h:153
m
Definition: CMakeCache.txt:469
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:1099
static int size()
Return the total number of elements M*N contained in this Mat.
Definition: Mat.h:195
Vec & scalarPlusEq(const EE &ee)
Definition: Vec.h:783
Mat & operator+=(const EE &e)
Definition: Mat.h:871
Mat(const ENeg &e)
Explicit construction from a single element e whose type is negator<E> (abbreviated ENeg here) where ...
Definition: Mat.h:365
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:435
TCol & operator()(int j)
Definition: Mat.h:682
K::TSqTHerm TSqTHerm
Definition: CompositeNumericalTypes.h:147
const TNeg & negate() const
Definition: Mat.h:727
TCol rowSum() const
Returns a column vector (Vec) containing the row sums of this matrix.
Definition: Mat.h:1208
ENumber Number
Definition: Mat.h:187
Mat< M-1, N-1, E, M-1, 1 > TDropRowCol
Definition: Mat.h:180
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:364
Mat(const TRow &r0, const TRow &r1, const TRow &r2, const TRow &r3, const TRow &r4, const TRow &r5)
Definition: Mat.h:457
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:208
static int ncol()
Return the number of columns in this Mat, echoing the value supplied for the template paramter N...
Definition: Mat.h:201
TDropCol dropCol(int j) const
Return a matrix one column smaller than this one by dropping column j.
Definition: Mat.h:952
This is a fixed-length column vector designed for no-overhead inline computation. ...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:605
Result< SymMat< M, E2, RS2 > >::Add conformingAdd(const SymMat< M, E2, RS2 > &r) const
Definition: SymMat.h:512
TImag & imag()
Definition: Mat.h:757
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:518
const TWithoutNegator & castAwayNegatorIfAny() const
Definition: Mat.h:763
EltResult< E2 >::Mul elementwiseMultiply(const Mat< M, N, E2, CS2, RS2 > &r) const
Definition: Mat.h:609
const THerm & operator~() const
Definition: Mat.h:724
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:402
K::Precision Precision
Definition: CompositeNumericalTypes.h:164
Mat & scalarEq(const EE &ee)
Definition: Mat.h:878
Matrix_< E > operator*(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:605
TNormalize normalize() const
Definition: Mat.h:705
Vec< M, typename CNT< E >::template Result< EE >::Add > scalarAdd(const EE &e) const
Definition: Vec.h:750
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:798
Mat(const TCol &r0)
Definition: Mat.h:487
K::TInvert TInvert
Definition: CompositeNumericalTypes.h:157
Mat< MM, NN, ELT, CS, RS > Type
Definition: Mat.h:916
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable or merely the Work and Derivative Works thereof Contribution shall mean any work of including the original version of the Work and any modifications or additions to that Work or Derivative Works that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner For the purposes of this submitted means any form of or written communication sent to the Licensor or its including but not limited to communication on electronic mailing source code control and issue tracking systems that are managed or on behalf the Licensor for the purpose of discussing and improving the but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as Not a Contribution Contributor shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work Grant of Copyright License Subject to the terms and conditions of this each Contributor hereby grants to You a non no royalty irrevocable copyright license to prepare Derivative Works publicly publicly perform
Definition: LICENSE.txt:44
Mat< M, N, typename CNT< E >::template Result< P >::Sub, M, 1 > Sub
Definition: Mat.h:246
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:514
╨╧ рб▒ с ■ ╖ ╣ ■ │ ┤ ╡ ╢ ье┴ А ° ┐ ч bjbjcTcT ┌┘ │ ├ ╗ t ╖ Я ┴ K K K D П П П А Л2 Ф П Z╞ j J a n u a r A b s t r a c t W e d e s c r i b e t h e g o a l s a n d d e s i g n d e c i s i o n b e h i n d S i m m a t r i t h e S i m T K m a t r i x a n d l i n e a r a l g e b r a l i b r a r a n d p r o v i d e r e f e r e n c e i n f o r m a t i o n f o r u s i n g i t T h e i d e a i s t o p r o v i d e t h e p o w e r
Definition: Simmatrix.doc:7
Mat & operator*=(const Mat< N, N, EE, CSS, RSS > &mm)
Definition: Mat.h:572
THerm & operator~()
Definition: Mat.h:725
ELEM max(const VectorBase< ELEM > &v)
Definition: VectorMath.h:251
EScalarNormSq ScalarNormSq
Definition: Mat.h:190
Mat & operator-=(const Mat< M, N, negator< EE >, CSS, RSS > &mm)
Definition: Mat.h:564
Mat(const TCol &r0, const TCol &r1, const TCol &r2)
Definition: Mat.h:491
SubOp::Type Sub
Definition: Mat.h:275
Mat & scalarDivideEqFromLeft(const EE &ee)
Definition: Mat.h:899
Mat(const E &e0, const E &e1, const E &e2, const E &e3)
Definition: Mat.h:382
K::TPosTrans TPosTrans
Definition: CompositeNumericalTypes.h:145
Mat(const TRow &r0, const TRow &r1, const TRow &r2, const TRow &r3)
Definition: Mat.h:450
Mat(const E &e0, const E &e1, const E &e2)
Definition: Mat.h:380
TAbs abs() const
Elementwise absolute value; that is, the return value has the same dimensions as this Mat but with ea...
Definition: Mat.h:226
EltResult< E2 >::Dvd elementwiseDivide(const Mat< M, N, E2, CS2, RS2 > &r) const
Definition: Mat.h:619
void setToNaN()
Definition: Mat.h:902
TStandard standardize() const
Definition: Mat.h:232
Mat(const TRow &r0, const TRow &r1)
Definition: Mat.h:446
static Mat< M, N, ELT, M, 1 > getNaN()
Definition: Mat.h:1083
const TCol & operator()(int j) const
Definition: Mat.h:681
Mat & operator+=(const Mat< M, N, EE, CSS, RSS > &mm)
Definition: Mat.h:548
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:259
K::StdNumber StdNumber
Definition: CompositeNumericalTypes.h:163
bool operator!=(const conjugate< R > &a, const float &b)
Definition: conjugate.h:859
void setSubMat(int i, int j, const typename SubMat< MM, NN >::Type &value)
Definition: Mat.h:932
const TRow & operator[](int i) const
Definition: Mat.h:679
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:264
SymMat< N, ESqHermT > TSqHermT
Definition: Mat.h:172
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:398
const SubMat< MM, NN >::Type & getSubMat(int i, int j) const
Definition: Mat.h:920
Specialized information about Composite Numerical Types which allows us to define appropriate templat...
Definition: CompositeNumericalTypes.h:136
Result< SymMat< M, E2, RS2 > >::Add conformingAdd(const SymMat< M, E2, RS2 > &sy) const
Definition: Mat.h:630
Mat(const Vec< M, EE, SS > &r0)
Definition: Mat.h:506
Mat< M, N, typename CNT< E >::template Result< EE >::Add > scalarAdd(const EE &e) const
Definition: Mat.h:846
TRow colSum() const
Returns a row vector (Row) containing the column sums of this matrix.
Definition: Mat.h:1197
Mat(const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1, const Vec< M, EE, SS > &r2)
Definition: Mat.h:511
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:983
This is a fixed-length row vector designed for no-overhead inline computation.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:606
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:304
THerm & updTranspose()
Definition: Mat.h:731
const Mat & operator+() const
Definition: Mat.h:721
SymMat< M, ESqTHerm > TSqTHerm
Definition: Mat.h:173
const TDiag & diag() const
Definition: SymMat.h:822
E & elt(int i, int j)
Definition: Mat.h:789
const TPosTrans & positionalTranspose() const
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:297
const TCol & col(int j) const
Definition: Mat.h:775
SubMat< MM, NN >::Type & updSubMat(int i, int j)
Definition: Mat.h:926
Mandatory first inclusion for any Simbody source or header file.
TPosTrans & updPositionalTranspose()
Definition: Mat.h:735
Mat & operator+=(const Mat< M, N, negator< EE >, CSS, RSS > &mm)
Definition: Mat.h:553
Mat(const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1, const Row< N, EE, SS > &r2)
Definition: Mat.h:468
Mat(const TCol &r0, const TCol &r1)
Definition: Mat.h:489
K::TNeg TNeg
Definition: CompositeNumericalTypes.h:139
Mat< M, N, E, CS, RS > T
Definition: Mat.h:148
static double getDefaultTolerance()
For approximate comparisions, the default tolerance to use for a matrix is its shortest dimension tim...
Definition: Mat.h:1121
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:1126
K::TStandard TStandard
Definition: CompositeNumericalTypes.h:156
Mat< M, N, typename CNT< E >::template Result< P >::Mul, M, 1 > Mul
Definition: Mat.h:243
ScalarNormSq normSqr() const
Definition: Mat.h:688
#define SimTK_INDEXCHECK(ix, ub, where)
Definition: ExceptionMacros.h:145
Mat< N, M, EInvert, N, 1 > TInvert
Definition: Mat.h:169
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:390
EPrecision Precision
Definition: Mat.h:189
MulOpNonConforming::Type MulNon
Definition: Mat.h:260
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:429
const EHerm & getEltUpper(int i, int j) const
Definition: SymMat.h:842
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:1008
SymMat< M, E2, RS2 >::template Result< Mat >::Sub conformingSubtractFromLeft(const SymMat< M, E2, RS2 > &sy) const
Definition: Mat.h:644
Vec< M, E, RS > TCol
Definition: Mat.h:161
EULessScalar ULessScalar
Definition: Mat.h:186
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:1025
Mat(const TRow &r0, const TRow &r1, const TRow &r2)
Definition: Mat.h:448
Mat< M, N, typename CNT< E >::template Result< P >::Dvd, M, 1 > Dvd
Definition: Mat.h:244
Mat< M, N, E2, CS2, RS2 >::template Result< Mat >::Sub conformingSubtractFromLeft(const Mat< M, N, E2, CS2, RS2 > &l) const
Definition: Mat.h:602
Row< N, E, CS > TRow
Definition: Mat.h:160
Mat< M, N, EComplex, CS, RS > TComplex
Definition: Mat.h:156
Mat & scalarMinusEqFromLeft(const EE &ee)
Definition: Mat.h:889
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:328
bool isFinite() const
Return true if no element contains an Infinity or a NaN.
Definition: Mat.h:1112
Mat< M-1, N, E, M-1, 1 > TDropRow
Definition: Mat.h:178
This class represents a small matrix whose size is known at compile time, containing elements of any ...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:607
K::TComplex TComplex
Definition: CompositeNumericalTypes.h:143
TNeg & operator-()
Definition: Mat.h:723
Mat< M, N, typename CNT< E >::template Result< P >::Add, M, 1 > Add
Definition: Mat.h:245
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:480
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:994
Mat & operator-=(const Mat< M, N, EE, CSS, RSS > &mm)
Definition: Mat.h:559
Mat(const Vec< M, EE, SS > &r0, const Vec< M, EE, SS > &r1)
Definition: Mat.h:508
K::Number Number
Definition: CompositeNumericalTypes.h:162
Mat< N, M, E, RS, CS > TPosTrans
Definition: Mat.h:158
AddOp::Type Add
Definition: Mat.h:270
Mat(const TCol &r0, const TCol &r1, const TCol &r2, const TCol &r3, const TCol &r4)
Definition: Mat.h:496
Mat & operator-=(const EE &e)
Definition: Mat.h:872
Mat(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4)
Definition: Mat.h:384
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:1187
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:394
Mat(const TCol &r0, const TCol &r1, const TCol &r2, const TCol &r3, const TCol &r4, const TCol &r5)
Definition: Mat.h:500
Mat & scalarMinusEq(const EE &ee)
Definition: Mat.h:886
TRow & row(int i)
Definition: Mat.h:770
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:274
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:411
K::TSqHermT TSqHermT
Definition: CompositeNumericalTypes.h:146
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 c...
Definition: Mat.h:1061
const TRow & row(int i) const
Definition: Mat.h:766
TNeg & updNegate()
Definition: Mat.h:728
TCol & col(int j)
Definition: Mat.h:779
Mat< M, N, typename CNT< EE >::template Result< E >::Sub > scalarSubtractFromLeft(const EE &e) const
Definition: Mat.h:861
K::THerm THerm
Definition: CompositeNumericalTypes.h:144
TRow sum() const
This is an alternate name for colSum(); behaves like the Matlab function of the same name...
Definition: Mat.h:1205
Vec & scalarMinusEq(const EE &ee)
Definition: Vec.h:785
Mat & scalarPlusEq(const EE &ee)
Definition: Mat.h:883
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:1042
Mat & scalarTimesEqFromLeft(const EE &ee)
Definition: Mat.h:894
Mat(const Row< N, EE, SS > &r0, const Row< N, EE, SS > &r1)
Definition: Mat.h:465
Mat< M, N, typename CNT< E >::template Result< EE >::Dvd > scalarDivide(const EE &e) const
Definition: Mat.h:832
E TElement
Definition: Mat.h:159
Result< SymMat< M, E2, RS2 > >::Sub conformingSubtract(const SymMat< M, E2, RS2 > &sy) const
Definition: Mat.h:637
Mat< M, N, EAbs, M, 1 > TAbs
Definition: Mat.h:167
K::TAbs TAbs
Definition: CompositeNumericalTypes.h:155
Mat< N, M, EHerm, RS, CS > THerm
Definition: Mat.h:157
static Mat & updAs(ELT *p)
Definition: Mat.h:1080
Mat< M, N, EWithoutNegator, CS, RS > TWithoutNegator
Definition: Mat.h:150
Mat< M, N-1, E, M, 1 > TDropCol
Definition: Mat.h:179