|
| | Vector () |
| |
| | Vector (const Vector< Number > &V) |
| |
| | Vector (Vector< Number > &&) noexcept=default |
| |
| | Vector (const size_type n) |
| |
| Vector & | operator= (const Vector< Number > &v) |
| |
| Vector & | operator= (Vector< Number > &&v) noexcept=default |
| |
| virtual void | swap (Vector< Number > &v) |
| |
| void | reinit (const size_type n, const bool omit_zeroing_entries=false) |
| |
| virtual void | reinit (const VectorSpaceVector< Number > &V, const bool omit_zeroing_entries=false) override |
| |
| virtual void | import (const ReadWriteVector< Number > &V, VectorOperation::values operation, std::shared_ptr< const CommunicationPatternBase > communication_pattern=std::shared_ptr< const CommunicationPatternBase >()) override |
| |
| virtual Vector< Number > & | operator= (const Number s) override |
| |
| virtual Vector< Number > & | operator*= (const Number factor) override |
| |
| virtual Vector< Number > & | operator/= (const Number factor) override |
| |
| virtual Vector< Number > & | operator+= (const VectorSpaceVector< Number > &V) override |
| |
| virtual Vector< Number > & | operator-= (const VectorSpaceVector< Number > &V) override |
| |
| virtual Number | operator* (const VectorSpaceVector< Number > &V) const override |
| |
| virtual void | add (const Number a) override |
| |
| virtual void | add (const Number a, const VectorSpaceVector< Number > &V) override |
| |
| virtual void | add (const Number a, const VectorSpaceVector< Number > &V, const Number b, const VectorSpaceVector< Number > &W) override |
| |
| virtual void | sadd (const Number s, const Number a, const VectorSpaceVector< Number > &V) override |
| |
| virtual void | scale (const VectorSpaceVector< Number > &scaling_factors) override |
| |
| virtual void | equ (const Number a, const VectorSpaceVector< Number > &V) override |
| |
| virtual bool | all_zero () const override |
| |
| virtual value_type | mean_value () const override |
| |
| virtual real_type | l1_norm () const override |
| |
| virtual real_type | l2_norm () const override |
| |
| real_type | norm_sqr () const |
| |
| virtual real_type | linfty_norm () const override |
| |
| virtual Number | add_and_dot (const Number a, const VectorSpaceVector< Number > &V, const VectorSpaceVector< Number > &W) override |
| |
| Number * | get_values () const |
| |
| virtual size_type | size () const override |
| |
| virtual ::IndexSet | locally_owned_elements () const override |
| |
| virtual void | print (std::ostream &out, const unsigned int precision=2, const bool scientific=true, const bool across=true) const override |
| |
| virtual std::size_t | memory_consumption () const override |
| |
template<typename Number>
class LinearAlgebra::CUDAWrappers::Vector< Number >
This class implements a vector using CUDA for use on Nvidia GPUs. This class is derived from the LinearAlgebra::VectorSpaceVector class.
- Note
- Only float and double are supported.
- See also
- CUDAWrappers
- Author
- Karl Ljungkvist, Bruno Turcksin, Daniel Arndt, 2016, 2018
Definition at line 36 of file cuda_precondition.h.
template<typename Number >
Constructor. Set dimension to n and initialize all elements with zero.
The constructor is made explicit to avoid accident like this: v=0;. Presumably, the user wants to set every elements of the vector to zero, but instead, what happens is this call: v=Vector<Number>(0);, i.e. the vector is replaced by one of length zero.
template<typename Number >
Swap the contents of this vector and the other vector v. One could do this operation with a temporary variable and copying over the data elements, but this function is significantly more efficient since it only swaps the pointers to the data of the two vectors and therefore does not need to allocate temporary storage and move data around.
This function is analogous to the swap function of all C++ standard containers. Also, there is a global function swap(u,v) that simply calls u.swap(v), again in analogy to standard functions.
This function is virtual in order to allow for derived classes to handle memory separately.
Definition at line 398 of file cuda_vector.h.
template<typename Number >
Perform a combined operation of a vector addition and a subsequent inner product, returning the value of the inner product. In other words, the result of this function is the same as if the user called
return_value = *this * W;
The reason this function exists is that this operation involves less memory transfer than calling the two functions separately. This method only needs to load three vectors, this, V, W, whereas calling separate methods means to load the calling vector this twice. Since most vector operations are memory transfer limited, this reduces the time by 25% (or 50% if W equals this).
For complex-valued vectors, the scalar product in the second step is implemented as
.