28 #ifndef CDPL_MATH_MINIMIZERVARIABLEARRAYTRAITS_HPP
29 #define CDPL_MATH_MINIMIZERVARIABLEARRAYTRAITS_HPP
104 for (
SizeType i = 0; i < size; i++) {
130 template <
typename T>
133 y.plusAssign(alpha * x);
161 template <
typename T>
182 template <
typename V>
213 template <
typename T>
230 template <
typename T>
237 const typename VectorType::ConstPointer vx = it->getData();
238 typename VectorType::SizeType dim = it->getSize();
240 for (
typename VectorType::SizeType i = 0; i < dim; i++) {
267 template <
typename T>
277 it2->plusAssign(tmp);
307 template <
typename T>
324 it1->minusAssign(*it2);
332 template <
typename V>
363 template <
typename T>
368 for (
typename ArrayType::const_iterator it1 = a1.begin(), it2 = a2.begin(), end1 = a1.end(); it1 != end1; ++it1, ++it2)
380 template <
typename T>
386 for (
typename ArrayType::const_iterator it = a.begin(), end = a.end(); it != end; ++it) {
387 const typename VectorType::ConstPointer vx = it->getData();
388 typename VectorType::SizeType dim = it->getSize();
390 for (
typename VectorType::SizeType i = 0; i < dim; i++) {
417 template <
typename T>
420 typename ArrayType::iterator it2 = y.begin();
423 for (
typename ArrayType::const_iterator it1 = x.begin(), end1 = x.end(); it1 != end1; ++it1, ++it2) {
427 it2->plusAssign(tmp);
437 for (
typename ArrayType::iterator it = a.begin(), end = a.end(); it != end; ++it)
457 template <
typename T>
460 for (
typename ArrayType::iterator it = a.begin(), end = a.end(); it != end; ++it)
471 typename ArrayType::const_iterator it2 = a2.begin();
473 for (
typename ArrayType::iterator it1 = a1.begin(), end1 = a1.end(); it1 != end1; ++it1, ++it2)
474 it1->minusAssign(*it2);
Definition of type traits.
Definition of class CDPL::Math::VectorArray.
Array data type for the ordered storage of 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:128
ConstElementIterator getElementsEnd() const
Returns a constant iterator pointing to the end of the array.
Definition: Array.hpp:907
StorageType::iterator ElementIterator
A mutable random access iterator used to iterate over the elements of the array.
Definition: Array.hpp:140
ConstElementIterator getElementsBegin() const
Returns a constant iterator pointing to the beginning of the array.
Definition: Array.hpp:895
std::size_t SizeType
An unsigned integral type used to represent sizes and indices.
Definition: Array.hpp:113
constexpr unsigned int A
Generic type that covers any element except hydrogen.
Definition: AtomType.hpp:637
constexpr unsigned int V
Specifies Vanadium.
Definition: AtomType.hpp:177
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
VectorInnerProduct< E1, E2 >::ResultType innerProd(const VectorExpression< E1 > &e1, const VectorExpression< E2 > &e2)
Returns the inner (dot) product of the vector expressions e1 and e2.
Definition: VectorExpression.hpp:1033
CDPL_VIS_API void scale(TriangleMesh3D &mesh, double scale_x, double scale_y, double scale_z, std::size_t vtx_offs=0, std::size_t vtx_count=0)
Scales the vertices of mesh by the per-axis factors (scale_x, scale_y, scale_z).
The namespace of the Chemical Data Processing Library.
VectorArray< V > ArrayType
The vector-array type.
Definition: MinimizerVariableArrayTraits.hpp:189
static void sub(ArrayType &a1, const ArrayType &a2)
Subtracts a2 from a1 element-wise ( ).
Definition: MinimizerVariableArrayTraits.hpp:319
V::ValueType ValueType
The scalar value type stored in the array elements.
Definition: MinimizerVariableArrayTraits.hpp:199
static void clear(ArrayType &a)
Sets all vector elements in a to the default-constructed ValueType.
Definition: MinimizerVariableArrayTraits.hpp:285
static void multiply(ArrayType &a, const T &v)
Multiplies every element of a by the scalar v.
Definition: MinimizerVariableArrayTraits.hpp:308
static void assign(ArrayType &a1, const ArrayType &a2)
Copies the contents of a2 into a1.
Definition: MinimizerVariableArrayTraits.hpp:296
ArrayType::SizeType SizeType
The size type used by the vector array.
Definition: MinimizerVariableArrayTraits.hpp:204
static void axpy(const T &alpha, const ArrayType &x, ArrayType &y)
Performs the in-place BLAS-style axpy operation .
Definition: MinimizerVariableArrayTraits.hpp:268
V VectorType
The vector type of the array elements.
Definition: MinimizerVariableArrayTraits.hpp:194
static T norm2(const ArrayType &a)
Computes the Euclidean (L2) norm of a using a numerically stable scaling algorithm.
Definition: MinimizerVariableArrayTraits.hpp:231
static T dot(const ArrayType &a1, const ArrayType &a2)
Computes the inner product (dot product) of two vector arrays.
Definition: MinimizerVariableArrayTraits.hpp:214
static void assign(ArrayType &a1, const ArrayType &a2)
Copies the contents of a2 into a1.
Definition: MinimizerVariableArrayTraits.hpp:446
static void clear(ArrayType &a)
Sets all vector elements in a to the default-constructed ValueType.
Definition: MinimizerVariableArrayTraits.hpp:435
V VectorType
The vector type of the array elements.
Definition: MinimizerVariableArrayTraits.hpp:344
ArrayType::size_type SizeType
The size type used by the vector array.
Definition: MinimizerVariableArrayTraits.hpp:354
std::vector< V > ArrayType
The vector-array type.
Definition: MinimizerVariableArrayTraits.hpp:339
static T norm2(const ArrayType &a)
Computes the Euclidean (L2) norm of a using a numerically stable scaling algorithm.
Definition: MinimizerVariableArrayTraits.hpp:381
static void sub(ArrayType &a1, const ArrayType &a2)
Subtracts a2 from a1 element-wise ( ).
Definition: MinimizerVariableArrayTraits.hpp:469
static void axpy(const T &alpha, const ArrayType &x, ArrayType &y)
Performs the in-place BLAS-style axpy operation .
Definition: MinimizerVariableArrayTraits.hpp:418
V::ValueType ValueType
The scalar value type stored in the array elements.
Definition: MinimizerVariableArrayTraits.hpp:349
static T dot(const ArrayType &a1, const ArrayType &a2)
Computes the inner product (dot product) of two vector arrays.
Definition: MinimizerVariableArrayTraits.hpp:364
static void multiply(ArrayType &a, const T &v)
Multiplies every element of a by the scalar v.
Definition: MinimizerVariableArrayTraits.hpp:458
Traits template that adapts arbitrary variable-array types to the linear-algebra operations required ...
Definition: MinimizerVariableArrayTraits.hpp:55
static void axpy(const T &alpha, const ArrayType &x, ArrayType &y)
Performs the in-place BLAS-style axpy operation .
Definition: MinimizerVariableArrayTraits.hpp:131
static T dot(const ArrayType &a1, const ArrayType &a2)
Computes the inner product (dot product) of two variable arrays.
Definition: MinimizerVariableArrayTraits.hpp:80
static void multiply(ArrayType &a, const T &v)
Multiplies every element of a by the scalar v.
Definition: MinimizerVariableArrayTraits.hpp:162
static void sub(ArrayType &a1, const ArrayType &a2)
Subtracts a2 from a1 element-wise ( ).
Definition: MinimizerVariableArrayTraits.hpp:172
A::ValueType ValueType
The scalar value type stored by the array.
Definition: MinimizerVariableArrayTraits.hpp:65
static void assign(ArrayType &a1, const ArrayType &a2)
Copies the contents of a2 into a1.
Definition: MinimizerVariableArrayTraits.hpp:150
A ArrayType
The variable-array type.
Definition: MinimizerVariableArrayTraits.hpp:60
static void clear(ArrayType &a)
Sets all elements of a to the default-constructed ValueType.
Definition: MinimizerVariableArrayTraits.hpp:140
A::SizeType SizeType
The size type used by the array.
Definition: MinimizerVariableArrayTraits.hpp:70
static T norm2(const ArrayType &a)
Computes the Euclidean (L2) norm of a using a numerically stable scaling algorithm.
Definition: MinimizerVariableArrayTraits.hpp:92
static RealType abs(ConstReference t)
Returns the absolute value of t (std::abs for signed types, the identity for unsigned types).
Definition: TypeTraits.hpp:142
T RealType
The real-valued type (identical to ValueType for scalar traits).
Definition: TypeTraits.hpp:96
Primary traits template for scalar arithmetic value types.
Definition: TypeTraits.hpp:307