13 #ifndef OHMMS_TINYMATRIX_OPERATORS_H 14 #define OHMMS_TINYMATRIX_OPERATORS_H 32 template<
class T1,
class T2,
class OP,
unsigned D1,
unsigned D2>
37 for (
unsigned d = 0; d < D1 * D2; ++d)
42 template<
class T1,
class T2,
class OP,
unsigned D1,
unsigned D2>
47 for (
unsigned d = 0; d < D1 * D2; ++d)
57 template<
class T1,
class T2,
class OP>
63 template<
class T1,
class T2,
class OP>
73 template<
class T1,
class T2,
class OP>
83 template<
class T1,
class T2,
class OP>
93 template<
class T1,
class T2,
class OP>
103 template<
class T1,
class T2,
class OP>
116 template<
class T1,
class T2,
class OP>
127 template<
class T1,
class T2,
class OP>
138 template<
class T1,
class T2,
class OP>
149 template<
class T1,
class T2,
class OP>
163 template<
class T1,
class T2,
class OP>
175 template<
class T1,
class T2,
class OP>
191 template<
class T1,
class T2,
class OP>
208 template<
class T1,
class T2,
class OP>
229 template<
class T1,
class T2,
class OP>
244 op(lhs[10], rhs[10]);
245 op(lhs[11], rhs[11]);
246 op(lhs[12], rhs[12]);
247 op(lhs[13], rhs[13]);
248 op(lhs[14], rhs[14]);
249 op(lhs[15], rhs[15]);
253 template<
class T1,
class T2,
class OP>
288 template<
class T1,
class T2,
class OP,
unsigned D1,
unsigned D2>
297 for (
unsigned d = 0; d < D1 * D2; ++d)
298 ret[d] = op(lhs[d], rhs[d]);
303 template<
class T1,
class T2,
class OP,
unsigned D1,
unsigned D2>
310 for (
unsigned d = 0; d < D1 * D2; ++d)
311 ret[d] = op(lhs[d], rhs);
316 template<
class T1,
class T2,
class OP,
unsigned D1,
unsigned D2>
323 for (
unsigned d = 0; d < D1 * D2; ++d)
324 ret[d] = op(lhs, rhs[d]);
333 template<
class T1,
class T2,
class OP>
343 template<
class T1,
class T2,
class OP>
353 template<
class T1,
class T2,
class OP>
367 template<
class T1,
class T2,
class OP>
377 template<
class T1,
class T2,
class OP>
387 template<
class T1,
class T2,
class OP>
400 template<
class T1,
class T2,
class OP>
410 template<
class T1,
class T2,
class OP>
420 template<
class T1,
class T2,
class OP>
434 template<
class T1,
class T2,
class OP>
444 template<
class T1,
class T2,
class OP>
454 template<
class T1,
class T2,
class OP>
467 template<
class T1,
class T2,
class OP>
474 return Return_t(op(lhs[0], rhs[0]), op(lhs[1], rhs[1]), op(lhs[2], rhs[2]), op(lhs[3], rhs[3]), op(lhs[4], rhs[4]),
475 op(lhs[5], rhs[5]), op(lhs[6], rhs[6]), op(lhs[7], rhs[7]), op(lhs[8], rhs[8]));
479 template<
class T1,
class T2,
class OP>
486 return Return_t(op(lhs[0], rhs), op(lhs[1], rhs), op(lhs[2], rhs), op(lhs[3], rhs), op(lhs[4], rhs),
487 op(lhs[5], rhs), op(lhs[6], rhs), op(lhs[7], rhs), op(lhs[8], rhs));
491 template<
class T1,
class T2,
class OP>
498 return Return_t(op(lhs, rhs[0]), op(lhs, rhs[1]), op(lhs, rhs[2]), op(lhs, rhs[3]), op(lhs, rhs[4]),
499 op(lhs, rhs[5]), op(lhs, rhs[6]), op(lhs, rhs[7]), op(lhs, rhs[8]));
506 template<
class T1,
class T2,
class OP>
513 return Return_t(op(lhs[0], rhs[0]), op(lhs[1], rhs[1]), op(lhs[2], rhs[2]), op(lhs[3], rhs[3]), op(lhs[4], rhs[4]),
514 op(lhs[5], rhs[5]), op(lhs[6], rhs[6]), op(lhs[7], rhs[7]), op(lhs[8], rhs[8]), op(lhs[9], rhs[9]),
515 op(lhs[10], rhs[10]), op(lhs[11], rhs[11]), op(lhs[12], rhs[12]), op(lhs[13], rhs[13]),
516 op(lhs[14], rhs[14]), op(lhs[15], rhs[15]));
520 template<
class T1,
class T2,
class OP>
527 return Return_t(op(lhs[0], rhs), op(lhs[1], rhs), op(lhs[2], rhs), op(lhs[3], rhs), op(lhs[4], rhs),
528 op(lhs[5], rhs), op(lhs[6], rhs), op(lhs[7], rhs), op(lhs[8], rhs), op(lhs[9], rhs),
529 op(lhs[10], rhs), op(lhs[11], rhs), op(lhs[12], rhs), op(lhs[13], rhs), op(lhs[14], rhs),
534 template<
class T1,
class T2,
class OP>
541 return Return_t(op(lhs, rhs[0]), op(lhs, rhs[1]), op(lhs, rhs[2]), op(lhs, rhs[3]), op(lhs, rhs[4]),
542 op(lhs, rhs[5]), op(lhs, rhs[6]), op(lhs, rhs[7]), op(lhs, rhs[8]), op(lhs, rhs[9]),
543 op(lhs, rhs[10]), op(lhs, rhs[11]), op(lhs, rhs[12]), op(lhs, rhs[13]), op(lhs, rhs[14]),
553 template<
class T1,
unsigned D1,
unsigned D2>
557 for (
int i = 0; i < D1; i++)
558 for (
int j = 0; j < D2; j++)
569 return TinyMatrix<T1, 3, 3>(a(0, 0), a(1, 0), a(2, 0), a(0, 1), a(1, 1), a(2, 1), a(0, 2), a(1, 2), a(2, 2));
578 return TinyMatrix<T1, 4, 4>(a(0, 0), a(1, 0), a(2, 0), a(3, 0), a(0, 1), a(1, 1), a(2, 1), a(3, 1), a(0, 2), a(1, 2),
579 a(2, 2), a(3, 2), a(0, 3), a(1, 3), a(2, 3), a(3, 3));
589 template<
class T1,
class T2,
unsigned D1,
unsigned D2,
unsigned D3>
597 for (
int i = 0; i < D1; i++)
598 for (
int j = 0; j < D3; j++)
601 for (
int k = 0; k < D2; k++)
602 tmp += lhs(i, k) * rhs(k, j);
609 template<
class T1,
class T2>
616 return Return_t(lhs(0, 0) * rhs(0, 0) + lhs(0, 1) * rhs(1, 0) + lhs(0, 2) * rhs(2, 0),
617 lhs(0, 0) * rhs(0, 1) + lhs(0, 1) * rhs(1, 1) + lhs(0, 2) * rhs(2, 1),
618 lhs(0, 0) * rhs(0, 2) + lhs(0, 1) * rhs(1, 2) + lhs(0, 2) * rhs(2, 2),
619 lhs(1, 0) * rhs(0, 0) + lhs(1, 1) * rhs(1, 0) + lhs(1, 2) * rhs(2, 0),
620 lhs(1, 0) * rhs(0, 1) + lhs(1, 1) * rhs(1, 1) + lhs(1, 2) * rhs(2, 1),
621 lhs(1, 0) * rhs(0, 2) + lhs(1, 1) * rhs(1, 2) + lhs(1, 2) * rhs(2, 2),
622 lhs(2, 0) * rhs(0, 0) + lhs(2, 1) * rhs(1, 0) + lhs(2, 2) * rhs(2, 0),
623 lhs(2, 0) * rhs(0, 1) + lhs(2, 1) * rhs(1, 1) + lhs(2, 2) * rhs(2, 1),
624 lhs(2, 0) * rhs(0, 2) + lhs(2, 1) * rhs(1, 2) + lhs(2, 2) * rhs(2, 2));
634 template<
class T1,
class T2,
unsigned D1,
unsigned D2>
642 for (
int i = 0; i < D1; i++)
644 res(i) = lhs(i, 0) * rhs(0);
645 for (
int j = 1; j < D2; j++)
646 res(i) += lhs(i, j) * rhs(j);
652 template<
class T1,
class T2,
unsigned D1,
unsigned D2>
660 for (
int i = 0; i < D2; i++)
662 res(i) = lhs(0) * rhs(0, i);
663 for (
int j = 1; j < D1; j++)
664 res(i) += lhs(j) * rhs(j, i);
674 template<
class T1,
class T2>
681 return Return_t(lhs(0, 0) * rhs(0) + lhs(0, 1) * rhs(1) + lhs(0, 2) * rhs(2),
682 lhs(1, 0) * rhs(0) + lhs(1, 1) * rhs(1) + lhs(1, 2) * rhs(2),
683 lhs(2, 0) * rhs(0) + lhs(2, 1) * rhs(1) + lhs(2, 2) * rhs(2));
687 template<
class T1,
class T2>
694 return Return_t(lhs(0) * rhs(0, 0) + lhs(1) * rhs(1, 0) + lhs(2) * rhs(2, 0),
695 lhs(0) * rhs(0, 1) + lhs(1) * rhs(1, 1) + lhs(2) * rhs(2, 1),
696 lhs(0) * rhs(0, 2) + lhs(1) * rhs(1, 2) + lhs(2) * rhs(2, 2));
703 template<
class T1,
class T2>
710 return Return_t(lhs(0, 0) * rhs(0) + lhs(0, 1) * rhs(1) + lhs(0, 2) * rhs(2) + lhs(0, 3) * rhs(3),
711 lhs(1, 0) * rhs(0) + lhs(1, 1) * rhs(1) + lhs(1, 2) * rhs(2) + lhs(1, 3) * rhs(3),
712 lhs(2, 0) * rhs(0) + lhs(2, 1) * rhs(1) + lhs(2, 2) * rhs(2) + lhs(2, 3) * rhs(3),
713 lhs(3, 0) * rhs(0) + lhs(3, 1) * rhs(1) + lhs(3, 2) * rhs(2) + lhs(3, 3) * rhs(3));
717 template<
class T1,
class T2>
724 return Return_t(lhs(0) * rhs(0, 0) + lhs(1) * rhs(1, 0) + lhs(2) * rhs(2, 0) + lhs(3) * rhs(3, 0),
725 lhs(0) * rhs(0, 1) + lhs(1) * rhs(1, 1) + lhs(2) * rhs(2, 1) + lhs(3) * rhs(3, 1),
726 lhs(0) * rhs(0, 2) + lhs(1) * rhs(1, 2) + lhs(2) * rhs(2, 2) + lhs(3) * rhs(3, 2),
727 lhs(0) * rhs(0, 3) + lhs(1) * rhs(1, 3) + lhs(2) * rhs(2, 3) + lhs(3) * rhs(3, 3));
732 template<
class T1,
class T2>
739 return Return_t(lhs(0, 0) * rhs(0, 0) + lhs(0, 1) * rhs(1, 0) + lhs(0, 2) * rhs(2, 0) + lhs(0, 3) * rhs(3, 0),
740 lhs(0, 0) * rhs(0, 1) + lhs(0, 1) * rhs(1, 1) + lhs(0, 2) * rhs(2, 1) + lhs(0, 3) * rhs(3, 1),
741 lhs(0, 0) * rhs(0, 2) + lhs(0, 1) * rhs(1, 2) + lhs(0, 2) * rhs(2, 2) + lhs(0, 3) * rhs(3, 2),
742 lhs(0, 0) * rhs(0, 3) + lhs(0, 1) * rhs(1, 3) + lhs(0, 2) * rhs(2, 3) + lhs(0, 3) * rhs(3, 3),
743 lhs(1, 0) * rhs(0, 0) + lhs(1, 1) * rhs(1, 0) + lhs(1, 2) * rhs(2, 0) + lhs(1, 3) * rhs(3, 0),
744 lhs(1, 0) * rhs(0, 1) + lhs(1, 1) * rhs(1, 1) + lhs(1, 2) * rhs(2, 1) + lhs(1, 3) * rhs(3, 1),
745 lhs(1, 0) * rhs(0, 2) + lhs(1, 1) * rhs(1, 2) + lhs(1, 2) * rhs(2, 2) + lhs(1, 3) * rhs(3, 2),
746 lhs(1, 0) * rhs(0, 3) + lhs(1, 1) * rhs(1, 3) + lhs(1, 2) * rhs(2, 3) + lhs(1, 3) * rhs(3, 3),
747 lhs(2, 0) * rhs(0, 0) + lhs(2, 1) * rhs(1, 0) + lhs(2, 2) * rhs(2, 0) + lhs(2, 3) * rhs(3, 0),
748 lhs(2, 0) * rhs(0, 1) + lhs(2, 1) * rhs(1, 1) + lhs(2, 2) * rhs(2, 1) + lhs(2, 3) * rhs(3, 1),
749 lhs(2, 0) * rhs(0, 2) + lhs(2, 1) * rhs(1, 2) + lhs(2, 2) * rhs(2, 2) + lhs(2, 3) * rhs(3, 2),
750 lhs(2, 0) * rhs(0, 3) + lhs(2, 1) * rhs(1, 3) + lhs(2, 2) * rhs(2, 3) + lhs(2, 3) * rhs(3, 3),
751 lhs(3, 0) * rhs(0, 0) + lhs(3, 1) * rhs(1, 0) + lhs(3, 2) * rhs(2, 0) + lhs(3, 3) * rhs(3, 0),
752 lhs(3, 0) * rhs(0, 1) + lhs(3, 1) * rhs(1, 1) + lhs(3, 2) * rhs(2, 1) + lhs(3, 3) * rhs(3, 1),
753 lhs(3, 0) * rhs(0, 2) + lhs(3, 1) * rhs(1, 2) + lhs(3, 2) * rhs(2, 2) + lhs(3, 3) * rhs(3, 2),
754 lhs(3, 0) * rhs(0, 3) + lhs(3, 1) * rhs(1, 3) + lhs(3, 2) * rhs(2, 3) + lhs(3, 3) * rhs(3, 3));
759 #endif // OHMMS_TINYVECTOR_OPERATORS_H static Return_t apply(const TinyMatrix< T1, 4, 4 > &lhs, T2 rhs, OP op)
typename Promote< T1, T2 >::Type_t Type_t
static void apply(TinyMatrix< T1, 2, 2 > &lhs, const TinyMatrix< T2, 2, 2 > &rhs, OP op)
static void apply(TinyMatrix< T1, 3, 3 > &lhs, const T2 &rhs, OP op)
typename BinaryReturn< T1, T2, OpMultiply >::Type_t Type_t
typename BinaryReturn< T1, T2, OpMultiply >::Type_t Type_t
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
helper functions for EinsplineSetBuilder
static Return_t apply(const TinyMatrix< T1, 4, 4 > &lhs, const TinyMatrix< T2, 4, 4 > &rhs, OP op)
static void apply(TinyMatrix< T1, D1, D2 > &lhs, const TinyMatrix< T2, D1, D2 > &rhs, OP op)
static TinyMatrix< Type_t, 1, 1 > apply(const T1 &lhs, const TinyMatrix< T2, 1, 1 > &rhs, OP op)
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
static TinyMatrix< Type_t, 1, 3 > apply(const T1 &lhs, const TinyMatrix< T2, 1, 3 > &rhs, OP op)
static TinyMatrix< Type_t, 1, 2 > apply(const T1 &lhs, const TinyMatrix< T2, 1, 2 > &rhs, OP op)
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
static void apply(TinyMatrix< T1, 3, 1 > &lhs, const TinyMatrix< T2, 3, 1 > &rhs, OP op)
static Return_t apply(const TinyMatrix< T1, 3, 3 > &lhs, const TinyMatrix< T2, 3, 3 > &rhs, OP op)
typename BinaryReturn< T1, T2, OpMultiply >::Type_t Type_t
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
static TinyMatrix< Type_t, 2, 2 > apply(const T1 &lhs, const TinyMatrix< T2, 2, 2 > &rhs, OP op)
static Return_t apply(const TinyMatrix< T1, 3, 3 > &lhs, T2 rhs, OP op)
static void apply(TinyMatrix< T1, 3, 3 > &lhs, const TinyMatrix< T2, 3, 3 > &rhs, OP op)
static Return_t apply(const TinyVector< T1, D1 > &lhs, const TinyMatrix< T2, D1, D2 > &rhs)
static TinyMatrix< Type_t, 1, 3 > apply(const TinyMatrix< T1, 1, 3 > &lhs, const T2 &rhs, OP op)
static void apply(TinyMatrix< T1, 1, 3 > &lhs, const TinyMatrix< T2, 1, 3 > &rhs, OP op)
static TinyMatrix< Type_t, 1, 2 > apply(const TinyMatrix< T1, 1, 2 > &lhs, const T2 &rhs, OP op)
typename BinaryReturn< T1, T2, OpMultiply >::Type_t Type_t
static TinyMatrix< Type_t, 1, 2 > apply(const TinyMatrix< T1, 1, 2 > &lhs, const TinyMatrix< T2, 1, 2 > &rhs, OP op)
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
static void apply(TinyMatrix< T1, 1, 3 > &lhs, const T2 &rhs, OP op)
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
static Return_t apply(const TinyMatrix< T1, 3, 3 > &lhs, const TinyMatrix< T2, 3, 3 > &rhs)
static TinyMatrix< Type_t, D1, D2 > apply(const T1 &lhs, const TinyMatrix< T2, D1, D2 > &rhs, OP op)
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
static Return_t apply(T1 lhs, const TinyMatrix< T2, 4, 4 > &rhs, OP op)
static Return_t apply(T1 lhs, const TinyMatrix< T2, 3, 3 > &rhs, OP op)
static void apply(TinyMatrix< T1, 2, 1 > &lhs, const TinyMatrix< T2, 2, 1 > &rhs, OP op)
typename BinaryReturn< T1, T2, OpMultiply >::Type_t Type_t
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
static void apply(TinyMatrix< T1, 1, 2 > &lhs, const TinyMatrix< T2, 1, 2 > &rhs, OP op)
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
static Return_t apply(const TinyMatrix< T1, 4, 4 > &lhs, const TinyMatrix< T2, 4, 4 > &rhs)
static TinyMatrix< Type_t, D1, D2 > apply(const TinyMatrix< T1, D1, D2 > &lhs, const TinyMatrix< T2, D1, D2 > &rhs, OP op)
static Return_t apply(const TinyMatrix< T1, D1, D2 > &lhs, const TinyMatrix< T2, D2, D3 > &rhs)
static Return_t apply(const TinyVector< T1, 4 > &lhs, const TinyMatrix< T2, 4, 4 > &rhs)
static void apply(TinyMatrix< T1, 3, 1 > &lhs, const T2 &rhs, OP op)
typename BinaryReturn< T1, T2, OpMultiply >::Type_t Type_t
static Return_t apply(const TinyVector< T1, 3 > &lhs, const TinyMatrix< T2, 3, 3 > &rhs)
static void apply(TinyMatrix< T1, 1, 1 > &lhs, const T2 &rhs, OP op)
static void apply(TinyMatrix< T1, 4, 4 > &lhs, const TinyMatrix< T2, 4, 4 > &rhs, OP op)
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
static Return_t apply(const TinyMatrix< T1, 4, 4 > &lhs, const TinyVector< T2, 4 > &rhs)
MakeReturn< UnaryNode< OpNot, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t operator!(const Vector< T1, C1 > &l)
static Return_t apply(const TinyMatrix< T1, D1, D2 > &lhs, const TinyVector< T2, D2 > &rhs)
static TinyMatrix< Type_t, D1, D2 > apply(const TinyMatrix< T1, D1, D2 > &lhs, const T2 &rhs, OP op)
static void apply(TinyMatrix< T1, D1, D2 > &lhs, const T2 &rhs, OP op)
static void apply(TinyMatrix< T1, 1, 1 > &lhs, const TinyMatrix< T2, 1, 1 > &rhs, OP op)
typename BinaryReturn< T1, T2, OP >::Type_t Type_t
static void apply(TinyMatrix< T1, 4, 4 > &lhs, const T2 &rhs, OP op)
static TinyMatrix< Type_t, 2, 2 > apply(const TinyMatrix< T1, 2, 2 > &lhs, const T2 &rhs, OP op)
typename BinaryReturn< T1, T2, OpMultiply >::Type_t Type_t
typename BinaryReturn< T1, T2, OpMultiply >::Type_t Type_t
static TinyMatrix< Type_t, 1, 1 > apply(const TinyMatrix< T1, 1, 1 > &lhs, const T2 &rhs, OP op)
static TinyMatrix< Type_t, 1, 3 > apply(const TinyMatrix< T1, 1, 3 > &lhs, const TinyMatrix< T2, 1, 3 > &rhs, OP op)
static TinyMatrix< Type_t, 2, 2 > apply(const TinyMatrix< T1, 2, 2 > &lhs, const TinyMatrix< T2, 2, 2 > &rhs, OP op)
typename BinaryReturn< T1, T2, OpMultiply >::Type_t Type_t
static void apply(TinyMatrix< T1, 2, 1 > &lhs, const T2 &rhs, OP op)
static void apply(TinyMatrix< T1, 2, 2 > &lhs, const T2 &rhs, OP op)
static Return_t apply(const TinyMatrix< T1, 3, 3 > &lhs, const TinyVector< T2, 3 > &rhs)
BareKineticEnergy::Return_t Return_t
static void apply(TinyMatrix< T1, 1, 2 > &lhs, const T2 &rhs, OP op)
static TinyMatrix< Type_t, 1, 1 > apply(const TinyMatrix< T1, 1, 1 > &lhs, const TinyMatrix< T2, 1, 1 > &rhs, OP op)
typename BinaryReturn< T1, T2, OP >::Type_t Type_t