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));
118 template <
int N,
class ELT,
int STRIDE>
class Row {
202 static int size() {
return N; }
203 static int nrow() {
return 1; }
204 static int ncol() {
return N; }
210 for(
int i=0;i<N;++i) sum += CNT<E>::scalarNormSqr(d[i*STRIDE]);
219 for(
int i=0;i<N;++i) rsqrt[i] = CNT<E>::sqrt(d[i*STRIDE]);
234 for(
int i=0;i<N;++i) rstd[i] = CNT<E>::standardize(d[i*STRIDE]);
242 for (
int i=0;i<N;++i) sum += d[i*STRIDE];
262 typedef typename MulOp::Type
Mul;
267 typedef typename MulOpNonConforming::Type
MulNon;
273 typedef typename DvdOp::Type
Dvd;
278 typedef typename AddOp::Type
Add;
283 typedef typename SubOp::Type
Sub;
330 {
for (
int i=0;i<N;++i) d[i*STRIDE]=e; }
333 explicit Row(
const ENeg& ne)
334 {
for (
int i=0;i<N;++i) d[i*STRIDE]=ne; }
342 Row(
const E& e0,
const E& e1)
343 { assert(N==2);(*this)[0]=e0;(*this)[1]=e1; }
344 Row(
const E& e0,
const E& e1,
const E& e2)
345 { assert(N==3);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2; }
346 Row(
const E& e0,
const E& e1,
const E& e2,
const E& e3)
347 { assert(N==4);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2;(*this)[3]=e3; }
348 Row(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4)
349 { assert(N==5);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2;
350 (*this)[3]=e3;(*this)[4]=e4; }
351 Row(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
const E& e5)
352 { assert(N==6);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2;
353 (*this)[3]=e3;(*this)[4]=e4;(*this)[5]=e5; }
354 Row(
const E& e0,
const E& e1,
const E& e2,
const E& e3,
const E& e4,
const E& e5,
const E& e6)
355 { assert(N==7);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2;
356 (*this)[3]=e3;(*this)[4]=e4;(*this)[5]=e5;(*this)[6]=e6; }
357 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)
358 { assert(N==8);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2;
359 (*this)[3]=e3;(*this)[4]=e4;(*this)[5]=e5;(*this)[6]=e6;(*this)[7]=e7; }
360 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)
361 { assert(N==9);(*this)[0]=e0;(*this)[1]=e1;(*this)[2]=e2;
362 (*this)[3]=e3;(*this)[4]=e4;(*this)[5]=e5;(*this)[6]=e6;(*this)[7]=e7;(*this)[8]=e8; }
366 template <
class EE>
explicit Row(
const EE* p)
367 { assert(p);
for(
int i=0;i<N;++i) d[i*STRIDE]=p[i]; }
369 { assert(p);
for(
int i=0;i<N;++i) d[i*STRIDE]=p[i];
return *
this; }
377 {
for(
int i=0;i<N;++i) d[i*STRIDE] += r[i];
return *
this; }
379 {
for(
int i=0;i<N;++i) d[i*STRIDE] -= -(r[i]);
return *
this; }
381 {
for(
int i=0;i<N;++i) d[i*STRIDE] -= r[i];
return *
this; }
383 {
for(
int i=0;i<N;++i) d[i*STRIDE] += -(r[i]);
return *
this; }
411 template <
int MatNCol,
class EE,
int CS,
int RS>
435 const E&
operator[](
int i)
const { assert(0 <= i && i < N);
return d[i*STRIDE]; }
436 E&
operator[](
int i) { assert(0 <= i && i < N);
return d[i*STRIDE]; }
459 TNormalize elementwiseNormalized;
460 for (
int j=0; j<N; ++j)
462 return elementwiseNormalized;
474 const TNeg&
negate()
const {
return *
reinterpret_cast<const TNeg*
>(
this); }
475 TNeg&
updNegate() {
return *
reinterpret_cast<TNeg*
>(
this); }
477 const THerm&
transpose()
const {
return *
reinterpret_cast<const THerm*
>(
this); }
481 {
return *
reinterpret_cast<const TPosTrans*
>(
this); }
483 {
return *
reinterpret_cast<TPosTrans*
>(
this); }
491 const EImag* p =
reinterpret_cast<const EImag*
>(
this);
492 return *
reinterpret_cast<const TImag*
>(p+offs);
496 EImag* p =
reinterpret_cast<EImag*
>(
this);
497 return *
reinterpret_cast<TImag*
>(p+offs);
515 for (
int j=0; j<N; ++j) result[j] = (*
this)[j] * e;
521 for (
int j=0; j<N; ++j) result[j] = e * (*
this)[j];
530 for (
int j=0; j<N; ++j) result[j] = (*
this)[j] / e;
536 for (
int j=0; j<N; ++j) result[j] = e / (*
this)[j];
543 for (
int j=0; j<N; ++j) result[j] = (*
this)[j] + e;
551 for (
int j=0; j<N; ++j) result[j] = (*
this)[j] - e;
557 for (
int j=0; j<N; ++j) result[j] = e - (*
this)[j];
573 {
for(
int i=0;i<N;++i) d[i*STRIDE] = ee;
return *
this; }
575 {
for(
int i=0;i<N;++i) d[i*STRIDE] += ee;
return *
this; }
577 {
for(
int i=0;i<N;++i) d[i*STRIDE] -= ee;
return *
this; }
579 {
for(
int i=0;i<N;++i) d[i*STRIDE] = ee - d[i*STRIDE];
return *
this; }
581 {
for(
int i=0;i<N;++i) d[i*STRIDE] *= ee;
return *
this; }
583 {
for(
int i=0;i<N;++i) d[i*STRIDE] = ee * d[i*STRIDE];
return *
this; }
585 {
for(
int i=0;i<N;++i) d[i*STRIDE] /= ee;
return *
this; }
587 {
for(
int i=0;i<N;++i) d[i*STRIDE] = ee / d[i*STRIDE];
return *
this; }
618 assert(0 <= j && j + NN <= N);
628 assert(0 <= j && j + NN <= N);
637 assert(0 <= j && j + N <= NN);
645 assert(0 <= j && j + N <= NN);
653 assert(0 <= p && p < N);
656 for (
int i=0; i<N-1; ++i, ++nxt) {
658 out[i] = (*this)[nxt];
680 assert(0 <= p && p <= N);
684 for (
int i=0; i<N; ++i, ++nxt) {
685 if (i==p) out[nxt++] = v;
686 out[nxt] = (*this)[i];
693 static const Row&
getAs(
const ELT* p) {
return *
reinterpret_cast<const Row*
>(p);}
705 for (
int j=0; j<N; ++j)
714 bool seenInf =
false;
715 for (
int j=0; j<N; ++j) {
716 const ELT& e = (*this)[j];
729 for (
int j=0; j<N; ++j)
741 template <
class E2,
int CS2>
743 for (
int j=0; j<N; ++j)
752 template <
class E2,
int CS2>
766 for (
int j=0; j<N; ++j)
781 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline
782 typename Row<N,E1,S1>::template Result< Row<N,E2,S2> >::Add
785 ::AddOp::perform(l,r);
789 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline
790 typename Row<N,E1,S1>::template Result< Row<N,E2,S2> >::Sub
793 ::SubOp::perform(l,r);
797 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline bool
799 for (
int i=0; i < N; ++i)
if (l[i] != r[i])
return false;
803 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline bool
807 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline bool
809 {
for (
int i=0; i < N; ++i) if (l[i] >= r[i])
return false;
812 template <
int N,
class E1,
int S1,
class E2>
inline bool
813 operator<(const Row<N,E1,S1>& v,
const E2& e)
814 {
for (
int i=0; i < N; ++i) if (v[i] >= e)
return false;
818 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline bool
820 {
for (
int i=0; i < N; ++i)
if (l[i] <= r[i])
return false;
823 template <
int N,
class E1,
int S1,
class E2>
inline bool
825 {
for (
int i=0; i < N; ++i)
if (v[i] <= e)
return false;
830 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline bool
832 {
for (
int i=0; i < N; ++i) if (l[i] > r[i])
return false;
836 template <
int N,
class E1,
int S1,
class E2>
inline bool
837 operator<=(const Row<N,E1,S1>& v,
const E2& e)
838 {
for (
int i=0; i < N; ++i) if (v[i] > e)
return false;
843 template <
int N,
class E1,
int S1,
class E2,
int S2>
inline bool
845 {
for (
int i=0; i < N; ++i)
if (l[i] < r[i])
return false;
849 template <
int N,
class E1,
int S1,
class E2>
inline bool
851 {
for (
int i=0; i < N; ++i)
if (v[i] < e)
return false;
865 template <
int N,
class E,
int S>
inline
866 typename Row<N,E,S>::template Result<float>::Mul
869 template <
int N,
class E,
int S>
inline
870 typename Row<N,E,S>::template Result<float>::Mul
873 template <
int N,
class E,
int S>
inline
874 typename Row<N,E,S>::template Result<double>::Mul
877 template <
int N,
class E,
int S>
inline
878 typename Row<N,E,S>::template Result<double>::Mul
881 template <
int N,
class E,
int S>
inline
882 typename Row<N,E,S>::template Result<long double>::Mul
885 template <
int N,
class E,
int S>
inline
886 typename Row<N,E,S>::template Result<long double>::Mul
890 template <
int N,
class E,
int S>
inline
891 typename Row<N,E,S>::template Result<typename CNT<E>::Precision>::Mul
893 template <
int N,
class E,
int S>
inline
894 typename Row<N,E,S>::template Result<typename CNT<E>::Precision>::Mul
900 template <
int N,
class E,
int S,
class R>
inline
901 typename Row<N,E,S>::template Result<std::complex<R> >::Mul
904 template <
int N,
class E,
int S,
class R>
inline
905 typename Row<N,E,S>::template Result<std::complex<R> >::Mul
909 template <
int N,
class E,
int S,
class R>
inline
910 typename Row<N,E,S>::template Result<std::complex<R> >::Mul
912 template <
int N,
class E,
int S,
class R>
inline
913 typename Row<N,E,S>::template Result<std::complex<R> >::Mul
917 template <
int N,
class E,
int S,
class R>
inline
918 typename Row<N,E,S>::template Result<typename negator<R>::StdNumber>::Mul
920 template <
int N,
class E,
int S,
class R>
inline
921 typename Row<N,E,S>::template Result<typename negator<R>::StdNumber>::Mul
930 template <
int N,
class E,
int S>
inline
931 typename Row<N,E,S>::template Result<float>::Dvd
934 template <
int N,
class E,
int S>
inline
935 typename CNT<float>::template Result<Row<N,E,S> >::Dvd
939 template <
int N,
class E,
int S>
inline
940 typename Row<N,E,S>::template Result<double>::Dvd
943 template <
int N,
class E,
int S>
inline
944 typename CNT<double>::template Result<Row<N,E,S> >::Dvd
948 template <
int N,
class E,
int S>
inline
949 typename Row<N,E,S>::template Result<long double>::Dvd
952 template <
int N,
class E,
int S>
inline
953 typename CNT<long double>::template Result<Row<N,E,S> >::Dvd
958 template <
int N,
class E,
int S>
inline
959 typename Row<N,E,S>::template Result<typename CNT<E>::Precision>::Dvd
961 template <
int N,
class E,
int S>
inline
962 typename CNT<typename CNT<E>::Precision>::template Result<Row<N,E,S> >::Dvd
969 template <
int N,
class E,
int S,
class R>
inline
970 typename Row<N,E,S>::template Result<std::complex<R> >::Dvd
973 template <
int N,
class E,
int S,
class R>
inline
974 typename CNT<std::complex<R> >::template Result<Row<N,E,S> >::Dvd
979 template <
int N,
class E,
int S,
class R>
inline
980 typename Row<N,E,S>::template Result<std::complex<R> >::Dvd
982 template <
int N,
class E,
int S,
class R>
inline
983 typename CNT<std::complex<R> >::template Result<Row<N,E,S> >::Dvd
987 template <
int N,
class E,
int S,
class R>
inline
988 typename Row<N,E,S>::template Result<typename negator<R>::StdNumber>::Dvd
990 template <
int N,
class E,
int S,
class R>
inline
991 typename CNT<R>::template Result<Row<N,E,S> >::Dvd
1002 template <
int N,
class E,
int S>
inline
1003 typename Row<N,E,S>::template Result<float>::Add
1006 template <
int N,
class E,
int S>
inline
1007 typename Row<N,E,S>::template Result<float>::Add
1010 template <
int N,
class E,
int S>
inline
1011 typename Row<N,E,S>::template Result<double>::Add
1014 template <
int N,
class E,
int S>
inline
1015 typename Row<N,E,S>::template Result<double>::Add
1018 template <
int N,
class E,
int S>
inline
1019 typename Row<N,E,S>::template Result<long double>::Add
1022 template <
int N,
class E,
int S>
inline
1023 typename Row<N,E,S>::template Result<long double>::Add
1027 template <
int N,
class E,
int S>
inline
1028 typename Row<N,E,S>::template Result<typename CNT<E>::Precision>::Add
1030 template <
int N,
class E,
int S>
inline
1031 typename Row<N,E,S>::template Result<typename CNT<E>::Precision>::Add
1037 template <
int N,
class E,
int S,
class R>
inline
1038 typename Row<N,E,S>::template Result<std::complex<R> >::Add
1041 template <
int N,
class E,
int S,
class R>
inline
1042 typename Row<N,E,S>::template Result<std::complex<R> >::Add
1046 template <
int N,
class E,
int S,
class R>
inline
1047 typename Row<N,E,S>::template Result<std::complex<R> >::Add
1049 template <
int N,
class E,
int S,
class R>
inline
1050 typename Row<N,E,S>::template Result<std::complex<R> >::Add
1054 template <
int N,
class E,
int S,
class R>
inline
1055 typename Row<N,E,S>::template Result<typename negator<R>::StdNumber>::Add
1057 template <
int N,
class E,
int S,
class R>
inline
1058 typename Row<N,E,S>::template Result<typename negator<R>::StdNumber>::Add
1064 template <
int N,
class E,
int S>
inline
1065 typename Row<N,E,S>::template Result<float>::Sub
1068 template <
int N,
class E,
int S>
inline
1069 typename CNT<float>::template Result<Row<N,E,S> >::Sub
1073 template <
int N,
class E,
int S>
inline
1074 typename Row<N,E,S>::template Result<double>::Sub
1077 template <
int N,
class E,
int S>
inline
1078 typename CNT<double>::template Result<Row<N,E,S> >::Sub
1082 template <
int N,
class E,
int S>
inline
1083 typename Row<N,E,S>::template Result<long double>::Sub
1086 template <
int N,
class E,
int S>
inline
1087 typename CNT<long double>::template Result<Row<N,E,S> >::Sub
1092 template <
int N,
class E,
int S>
inline
1093 typename Row<N,E,S>::template Result<typename CNT<E>::Precision>::Sub
1095 template <
int N,
class E,
int S>
inline
1096 typename CNT<typename CNT<E>::Precision>::template Result<Row<N,E,S> >::Sub
1103 template <
int N,
class E,
int S,
class R>
inline
1104 typename Row<N,E,S>::template Result<std::complex<R> >::Sub
1107 template <
int N,
class E,
int S,
class R>
inline
1108 typename CNT<std::complex<R> >::template Result<Row<N,E,S> >::Sub
1113 template <
int N,
class E,
int S,
class R>
inline
1114 typename Row<N,E,S>::template Result<std::complex<R> >::Sub
1116 template <
int N,
class E,
int S,
class R>
inline
1117 typename CNT<std::complex<R> >::template Result<Row<N,E,S> >::Sub
1121 template <
int N,
class E,
int S,
class R>
inline
1122 typename Row<N,E,S>::template Result<typename negator<R>::StdNumber>::Sub
1124 template <
int N,
class E,
int S,
class R>
inline
1125 typename CNT<R>::template Result<Row<N,E,S> >::Sub
1130 template <
int N,
class E,
int S,
class CHAR,
class TRAITS>
inline
1131 std::basic_ostream<CHAR,TRAITS>&
1132 operator<<(std::basic_ostream<CHAR,TRAITS>& o,
const Row<N,E,S>& v) {
1133 o <<
"[" << v[0];
for(
int i=1;i<N;++i) o<<
','<<v[i]; o<<
']';
return o;
1138 template <
int N,
class E,
int S,
class CHAR,
class TRAITS>
inline
1139 std::basic_istream<CHAR,TRAITS>&
1141 CHAR openBracket, closeBracket;
1142 is >> openBracket;
if (is.fail())
return is;
1143 if (openBracket==CHAR(
'('))
1144 closeBracket = CHAR(
')');
1145 else if (openBracket==CHAR(
'['))
1146 closeBracket = CHAR(
']');
1148 closeBracket = CHAR(0);
1149 is.unget();
if (is.fail())
return is;
1152 for (
int i=0; i < N; ++i) {
1154 if (is.fail())
return is;
1156 CHAR c; is >> c;
if (is.fail())
return is;
1157 if (c !=
',') is.unget();
1158 if (is.fail())
return is;
1164 if (closeBracket != CHAR(0)) {
1165 CHAR closer; is >> closer;
if (is.fail())
return is;
1166 if (closer != closeBracket) {
1167 is.unget();
if (is.fail())
return is;
1168 is.setstate( std::ios::failbit );
1178 #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:277
AddOp::Type Add
Definition: Row.h:278
Vec< N, EHerm, STRIDE > THerm
Definition: Row.h:176
Matrix_< E > operator/(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:2693
TNeg & updNegate()
Definition: Row.h:475
Row< N, typename CNT< E >::template Result< EE >::Mul > scalarMultiply(const EE &e) const
Definition: Row.h:513
Row & scalarPlusEq(int ee)
Definition: Row.h:592
Row & scalarMinusEq(int ee)
Definition: Row.h:593
EPrecision Precision
Definition: Row.h:199
Row & scalarTimesEqFromLeft(int ee)
Definition: Row.h:597
K::ScalarNormSq ScalarNormSq
Definition: CompositeNumericalTypes.h:166
Row(const ENeg &ne)
Definition: Row.h:333
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:390
K::ULessScalar ULessScalar
Definition: CompositeNumericalTypes.h:161
TImag & imag()
Definition: Row.h:494
DvdOp::Type Dvd
Definition: Row.h:273
EULessScalar ULessScalar
Definition: Row.h:196
Row TRow
Definition: Row.h:179
K::TReal TReal
Definition: CompositeNumericalTypes.h:141
Vec< N, EInvert, 1 > TInvert
Definition: Row.h:187
EStandard sum() const
Definition: Row.h:240
Row & scalarDivideEq(const EE &ee)
Definition: Row.h:584
Row & scalarEq(const EE &ee)
Definition: Row.h:572
Row< N, typename CNT< EE >::template Result< E >::Sub > scalarSubtractFromLeft(const EE &e) const
Definition: Row.h:555
Row< N, E, STRIDE > T
Definition: Row.h:167
Row(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4, const E &e5)
Definition: Row.h:351
RS is total spacing between rows in memory (default 1)
Definition: SymMat.h:71
Row & scalarTimesEq(const EE &ee)
Definition: Row.h:580
Row & scalarDivideEqFromLeft(const EE &ee)
Definition: Row.h:586
Row & operator=(const Row< N, EE, SS > &vv)
Definition: Row.h:372
TNeg & operator-()
Definition: Row.h:470
EScalar Scalar
Definition: Row.h:195
Row & scalarPlusEq(const EE &ee)
Definition: Row.h:574
Row & operator+=(const Row< N, EE, SS > &r)
Definition: Row.h:376
Row< N, typename CNT< E >::template Result< EE >::Mul > elementwiseMultiply(const Row< N, EE, SS > &r) const
Elementwise multiply (Matlab .
Definition: Row.h:421
TAbs abs() const
Definition: Row.h:226
MulOpNonConforming::Type MulNon
Definition: Row.h:267
Row & operator-=(const Row< N, negator< EE >, SS > &r)
Definition: Row.h:382
THerm & updTranspose()
Definition: Row.h:478
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:190
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:360
K::Scalar Scalar
Definition: CompositeNumericalTypes.h:160
Row< N, EWithoutNegator, STRIDE > TWithoutNegator
Definition: Row.h:169
Row & operator=(const EE *p)
Definition: Row.h:368
K::TNormalize TNormalize
Definition: CompositeNumericalTypes.h:158
ENumber Number
Definition: Row.h:197
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:266
Row & operator-=(const EE &e)
Definition: Row.h:566
static int size()
Definition: Row.h:202
Row< N, typename CNT< E >::template Result< P >::Add, 1 > Add
Definition: Row.h:252
CNT< ScalarNormSq >::TSqrt norm() const
Definition: Row.h:442
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:172
const E & operator()(int i) const
Definition: Row.h:437
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:261
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:568
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:354
bool isInf() const
Return true if any element of this Row contains a +Infinity or -Infinity somewhere but no element con...
Definition: Row.h:713
TPosTrans & updPositionalTranspose()
Definition: Row.h:482
bool operator==(const PhiMatrix &p1, const PhiMatrix &p2)
Definition: SpatialAlgebra.h:774
ScalarNormSq scalarNormSqr() const
Definition: Row.h:208
Row & operator=(const Row &src)
Definition: Row.h:305
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:679
const THerm & operator~() const
Definition: Row.h:471
Row(int i)
Definition: Row.h:338
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:644
Row & scalarMinusEqFromLeft(int ee)
Definition: Row.h:596
Row< N, typename CNT< EE >::template Result< E >::Dvd > scalarDivideFromLeft(const EE &e) const
Definition: Row.h:534
Row(const Row< N, EE, SS > &vv)
Definition: Row.h:324
Row< N, P > Type
Definition: Row.h:288
K::TSqTHerm TSqTHerm
Definition: CompositeNumericalTypes.h:147
Row< N, EAbs, 1 > TAbs
Definition: Row.h:185
Row(const E &e0, const E &e1, const E &e2)
Definition: Row.h:344
TNormalize normalize() const
Definition: Row.h:455
THerm & operator~()
Definition: Row.h:472
Row(const EE *p)
Definition: Row.h:366
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:272
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:398
This is a fixed length column vector designed for no-overhead inline computation. ...
Definition: Vec.h:131
Row< N, EComplex, STRIDE > TComplex
Definition: Row.h:175
Row & operator-=(const Row< N, EE, SS > &r)
Definition: Row.h:380
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:696
Row< N, typename CNT< EE >::template Result< E >::Mul > scalarMultiplyFromLeft(const EE &e) const
Definition: Row.h:519
SubOp::Type Sub
Definition: Row.h:283
Matrix_< E > operator*(const MatrixBase< E > &l, const typename CNT< E >::StdNumber &r)
Definition: BigMatrix.h:2685
Row & scalarTimesEq(int ee)
Definition: Row.h:594
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:232
bool isNaN() const
Return true if any element of this Row contains a NaN anywhere.
Definition: Row.h:704
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:406
ELEM max(const VectorBase< ELEM > &v)
Definition: VectorMath.h:251
NTraits< N >::StdNumber StdNumber
Definition: negator.h:107
Row< N, typename CNT< E >::template Result< P >::Sub, 1 > Sub
Definition: Row.h:253
Row & scalarMinusEq(const EE &ee)
Definition: Row.h:576
E & operator()(int i)
Definition: Row.h:438
static double getDefaultTolerance()
For approximate comparisions, the default tolerance to use for a vector is the same as its elements' ...
Definition: Row.h:737
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:844
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:413
EScalarNormSq ScalarNormSq
Definition: Row.h:200
TSqrt sqrt() const
Definition: Row.h:217
MulOp::Type Mul
Definition: Row.h:262
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
Row()
Definition: Row.h:293
Row(const Row &src)
Definition: Row.h:302
TWithoutNegator & updCastAwayNegatorIfAny()
Definition: Row.h:501
const Row & operator+() const
Definition: Row.h:468
Row< N, typename CNT< E >::template Result< EE >::Dvd > scalarDivide(const EE &e) const
Definition: Row.h:528
K::StdNumber StdNumber
Definition: CompositeNumericalTypes.h:163
Row & scalarEq(int ee)
Definition: Row.h:591
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:429
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:541
Row< N, typename CNT< E >::template Result< P >::Mul, 1 > Mul
Definition: Row.h:250
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:578
bool isFinite() const
Return true if no element of this Row contains an Infinity or a NaN anywhere.
Definition: Row.h:728
TInvert invert() const
Definition: Row.h:466
const TNeg & negate() const
Definition: Row.h:474
Generic Row.
Definition: Row.h:118
Row< N, EStandard, 1 > TStandard
Definition: Row.h:186
Row< N, EImag, STRIDE *CNT< E >::RealStrideFactor > TImag
Definition: Row.h:174
E & operator[](int i)
Definition: Row.h:436
const TWithoutNegator & castAwayNegatorIfAny() const
Definition: Row.h:500
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:753
Row< N, typename CNT< E >::template Result< P >::Dvd, 1 > Dvd
Definition: Row.h:251
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:693
Row & operator+=(const Row< N, negator< EE >, SS > &r)
Definition: Row.h:378
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:652
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:701
K::TStandard TStandard
Definition: CompositeNumericalTypes.h:156
Row(const Row< N, ENeg, SS > &src)
Definition: Row.h:318
Row & operator*=(const EE &e)
Definition: Row.h:567
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:617
Row & scalarTimesEqFromLeft(const EE &ee)
Definition: Row.h:582
Row< N, ENormalize, 1 > TNormalize
Definition: Row.h:188
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:168
Row & scalarDivideEq(int ee)
Definition: Row.h:595
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:357
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:282
void setToZero()
Set every scalar in this Row to zero.
Definition: Row.h:607
Row & scalarDivideEqFromLeft(int ee)
Definition: Row.h:598
EStdNumber StdNumber
Definition: Row.h:198
static int nrow()
Definition: Row.h:203
const THerm & transpose() const
Definition: Row.h:477
E TElement
Definition: Row.h:178
This class represents a small matrix whose size is known at compile time, containing elements of any ...
Definition: Mat.h:51
E TCol
Definition: Row.h:180
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:742
TReal & real()
Definition: Row.h:486
K::Number Number
Definition: CompositeNumericalTypes.h:162
const TReal & real() const
Definition: Row.h:485
static K getNaN()
Definition: CompositeNumericalTypes.h:246
Row(const E &e0, const E &e1)
Definition: Row.h:342
Vec< N, ESqrt, 1 > TSqrt
Definition: Row.h:184
Row(const E &e)
Definition: Row.h:329
ScalarNormSq normSqr() const
Definition: Row.h:440
K::TSqHermT TSqHermT
Definition: CompositeNumericalTypes.h:146
const E & operator[](int i) const
Definition: Row.h:435
const TImag & imag() const
Definition: Row.h:489
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:819
const TPosTrans & positionalTranspose() const
Definition: Row.h:480
K::THerm THerm
Definition: CompositeNumericalTypes.h:144
const TNeg & operator-() const
Definition: Row.h:469
Row(const E &e0, const E &e1, const E &e2, const E &e3)
Definition: Row.h:346
Row & operator+=(const EE &e)
Definition: Row.h:565
static int ncol()
Definition: Row.h:204
Row< NN, ELT, STRIDE > & updSubRow(int j)
Extract a writable reference to a sub-Row with size known at compile time.
Definition: Row.h:627
Row(const E &e0, const E &e1, const E &e2, const E &e3, const E &e4)
Definition: Row.h:348
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:602
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:312
Vec< N, E, STRIDE > TPosTrans
Definition: Row.h:177
Row< N, typename CNT< E >::template Result< EE >::Sub > scalarSubtract(const EE &e) const
Definition: Row.h:549
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:666
K::TAbs TAbs
Definition: CompositeNumericalTypes.h:155
EScalarNormSq TSqTHerm
Definition: Row.h:191
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:636