1 #ifndef SimTK_SIMMATRIX_SMALLMATRIX_ROW_H_ 2 #define SimTK_SIMMATRIX_SMALLMATRIX_ROW_H_ 44 template <
class E1,
int S1,
class E2,
int S2>
void 47 result[0] = r1[0] + r2[0];
49 template <
int N,
class E1,
int S1,
class E2,
int S2>
void 53 reinterpret_cast<const Row<N-1,E2,S2
>&>(r2),
55 template Result<E2>::Add
>&>(result));
56 result[N-1] = r1[N-1] + r2[N-1];
59 template <
class E1,
int S1,
class E2,
int S2>
void 62 result[0] = r1[0] - r2[0];
64 template <
int N,
class E1,
int S1,
class E2,
int S2>
void 68 reinterpret_cast<const Row<N-1,E2,S2
>&>(r2),
70 template Result<E2>::Sub
>&>(result));
71 result[N-1] = r1[N-1] - r2[N-1];
74 template <
class E1,
int S1,
class E2,
int S2>
void 77 result[0] = r1[0] * r2[0];
79 template <
int N,
class E1,
int S1,
class E2,
int S2>
void 83 reinterpret_cast<const Row<N-1,E2,S2
>&>(r2),
85 template Result<E2>::Mul
>&>(result));
86 result[N-1] = r1[N-1] * r2[N-1];
89 template <
class E1,
int S1,
class E2,
int S2>
void 92 result[0] = r1[0] / r2[0];
94 template <
int N,
class E1,
int S1,
class E2,
int S2>
void 98 reinterpret_cast<const Row<N-1,E2,S2
>&>(r2),
100 template Result<E2>::Dvd
>&>(result));
101 result[N-1] = r1[N-1] / r2[N-1];
104 template <
class E1,
int S1,
class E2,
int S2>
void 108 template <
int N,
class E1,
int S1,
class E2,
int S2>
void 110 copy(
reinterpret_cast<Row<N-1,E1,S1
>&>(r1),
111 reinterpret_cast<const Row<N-1,E2,S2
>&>(r2));
132 template <
int N,
class ELT,
int STRIDE>
class Row {
163 NActualElements = N * STRIDE,
165 RowSpacing = NActualElements,
168 RealStrideFactor = 1,
216 static int size() {
return N; }
217 static int nrow() {
return 1; }
218 static int ncol() {
return N; }
224 for(
int i=0;i<N;++i) sum += CNT<E>::scalarNormSqr(d[i*STRIDE]);
233 for(
int i=0;i<N;++i) rsqrt[i] = CNT<E>::sqrt(d[i*STRIDE]);
248 for(
int i=0;i<N;++i) rstd[i] = CNT<E>::standardize(d[i*STRIDE]);
256 for (
int i=0;i<N;++i) sum += d[i*STRIDE];
273 typedef MulCNTs<1,N,ArgDepth,
Row,ColSpacing,RowSpacing,
276 typedef typename MulOp::Type
Mul;
278 typedef MulCNTsNonConforming<1,N,ArgDepth,Row,ColSpacing,RowSpacing,
279 CNT<P>::NRows, CNT<P>::NCols, CNT<P>::ArgDepth,
281 typedef typename MulOpNonConforming::Type
MulNon;
284 typedef DvdCNTs<1,N,ArgDepth,Row,ColSpacing,RowSpacing,
285 CNT<P>::NRows, CNT<P>::NCols, CNT<P>::ArgDepth,
287 typedef typename DvdOp::Type
Dvd;
289 typedef AddCNTs<1,N,ArgDepth,Row,ColSpacing,RowSpacing,
290 CNT<P>::NRows, CNT<P>::NCols, CNT<P>::ArgDepth,
292 typedef typename AddOp::Type
Add;
294 typedef SubCNTs<1,N,ArgDepth,Row,ColSpacing,RowSpacing,
295 CNT<P>::NRows, CNT<P>::NCols, CNT<P>::ArgDepth,
297 typedef typename SubOp::Type
Sub;
344 {
for (
int i=0;i<N;++i) d[i*STRIDE]=e; }
347 explicit Row(
const ENeg& ne)
348 {
for (
int i=0;i<N;++i) d[i*STRIDE]=ne; }
353 {
new (
this)
Row(
E(Precision(i))); }
356 Row(
const E& e0,
const E& e1)
357 { assert(N==2);(*this)[0]=e0;(*this)[1]=e1; }
358 Row(
const E& e0,
const E& e1,
const E& e2)
359 { assert(N==3);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2; }
360 Row(
const E& e0,
const E& e1,
const E& e2,
const E& e3)
361 { assert(N==4);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2;(*this)[3]=e3; }
362 Row(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4)
363 { assert(N==5);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2;
364 (*this)[3]=e3;(*this)[4]=e4; }
365 Row(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
const E& e5)
366 { assert(N==6);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2;
367 (*this)[3]=e3;(*this)[4]=e4;(*this)[5]=e5; }
368 Row(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
const E& e5,
const E& e6)
369 { assert(N==7);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2;
370 (*this)[3]=e3;(*this)[4]=e4;(*this)[5]=e5;(*this)[6]=e6; }
371 Row(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
const E& e5,
const E& e6,
const E& e7)
372 { assert(N==8);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2;
373 (*this)[3]=e3;(*this)[4]=e4;(*this)[5]=e5;(*this)[6]=e6;(*this)[7]=e7; }
374 Row(
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)
375 { assert(N==9);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2;
376 (*this)[3]=e3;(*this)[4]=e4;(*this)[5]=e5;(*this)[6]=e6;(*this)[7]=e7;(*this)[8]=e8; }
380 template <
class EE>
explicit Row(
const EE* p)
381 { assert(p);
for(
int i=0;i<N;++i) d[i*STRIDE]=p[i]; }
383 { assert(p);
for(
int i=0;i<N;++i) d[i*STRIDE]=p[i];
return *
this; }
391 {
for(
int i=0;i<N;++i) d[i*STRIDE] += r[i];
return *
this; }
393 {
for(
int i=0;i<N;++i) d[i*STRIDE] -= -(
r[i]);
return *
this; }
395 {
for(
int i=0;i<N;++i) d[i*STRIDE] -= r[i];
return *
this; }
397 {
for(
int i=0;i<N;++i) d[i*STRIDE] += -(
r[i]);
return *
this; }
425 template <
int MatNCol,
class EE,
int CS,
int RS>
429 for (
int j=0;j<N;++j) result[j] = conformingMultiply(
m(j));
449 const E&
operator[](
int i)
const { assert(0 <= i && i < N);
return d[i*STRIDE]; }
450 E&
operator[](
int i) { assert(0 <= i && i < N);
return d[i*STRIDE]; }
454 ScalarNormSq
normSqr()
const {
return scalarNormSqr(); }
471 return castAwayNegatorIfAny() / (SignInterpretation*
norm());
473 TNormalize elementwiseNormalized;
474 for (
int j=0; j<N; ++j)
476 return elementwiseNormalized;
480 TInvert
invert()
const {assert(
false);
return TInvert();}
488 const TNeg&
negate()
const {
return *
reinterpret_cast<const TNeg*
>(
this); }
489 TNeg&
updNegate() {
return *
reinterpret_cast<TNeg*
>(
this); }
491 const THerm&
transpose()
const {
return *
reinterpret_cast<const THerm*
>(
this); }
495 {
return *
reinterpret_cast<const TPosTrans*
>(
this); }
497 {
return *
reinterpret_cast<TPosTrans*
>(
this); }
504 const int offs = ImagOffset;
505 const EImag* p =
reinterpret_cast<const EImag*
>(
this);
506 return *
reinterpret_cast<const TImag*
>(p+offs);
509 const int offs = ImagOffset;
510 EImag* p =
reinterpret_cast<EImag*
>(
this);
511 return *
reinterpret_cast<TImag*
>(p+offs);
529 for (
int j=0; j<N; ++j) result[j] = (*
this)[j] * e;
535 for (
int j=0; j<N; ++j) result[j] = e * (*
this)[j];
544 for (
int j=0; j<N; ++j) result[j] = (*
this)[j] / e;
550 for (
int j=0; j<N; ++j) result[j] = e / (*
this)[j];
557 for (
int j=0; j<N; ++j) result[j] = (*
this)[j] + e;
565 for (
int j=0; j<N; ++j) result[j] = (*
this)[j] - e;
571 for (
int j=0; j<N; ++j) result[j] = e - (*
this)[j];
578 template <
class EE>
Row& operator =(
const EE& e) {
return scalarEq(e);}
582 template <
class EE>
Row&
operator/=(
const EE& e) {
return scalarDivideEq(e);}
587 {
for(
int i=0;i<N;++i) d[i*STRIDE] = ee;
return *
this; }
589 {
for(
int i=0;i<N;++i) d[i*STRIDE] += ee;
return *
this; }
591 {
for(
int i=0;i<N;++i) d[i*STRIDE] -= ee;
return *
this; }
593 {
for(
int i=0;i<N;++i) d[i*STRIDE] = ee - d[i*STRIDE];
return *
this; }
595 {
for(
int i=0;i<N;++i) d[i*STRIDE] *= ee;
return *
this; }
597 {
for(
int i=0;i<N;++i) d[i*STRIDE] = ee * d[i*STRIDE];
return *
this; }
599 {
for(
int i=0;i<N;++i) d[i*STRIDE] /= ee;
return *
this; }
601 {
for(
int i=0;i<N;++i) d[i*STRIDE] = ee / d[i*STRIDE];
return *
this; }
632 assert(0 <= j && j + NN <= N);
642 assert(0 <= j && j + NN <= N);
651 assert(0 <= j && j + N <= NN);
659 assert(0 <= j && j + N <= NN);
667 assert(0 <= p && p < N);
670 for (
int i=0; i<N-1; ++i, ++nxt) {
672 out[i] = (*this)[nxt];
694 assert(0 <= p && p <= N);
695 if (p==N)
return append1(v);
698 for (
int i=0; i<N; ++i, ++nxt) {
699 if (i==p) out[nxt++] = v;
700 out[nxt] = (*this)[i];
707 static const Row&
getAs(
const ELT* p) {
return *
reinterpret_cast<const Row*
>(p);}
719 for (
int j=0; j<N; ++j)
728 bool seenInf =
false;
729 for (
int j=0; j<N; ++j) {
730 const ELT& e = (*this)[j];
743 for (
int j=0; j<N; ++j)
755 template <
class E2,
int CS2>
757 for (
int j=0; j<N; ++j)
766 template <
class E2,
int CS2>
778 double tol = getDefaultTolerance())
const 780 for (
int j=0; j<N; ++j)
786 ELT d[NActualElements];
795 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline 803 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline 811 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline bool 813 for (
int i=0; i < N; ++i)
if (l[i] != r[i])
return false;
817 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline bool 821 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline bool 823 {
for (
int i=0; i < N; ++i) if (l[i] >=
r[i])
return false;
826 template <
int N,
class E1,
int S1,
class E2>
inline bool 827 operator<(const Row<N,E1,S1>& v,
const E2& e)
828 {
for (
int i=0; i < N; ++i) if (v[i] >= e)
return false;
832 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline bool 834 {
for (
int i=0; i < N; ++i)
if (l[i] <= r[i])
return false;
837 template <
int N,
class E1,
int S1,
class E2>
inline bool 839 {
for (
int i=0; i < N; ++i)
if (v[i] <= e)
return false;
844 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline bool 846 {
for (
int i=0; i < N; ++i) if (l[i] >
r[i])
return false;
850 template <
int N,
class E1,
int S1,
class E2>
inline bool 851 operator<=(const Row<N,E1,S1>& v,
const E2& e)
852 {
for (
int i=0; i < N; ++i) if (v[i] > e)
return false;
857 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline bool 859 {
for (
int i=0; i < N; ++i)
if (l[i] < r[i])
return false;
863 template <
int N,
class E1,
int S1,
class E2>
inline bool 865 {
for (
int i=0; i < N; ++i)
if (v[i] < e)
return false;
879 template <
int N,
class E,
int S>
inline 883 template <
int N,
class E,
int S>
inline 887 template <
int N,
class E,
int S>
inline 891 template <
int N,
class E,
int S>
inline 895 template <
int N,
class E,
int S>
inline 899 template <
int N,
class E,
int S>
inline 904 template <
int N,
class E,
int S>
inline 907 template <
int N,
class E,
int S>
inline 914 template <
int N,
class E,
int S,
class R>
inline 918 template <
int N,
class E,
int S,
class R>
inline 923 template <
int N,
class E,
int S,
class R>
inline 926 template <
int N,
class E,
int S,
class R>
inline 931 template <
int N,
class E,
int S,
class R>
inline 934 template <
int N,
class E,
int S,
class R>
inline 944 template <
int N,
class E,
int S>
inline 948 template <
int N,
class E,
int S>
inline 953 template <
int N,
class E,
int S>
inline 957 template <
int N,
class E,
int S>
inline 962 template <
int N,
class E,
int S>
inline 966 template <
int N,
class E,
int S>
inline 972 template <
int N,
class E,
int S>
inline 975 template <
int N,
class E,
int S>
inline 983 template <
int N,
class E,
int S,
class R>
inline 987 template <
int N,
class E,
int S,
class R>
inline 993 template <
int N,
class E,
int S,
class R>
inline 996 template <
int N,
class E,
int S,
class R>
inline 1001 template <
int N,
class E,
int S,
class R>
inline 1004 template <
int N,
class E,
int S,
class R>
inline 1016 template <
int N,
class E,
int S>
inline 1020 template <
int N,
class E,
int S>
inline 1024 template <
int N,
class E,
int S>
inline 1028 template <
int N,
class E,
int S>
inline 1032 template <
int N,
class E,
int S>
inline 1036 template <
int N,
class E,
int S>
inline 1041 template <
int N,
class E,
int S>
inline 1044 template <
int N,
class E,
int S>
inline 1051 template <
int N,
class E,
int S,
class R>
inline 1055 template <
int N,
class E,
int S,
class R>
inline 1060 template <
int N,
class E,
int S,
class R>
inline 1063 template <
int N,
class E,
int S,
class R>
inline 1068 template <
int N,
class E,
int S,
class R>
inline 1071 template <
int N,
class E,
int S,
class R>
inline 1078 template <
int N,
class E,
int S>
inline 1082 template <
int N,
class E,
int S>
inline 1087 template <
int N,
class E,
int S>
inline 1091 template <
int N,
class E,
int S>
inline 1096 template <
int N,
class E,
int S>
inline 1100 template <
int N,
class E,
int S>
inline 1106 template <
int N,
class E,
int S>
inline 1109 template <
int N,
class E,
int S>
inline 1117 template <
int N,
class E,
int S,
class R>
inline 1121 template <
int N,
class E,
int S,
class R>
inline 1127 template <
int N,
class E,
int S,
class R>
inline 1130 template <
int N,
class E,
int S,
class R>
inline 1135 template <
int N,
class E,
int S,
class R>
inline 1138 template <
int N,
class E,
int S,
class R>
inline 1144 template <
int N,
class E,
int S,
class CHAR,
class TRAITS>
inline 1145 std::basic_ostream<CHAR,TRAITS>&
1146 operator<<(std::basic_ostream<CHAR,TRAITS>& o,
const Row<N,E,S>& v) {
1147 o <<
"[" << v[0];
for(
int i=1;i<N;++i) o<<
','<<v[i]; o<<
']';
return o;
1152 template <
int N,
class E,
int S,
class CHAR,
class TRAITS>
inline 1153 std::basic_istream<CHAR,TRAITS>&
1155 CHAR openBracket, closeBracket;
1156 is >> openBracket;
if (is.fail())
return is;
1157 if (openBracket==CHAR(
'('))
1158 closeBracket = CHAR(
')');
1159 else if (openBracket==CHAR(
'['))
1160 closeBracket = CHAR(
']');
1162 closeBracket = CHAR(0);
1163 is.unget();
if (is.fail())
return is;
1166 for (
int i=0; i < N; ++i) {
1168 if (is.fail())
return is;
1170 CHAR c; is >> c;
if (is.fail())
return is;
1171 if (c !=
',') is.unget();
1172 if (is.fail())
return is;
1178 if (closeBracket != CHAR(0)) {
1179 CHAR closer; is >> closer;
if (is.fail())
return is;
1180 if (closer != closeBracket) {
1181 is.unget();
if (is.fail())
return is;
1182 is.setstate( std::ios::failbit );
1192 #endif //SimTK_SIMMATRIX_SMALLMATRIX_ROW_H_ AddCNTs< 1, N, ArgDepth, Row, ColSpacing, RowSpacing, CNT< P >::NRows, CNT< P >::NCols, CNT< P >::ArgDepth, P, CNT< P >::ColSpacing, CNT< P >::RowSpacing > AddOp
Definition: Row.h:291
AddOp::Type Add
Definition: Row.h:292
Vec< N, EHerm, STRIDE > THerm
Definition: Row.h:190
Matrix_< E > operator/(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:613
TNeg & updNegate()
Definition: Row.h:489
Row< N, typename CNT< E >::template Result< EE >::Mul > scalarMultiply(const EE &e) const
Definition: Row.h:527
Row & scalarPlusEq(int ee)
Definition: Row.h:606
PhiMatrixTranspose transpose(const PhiMatrix &phi)
Definition: SpatialAlgebra.h:720
Row & scalarMinusEq(int ee)
Definition: Row.h:607
EPrecision Precision
Definition: Row.h:213
Row & scalarTimesEqFromLeft(int ee)
Definition: Row.h:611
K::ScalarNormSq ScalarNormSq
Definition: CompositeNumericalTypes.h:166
Row(const ENeg &ne)
Definition: Row.h:347
Row< N, typename CNT< E >::template Result< EE >::Add > conformingAdd(const Row< N, EE, SS > &r) const
Vector addition тАУ use operator+ instead.
Definition: Row.h:404
K::ULessScalar ULessScalar
Definition: CompositeNumericalTypes.h:161
TImag & imag()
Definition: Row.h:508
DvdOp::Type Dvd
Definition: Row.h:287
EULessScalar ULessScalar
Definition: Row.h:210
Row TRow
Definition: Row.h:193
K::TReal TReal
Definition: CompositeNumericalTypes.h:141
Vec< N, EInvert, 1 > TInvert
Definition: Row.h:201
EStandard sum() const
Definition: Row.h:254
Row & scalarDivideEq(const EE &ee)
Definition: Row.h:598
Row & scalarEq(const EE &ee)
Definition: Row.h:586
Row< N, typename CNT< EE >::template Result< E >::Sub > scalarSubtractFromLeft(const EE &e) const
Definition: Row.h:569
Row< N, E, STRIDE > T
Definition: Row.h:181
Row(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5)
Definition: Row.h:365
This is a small, fixed-size symmetric or Hermitian matrix designed for no-overhead inline computation...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:608
Row & scalarTimesEq(const EE &ee)
Definition: Row.h:594
Row & scalarDivideEqFromLeft(const EE &ee)
Definition: Row.h:600
Row & operator=(const Row< N, EE, SS > &vv)
Definition: Row.h:386
TNeg & operator-()
Definition: Row.h:484
that is
Definition: SimmathUserGuide.doc:215
EScalar Scalar
Definition: Row.h:209
Row & scalarPlusEq(const EE &ee)
Definition: Row.h:588
Row & operator+=(const Row< N, EE, SS > &r)
Definition: Row.h:390
Row< N, typename CNT< E >::template Result< EE >::Mul > elementwiseMultiply(const Row< N, EE, SS > &r) const
Elementwise multiply (Matlab .
Definition: Row.h:435
TAbs abs() const
Definition: Row.h:240
MulOpNonConforming::Type MulNon
Definition: Row.h:281
Row & operator-=(const Row< N, negator< EE >, SS > &r)
Definition: Row.h:396
THerm & updTranspose()
Definition: Row.h:492
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
NTraits< N >::StdNumber StdNumber
Definition: negator.h:107
SimTK::conjugate<R> should be instantiated only for float, double, long double.
Definition: String.h:45
K::TSqrt TSqrt
Definition: CompositeNumericalTypes.h:154
SymMat< N, ESqHermT > TSqHermT
Definition: Row.h:204
static TSqrt sqrt(const K &t)
Definition: CompositeNumericalTypes.h:239
Row(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: Row.h:374
K::Scalar Scalar
Definition: CompositeNumericalTypes.h:160
Row< N, EWithoutNegator, STRIDE > TWithoutNegator
Definition: Row.h:183
Row & operator=(const EE *p)
Definition: Row.h:382
K::TNormalize TNormalize
Definition: CompositeNumericalTypes.h:158
Matrix_< typename CNT< E1 >::template Result< E2 >::Sub > operator-(const MatrixBase< E1 > &l, const MatrixBase< E2 > &r)
Definition: BigMatrix.h:584
ENumber Number
Definition: Row.h:211
K::TImag TImag
Definition: CompositeNumericalTypes.h:142
MulCNTsNonConforming< 1, N, ArgDepth, Row, ColSpacing, RowSpacing, CNT< P >::NRows, CNT< P >::NCols, CNT< P >::ArgDepth, P, CNT< P >::ColSpacing, CNT< P >::RowSpacing > MulOpNonConforming
Definition: Row.h:280
Row & operator-=(const EE &e)
Definition: Row.h:580
static int size()
Definition: Row.h:216
Row< N, typename CNT< E >::template Result< P >::Add, 1 > Add
Definition: Row.h:266
CNT< ScalarNormSq >::TSqrt norm() const
Definition: Row.h:456
std::basic_istream< CHAR, TRAITS > & operator>>(std::basic_istream< CHAR, TRAITS > &is, conjugate< R > &c)
Definition: conjugate.h:800
Row< N, EReal, STRIDE *CNT< E >::RealStrideFactor > TReal
Definition: Row.h:186
const E & operator()(int i) const
Definition: Row.h:451
MulCNTs< 1, N, ArgDepth, Row, ColSpacing, RowSpacing, CNT< P >::NRows, CNT< P >::NCols, CNT< P >::ArgDepth, P, CNT< P >::ColSpacing, CNT< P >::RowSpacing > MulOp
Definition: Row.h:275
negator<N>, where N is a number type (real, complex, conjugate), is represented in memory identically...
Definition: String.h:44
Definition: CompositeNumericalTypes.h:120
Row & operator/=(const EE &e)
Definition: Row.h:582
static double getDefaultTolerance()
Definition: CompositeNumericalTypes.h:269
Row(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5, const E &e6)
Definition: Row.h:368
bool isInf() const
Return true if any element of this Row contains a +Infinity or -Infinity somewhere but no element con...
Definition: Row.h:727
TPosTrans & updPositionalTranspose()
Definition: Row.h:496
bool operator==(const PhiMatrix &p1, const PhiMatrix &p2)
Definition: SpatialAlgebra.h:774
ScalarNormSq scalarNormSqr() const
Definition: Row.h:222
Row & operator=(const Row &src)
Definition: Row.h:319
static TStandard standardize(const K &t)
Definition: CompositeNumericalTypes.h:241
Row< N+1, ELT, 1 > insert1(int p, const EE &v) const
Return a row one larger than this one by inserting an element before the indicated one...
Definition: Row.h:693
const THerm & operator~() const
Definition: Row.h:485
Row(int i)
Definition: Row.h:352
static Row & updSubRow(Row< NN, ELT, STRIDE > &r, int j)
Extract a subvector of type Row from a longer one that has the same element type and stride...
Definition: Row.h:658
m
Definition: CMakeCache.txt:469
Row & scalarMinusEqFromLeft(int ee)
Definition: Row.h:610
Row< N, typename CNT< EE >::template Result< E >::Dvd > scalarDivideFromLeft(const EE &e) const
Definition: Row.h:548
Row(const Row< N, EE, SS > &vv)
Definition: Row.h:338
Row< N, P > Type
Definition: Row.h:302
ELEM sum(const VectorBase< ELEM > &v)
Definition: VectorMath.h:147
K::TSqTHerm TSqTHerm
Definition: CompositeNumericalTypes.h:147
Row< N, EAbs, 1 > TAbs
Definition: Row.h:199
Row(const E &e0, const E &e1, const E &e2)
Definition: Row.h:358
TNormalize normalize() const
Definition: Row.h:469
THerm & operator~()
Definition: Row.h:486
Row(const EE *p)
Definition: Row.h:380
DvdCNTs< 1, N, ArgDepth, Row, ColSpacing, RowSpacing, CNT< P >::NRows, CNT< P >::NCols, CNT< P >::ArgDepth, P, CNT< P >::ColSpacing, CNT< P >::RowSpacing > DvdOp
Definition: Row.h:286
Row< N, typename CNT< E >::template Result< EE >::Sub > conformingSubtract(const Row< N, EE, SS > &r) const
Vector subtraction тАУ use operator- instead.
Definition: Row.h:412
This is a fixed-length column vector designed for no-overhead inline computation. ...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:605
Row< N, EComplex, STRIDE > TComplex
Definition: Row.h:189
Row & operator-=(const Row< N, EE, SS > &r)
Definition: Row.h:394
K::Precision Precision
Definition: CompositeNumericalTypes.h:164
static Row & updAs(ELT *p)
Recast a writable ordinary C++ array E[] to a writable Row<N,E,S>; assumes compatible length...
Definition: Row.h:710
Row< N, typename CNT< EE >::template Result< E >::Mul > scalarMultiplyFromLeft(const EE &e) const
Definition: Row.h:533
SubOp::Type Sub
Definition: Row.h:297
Matrix_< E > operator*(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:605
Row & scalarTimesEq(int ee)
Definition: Row.h:608
void elementwiseDivide(const Row< 1, E1, S1 > &r1, const Row< 1, E2, S2 > &r2, Row< 1, typename CNT< E1 >::template Result< E2 >::Dvd > &result)
Definition: Row.h:90
K::TInvert TInvert
Definition: CompositeNumericalTypes.h:157
TStandard standardize() const
Definition: Row.h:246
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
╨╧ рб▒ с ■ ╖ ╣ ■ │ ┤ ╡ ╢ ье┴ А ° ┐ ч 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
bool isNaN() const
Return true if any element of this Row contains a NaN anywhere.
Definition: Row.h:718
CNT< E >::template Result< EE >::Mul conformingMultiply(const Vec< N, EE, SS > &r) const
Same as dot product (s = row*col) тАУ use operator* or dot() instead.
Definition: Row.h:420
ELEM max(const VectorBase< ELEM > &v)
Definition: VectorMath.h:251
Row< N, typename CNT< E >::template Result< P >::Sub, 1 > Sub
Definition: Row.h:267
Row & scalarMinusEq(const EE &ee)
Definition: Row.h:590
E & operator()(int i)
Definition: Row.h:452
static double getDefaultTolerance()
For approximate comparisions, the default tolerance to use for a vector is the same as its elements' ...
Definition: Row.h:751
bool operator>=(const Row< N, E1, S1 > &l, const Row< N, E2, S2 > &r)
bool = v1[i] >= v2[i], for all elements i This is not the same as !(v1<v2).
Definition: Row.h:858
Row< MatNCol, typename CNT< E >::template Result< EE >::Mul > conformingMultiply(const Mat< N, MatNCol, EE, CS, RS > &m) const
Row times a conforming matrix, row=row*mat тАУ use operator* instead.
Definition: Row.h:427
EScalarNormSq ScalarNormSq
Definition: Row.h:214
TSqrt sqrt() const
Definition: Row.h:231
MulOp::Type Mul
Definition: Row.h:276
K::TPosTrans TPosTrans
Definition: CompositeNumericalTypes.h:145
void elementwiseMultiply(const Row< 1, E1, S1 > &r1, const Row< 1, E2, S2 > &r2, Row< 1, typename CNT< E1 >::template Result< E2 >::Mul > &result)
Definition: Row.h:75
float norm(const conjugate< float > &c)
Definition: conjugate.h:775
Row()
Definition: Row.h:307
Row(const Row &src)
Definition: Row.h:316
TWithoutNegator & updCastAwayNegatorIfAny()
Definition: Row.h:515
const Row & operator+() const
Definition: Row.h:482
Row< N, typename CNT< E >::template Result< EE >::Dvd > scalarDivide(const EE &e) const
Definition: Row.h:542
K::StdNumber StdNumber
Definition: CompositeNumericalTypes.h:163
Row & scalarEq(int ee)
Definition: Row.h:605
RowVectorBase< typename CNT< ELEM >::TAbs > abs(const RowVectorBase< ELEM > &v)
Definition: VectorMath.h:120
Row< N, typename CNT< E >::template Result< EE >::Dvd > elementwiseDivide(const Row< N, EE, SS > &r) const
Elementwise divide (Matlab .
Definition: Row.h:443
bool operator!=(const conjugate< R > &a, const float &b)
Definition: conjugate.h:859
Row< N, typename CNT< E >::template Result< EE >::Add > scalarAdd(const EE &e) const
Definition: Row.h:555
Row< N, typename CNT< E >::template Result< P >::Mul, 1 > Mul
Definition: Row.h:264
Specialized information about Composite Numerical Types which allows us to define appropriate templat...
Definition: CompositeNumericalTypes.h:136
Row & scalarMinusEqFromLeft(const EE &ee)
Definition: Row.h:592
bool isFinite() const
Return true if no element of this Row contains an Infinity or a NaN anywhere.
Definition: Row.h:742
TInvert invert() const
Definition: Row.h:480
const TNeg & negate() const
Definition: Row.h:488
This is a fixed-length row vector designed for no-overhead inline computation.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:606
Row< N, EStandard, 1 > TStandard
Definition: Row.h:200
Row< N, EImag, STRIDE *CNT< E >::RealStrideFactor > TImag
Definition: Row.h:188
E & operator[](int i)
Definition: Row.h:450
const Real E
e = Real(exp(1))
const TWithoutNegator & castAwayNegatorIfAny() const
Definition: Row.h:514
Mandatory first inclusion for any Simbody source or header file.
bool isNumericallyEqual(const Row< N, E2, CS2 > &r) const
Test whether this row vector is numerically equal to some other row with the same shape...
Definition: Row.h:767
Row< N, typename CNT< E >::template Result< P >::Dvd, 1 > Dvd
Definition: Row.h:265
static const Row & getAs(const ELT *p)
Recast an ordinary C++ array E[] to a const Row<N,E,S>; assumes compatible length, stride, and packing.
Definition: Row.h:707
Row & operator+=(const Row< N, negator< EE >, SS > &r)
Definition: Row.h:392
K::TNeg TNeg
Definition: CompositeNumericalTypes.h:139
Row< N-1, ELT, 1 > drop1(int p) const
Return a row one smaller than this one by dropping the element at the indicated position p...
Definition: Row.h:666
static Row< N, ELT, 1 > getNaN()
Return a Row of the same length and element type as this one but with all elements set to NaN...
Definition: Row.h:715
K::TStandard TStandard
Definition: CompositeNumericalTypes.h:156
Row(const Row< N, ENeg, SS > &src)
Definition: Row.h:332
Row & operator*=(const EE &e)
Definition: Row.h:581
void copy(Row< 1, E1, S1 > &r1, const Row< 1, E2, S2 > &r2)
Definition: Row.h:105
K::TWithoutNegator TWithoutNegator
Definition: CompositeNumericalTypes.h:140
const Row< NN, ELT, STRIDE > & getSubRow(int j) const
Extract a const reference to a sub-Row with size known at compile time.
Definition: Row.h:631
Row & scalarTimesEqFromLeft(const EE &ee)
Definition: Row.h:596
Row< N, ENormalize, 1 > TNormalize
Definition: Row.h:202
void conformingSubtract(const Row< 1, E1, S1 > &r1, const Row< 1, E2, S2 > &r2, Row< 1, typename CNT< E1 >::template Result< E2 >::Sub > &result)
Definition: Row.h:60
Row< N, ENeg, STRIDE > TNeg
Definition: Row.h:182
Row & scalarDivideEq(int ee)
Definition: Row.h:609
Matrix_< typename CNT< E1 >::template Result< E2 >::Add > operator+(const MatrixBase< E1 > &l, const MatrixBase< E2 > &r)
Definition: BigMatrix.h:568
Row(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: Row.h:371
SubCNTs< 1, N, ArgDepth, Row, ColSpacing, RowSpacing, CNT< P >::NRows, CNT< P >::NCols, CNT< P >::ArgDepth, P, CNT< P >::ColSpacing, CNT< P >::RowSpacing > SubOp
Definition: Row.h:296
void setToZero()
Set every scalar in this Row to zero.
Definition: Row.h:621
Row & scalarDivideEqFromLeft(int ee)
Definition: Row.h:612
EStdNumber StdNumber
Definition: Row.h:212
static int nrow()
Definition: Row.h:217
const THerm & transpose() const
Definition: Row.h:491
E TElement
Definition: Row.h:192
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
E TCol
Definition: Row.h:194
K::TComplex TComplex
Definition: CompositeNumericalTypes.h:143
bool isNumericallyEqual(const Row< N, E2, CS2 > &r, double tol) const
Test whether this row is numerically equal to some other row with the same shape, using a specified t...
Definition: Row.h:756
TReal & real()
Definition: Row.h:500
K::Number Number
Definition: CompositeNumericalTypes.h:162
const TReal & real() const
Definition: Row.h:499
static K getNaN()
Definition: CompositeNumericalTypes.h:246
Row(const E &e0, const E &e1)
Definition: Row.h:356
Vec< N, ESqrt, 1 > TSqrt
Definition: Row.h:198
Row(const E &e)
Definition: Row.h:343
ScalarNormSq normSqr() const
Definition: Row.h:454
K::TSqHermT TSqHermT
Definition: CompositeNumericalTypes.h:146
const E & operator[](int i) const
Definition: Row.h:449
const TImag & imag() const
Definition: Row.h:503
bool operator>(const Row< N, E1, S1 > &l, const Row< N, E2, S2 > &r)
bool = v1[i] > v2[i], for all elements i
Definition: Row.h:833
const TPosTrans & positionalTranspose() const
Definition: Row.h:494
K::THerm THerm
Definition: CompositeNumericalTypes.h:144
const TNeg & operator-() const
Definition: Row.h:483
Row(const E &e0, const E &e1, const E &e2, const E &e3)
Definition: Row.h:360
Row & operator+=(const EE &e)
Definition: Row.h:579
static int ncol()
Definition: Row.h:218
Row< NN, ELT, STRIDE > & updSubRow(int j)
Extract a writable reference to a sub-Row with size known at compile time.
Definition: Row.h:641
Row(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4)
Definition: Row.h:362
void setToNaN()
Set every scalar in this Row to NaN; this is the default initial value in Debug builds, but not in Release.
Definition: Row.h:616
void conformingAdd(const Row< 1, E1, S1 > &r1, const Row< 1, E2, S2 > &r2, Row< 1, typename CNT< E1 >::template Result< E2 >::Add > &result)
Definition: Row.h:45
Row(const Row< N, E, SS > &src)
Definition: Row.h:326
Vec< N, E, STRIDE > TPosTrans
Definition: Row.h:191
Row< N, typename CNT< E >::template Result< EE >::Sub > scalarSubtract(const EE &e) const
Definition: Row.h:563
Row< N+1, ELT, 1 > append1(const EE &v) const
Return a row one larger than this one by adding an element to the end.
Definition: Row.h:680
K::TAbs TAbs
Definition: CompositeNumericalTypes.h:155
bool isNumericallyEqual(const float &a, const float &b, double tol=RTraits< float >::getDefaultTolerance())
Compare two floats for approximate equality.
Definition: NTraits.h:313
EScalarNormSq TSqTHerm
Definition: Row.h:205
static const Row & getSubRow(const Row< NN, ELT, STRIDE > &r, int j)
Extract a subvector of type Row from a longer one that has the same element type and stride...
Definition: Row.h:650