Template Class ArrayMultiply#
Defined in File arrayMultiply.hpp
Class Documentation#
-
template<typename ShapeTypeA, typename StorageTypeA, typename ShapeTypeB, typename StorageTypeB, typename Alpha, typename Beta>
class ArrayMultiply# Class to represent an array multiplication (vector-vector, matrix-vector, matrix-matrix)
- Template Parameters
Public Types
-
using TypeA = array::ArrayContainer<ShapeTypeA, StorageTypeA>#
-
using TypeB = array::ArrayContainer<ShapeTypeB, StorageTypeB>#
-
using ScalarA = typename StorageTypeA::Scalar#
-
using ScalarB = typename StorageTypeB::Scalar#
-
using ShapeType = ShapeTypeA#
-
using BackendA = typename typetraits::TypeInfo<TypeA>::Backend#
-
using BackendB = typename typetraits::TypeInfo<TypeB>::Backend#
-
using Backend = decltype(typetraits::commonBackend<BackendA, BackendB>())#
Public Functions
-
ArrayMultiply() = delete#
Default constructor (deleted)
-
ArrayMultiply(const ArrayMultiply&) = default#
Copy constructor.
-
ArrayMultiply(ArrayMultiply&&) noexcept = default#
Move constructor.
-
ArrayMultiply(bool transA, bool transB, const TypeA &a, Alpha alpha, const TypeB &b, Beta beta)#
Full set of parameters for an array multiplication.
- Parameters
transA – Determines \( \mathrm{OP}_A \) (true: transpose, false: no transpose)
transB – Determines \( \mathrm{OP}_B \) (true: transpose, false: no transpose)
a – First array
alpha – Scaling factor \( \alpha \)
b – Second array
beta – Scaling factor \( \beta \)
-
ArrayMultiply(bool transA, bool transB, TypeA &&a, Alpha alpha, TypeB &&b, Beta beta)#
Full set of parameters, but with move semantics.
- Parameters
transA –
transB –
a –
alpha –
b –
beta –
-
ArrayMultiply(const TypeA &a, const TypeB &b)#
Array multiplication with \( \alpha = 1 \) and \( \beta = 0 \).
- Parameters
a –
b –
-
ArrayMultiply(TypeA &&a, TypeB &&b)#
Array multiplication with \( \alpha = 1 \) and \( \beta = 0 \), but with move semantics.
- Parameters
a –
b –
-
ArrayMultiply(bool transA, bool transB, const TypeA &a, const TypeB &b)#
Array multiplication with \( \alpha = 1 \) and \( \beta = 0 \) and transpose options.
- Parameters
transA –
transB –
a –
b –
-
ArrayMultiply(bool transA, bool transB, TypeA &&a, TypeB &&b)#
Array multiplication with \( \alpha = 1 \) and \( \beta = 0 \) and transpose options, but with move semantics.
- Parameters
transA –
transB –
a –
b –
-
ArrayMultiply &operator=(const ArrayMultiply&) = default#
Copy assignment operator.
- Returns
Reference to this
-
ArrayMultiply &operator=(ArrayMultiply&&) noexcept = default#
Move assignment operator.
- Returns
Reference to this
-
MatmulClass matmulClass() const#
Determine the class of the array multiplication.
The class of the array multiplication is determined by the shapes of the arrays. There are three supported cases:
Vector-vector dot product (both arrays are 1-dimensional vectors)
Matrix-vector product (first array is a 2-dimensional matrix, second array is a 1-dimensional vector)
Matrix-matrix product (both arrays are 2-dimensional matrices)
- Returns
Class of the array multiplication
-
int64_t ndim() const#
Determine the number of dimensions of the result.
- Returns
Number of dimensions of the result
-
auto eval() const#
Force evaluation of the array multiplication, returning an Array object.
- Returns
Array object containing the result
-
bool transA() const#
Determine \( \mathrm{OP}_A \).
- Returns
True: \( \mathrm{OP}_A(\mathbf{A}) = \mathbf{A}^T \), false: \( \mathrm{OP}_A(\mathbf{A}) = \mathbf{A} \)
-
bool transB() const#
Determine \( \mathrm{OP}_B \).
- Returns
True: \( \mathrm{OP}_B(\mathbf{B}) = \mathbf{B}^T \), false: \( \mathrm{OP}_B(\mathbf{B}) = \mathbf{B} \)
-
template<typename StorageType>
void applyTo(array::ArrayContainer<ShapeType, StorageType> &out) const# Apply the array multiplication to an array container.
Apply this operation to the provided Array, assuming that the Array has the correct shape. If the Array does not have the correct shape, an error is thrown.
- Template Parameters
StorageType – Storage type of the array container
- Parameters
out – Array container to store the result in
-
std::string str(const std::string &format) const#
String representation of the array multiplication.
- Parameters
format – Format string for each element
- Returns
String representation of the array multiplication