29 #ifndef CDPL_MATH_VECTORARRAYFUNCTIONS_HPP
30 #define CDPL_MATH_VECTORARRAYFUNCTIONS_HPP
50 template <
typename T, std::
size_t Dim,
typename T1>
57 typedef typename VecType::Pointer VecDataPointer;
58 typedef typename MtxType::ConstArrayPointer MtxDataPointer;
61 MtxDataPointer xform_data = xform.
getData();
63 for (Iterator it = va.getElementsBegin(), end = va.getElementsEnd(); it != end; ++it) {
64 VecDataPointer
vec = it->getData();
66 for (std::size_t i = 0; i < Dim; i++) {
69 for (std::size_t j = 0; j < Dim; j++)
70 tmp[i] +=
vec[j] * xform_data[i][j];
73 for (std::size_t i = 0; i < Dim; i++)
84 template <
typename T, std::
size_t Dim,
typename T1>
91 typedef typename VecType::Pointer VecDataPointer;
92 typedef typename MtxType::ConstArrayPointer MtxDataPointer;
95 MtxDataPointer xform_data = xform.
getData();
97 for (Iterator it = va.getElementsBegin(), end = va.getElementsEnd(); it != end; ++it) {
98 VecDataPointer
vec = it->getData();
100 for (std::size_t i = 0; i < Dim; i++) {
103 for (std::size_t j = 0; j < Dim; j++)
104 tmp[i] +=
vec[j] * xform_data[i][j];
106 tmp[i] += xform_data[i][Dim];
109 for (std::size_t i = 0; i < Dim; i++)
120 template <
typename T, std::
size_t Dim,
typename T1>
130 for (Iterator it = va.getElementsBegin(), end = va.getElementsEnd(); it != end; ++it)
138 template <
typename T, std::
size_t Dim>
144 ArraySizeType num_elem = std::min(va1.getSize(), va2.getSize());
150 typedef typename VecType::ConstPointer VecDataPointer;
154 for (Iterator it1 = va1.getElementsBegin(), it2 = va2.getElementsBegin(), end = it1 + num_elem; it1 != end; ++it1, ++it2) {
155 VecDataPointer vec1 = it1->getData();
156 VecDataPointer vec2 = it2->getData();
158 for (std::size_t i = 0; i < Dim; i++) {
159 T diff = vec1[i] - vec2[i];
165 return std::sqrt(sd / num_elem);
168 template <
typename T, std::
size_t Dim,
typename T1>
176 ArraySizeType num_elem = std::min(va1.getSize(), va2.getSize());
182 typedef typename VecType::ConstPointer VecDataPointer;
183 typedef typename MtxType::ConstArrayPointer MtxDataPointer;
186 MtxDataPointer xform_data = va1_xform.
getData();
188 for (Iterator it1 = va1.getElementsBegin(), it2 = va2.getElementsBegin(), end = it1 + num_elem; it1 != end; ++it1, ++it2) {
189 VecDataPointer vec1 = it1->getData();
190 VecDataPointer vec2 = it2->getData();
192 for (std::size_t i = 0; i < Dim; i++) {
195 for (std::size_t j = 0; j < Dim; j++)
196 tmp += vec1[j] * xform_data[i][j];
198 tmp += xform_data[i][Dim] - vec2[i];
203 return std::sqrt(sd / num_elem);
Definition of matrix data types.
Definition of the class CDPL::Math::VectorArray.
Definition: Matrix.hpp:1152
ArrayPointer getData()
Definition: Matrix.hpp:1243
Definition: Vector.hpp:1053
void clear(const ValueType &v=ValueType())
Definition: Vector.hpp:1278
CVector & plusAssign(const VectorExpression< E > &e)
Definition: Vector.hpp:1242
SizeType getSize() const
Definition: Vector.hpp:1127
An array for storing generic vector objects.
Definition: VectorArray.hpp:49
StorageType::const_iterator ConstElementIterator
A constant random access iterator used to iterate over the elements of the array.
Definition: Array.hpp:125
StorageType::iterator ElementIterator
A mutable random access iterator used to iterate over the elements of the array.
Definition: Array.hpp:137
std::size_t SizeType
The type of objects stored by the array.
Definition: Array.hpp:110
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
bool calcCentroid(const VectorArray< CVector< T, Dim > > &va, CVector< T1, Dim > &ctr)
Calculates the centroid of the array elements.
Definition: VectorArrayFunctions.hpp:121
QuaternionVectorAdapter< E > vec(QuaternionExpression< E > &e)
Definition: QuaternionAdapter.hpp:237
T calcRMSD(const VectorArray< CVector< T, Dim > > &va1, const VectorArray< CVector< T, Dim > > &va2)
Definition: VectorArrayFunctions.hpp:139
void transform(VectorArray< CVector< T, Dim > > &va, const CMatrix< T1, Dim, Dim > &xform)
Transforms each -dimensional vector in the array with the -dimensional square matrix xform.
Definition: VectorArrayFunctions.hpp:51
The namespace of the Chemical Data Processing Library.