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);
208 #endif // CDPL_MATH_VECTORARRAYFUNCTIONS_HPP