Reference documentation for deal.II version GIT 7bd1c95dbb 2022-06-29 20:50:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Public Types | Public Member Functions | Related Functions | List of all members
Vector< Number > Class Template Reference

#include <deal.II/lac/vector.h>

Inheritance diagram for Vector< Number >:
[legend]

Public Types

using value_type = Number
 
using pointer = value_type *
 
using const_pointer = const value_type *
 
using iterator = value_type *
 
using const_iterator = const value_type *
 
using reference = value_type &
 
using const_reference = const value_type &
 
using size_type = types::global_dof_index
 
using real_type = typename numbers::NumberTraits< Number >::real_type
 

Public Member Functions

Vector< int >::real_type lp_norm (const real_type) const
 
Basic object handling
 Vector ()
 
 Vector (const Vector< Number > &v)
 
 Vector (Vector< Number > &&v) noexcept=default
 
template<typename OtherNumber >
 Vector (const Vector< OtherNumber > &v)
 
template<typename OtherNumber >
 Vector (const std::initializer_list< OtherNumber > &v)
 
 Vector (const PETScWrappers::VectorBase &v)
 
 Vector (const TrilinosWrappers::MPI::Vector &v)
 
 Vector (const size_type n)
 
template<typename InputIterator >
 Vector (const InputIterator first, const InputIterator last)
 
virtual ~Vector () override=default
 
void compress (::VectorOperation::values operation=::VectorOperation::unknown) const
 
virtual void reinit (const size_type N, const bool omit_zeroing_entries=false)
 
void grow_or_shrink (const size_type N)
 
void apply_givens_rotation (const std::array< Number, 3 > &csr, const size_type i, const size_type k)
 
template<typename Number2 >
void reinit (const Vector< Number2 > &V, const bool omit_zeroing_entries=false)
 
virtual void swap (Vector< Number > &v)
 
Vector< Number > & operator= (const Number s)
 
Vector< Number > & operator= (const Vector< Number > &v)
 
Vector< Number > & operator= (Vector< Number > &&v) noexcept=default
 
template<typename Number2 >
Vector< Number > & operator= (const Vector< Number2 > &v)
 
Vector< Number > & operator= (const BlockVector< Number > &v)
 
Vector< Number > & operator= (const PETScWrappers::VectorBase &v)
 
Vector< Number > & operator= (const TrilinosWrappers::MPI::Vector &v)
 
template<typename Number2 >
bool operator== (const Vector< Number2 > &v) const
 
template<typename Number2 >
bool operator!= (const Vector< Number2 > &v) const
 
Scalar products, norms and related operations
template<typename Number2 >
Number operator* (const Vector< Number2 > &V) const
 
real_type norm_sqr () const
 
Number mean_value () const
 
real_type l1_norm () const
 
real_type l2_norm () const
 
real_type lp_norm (const real_type p) const
 
real_type linfty_norm () const
 
Number add_and_dot (const Number a, const Vector< Number > &V, const Vector< Number > &W)
 
Data access
pointer data ()
 
const_pointer data () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
Number operator() (const size_type i) const
 
Number & operator() (const size_type i)
 
Number operator[] (const size_type i) const
 
Number & operator[] (const size_type i)
 
template<typename OtherNumber >
void extract_subvector_to (const std::vector< size_type > &indices, std::vector< OtherNumber > &values) const
 
template<typename ForwardIterator , typename OutputIterator >
void extract_subvector_to (ForwardIterator indices_begin, const ForwardIterator indices_end, OutputIterator values_begin) const
 
Modification of vectors
Vector< Number > & operator+= (const Vector< Number > &V)
 
Vector< Number > & operator-= (const Vector< Number > &V)
 
template<typename OtherNumber >
void add (const std::vector< size_type > &indices, const std::vector< OtherNumber > &values)
 
template<typename OtherNumber >
void add (const std::vector< size_type > &indices, const Vector< OtherNumber > &values)
 
template<typename OtherNumber >
void add (const size_type n_elements, const size_type *indices, const OtherNumber *values)
 
void add (const Number s)
 
void add (const Number a, const Vector< Number > &V, const Number b, const Vector< Number > &W)
 
void add (const Number a, const Vector< Number > &V)
 
void sadd (const Number s, const Vector< Number > &V)
 
void sadd (const Number s, const Number a, const Vector< Number > &V)
 
Vector< Number > & operator*= (const Number factor)
 
Vector< Number > & operator/= (const Number factor)
 
void scale (const Vector< Number > &scaling_factors)
 
template<typename Number2 >
void scale (const Vector< Number2 > &scaling_factors)
 
void equ (const Number a, const Vector< Number > &u)
 
template<typename Number2 >
void equ (const Number a, const Vector< Number2 > &u)
 
void update_ghost_values () const
 
Input and output
void print (std::ostream &out, const unsigned int precision=3, const bool scientific=true, const bool across=true) const
 
void block_write (std::ostream &out) const
 
void block_read (std::istream &in)
 
template<class Archive >
void save (Archive &ar, const unsigned int version) const
 
template<class Archive >
void load (Archive &ar, const unsigned int version)
 
template<class Archive >
void serialize (Archive &archive, const unsigned int version)
 

Related Functions

(Note that these are not member functions.)

template<typename Number >
void swap (LinearAlgebra::CUDAWrappers::Vector< Number > &u, LinearAlgebra::CUDAWrappers::Vector< Number > &v)
 
template<typename Number , typename MemorySpace >
void swap (LinearAlgebra::distributed::Vector< Number, MemorySpace > &u, LinearAlgebra::distributed::Vector< Number, MemorySpace > &v)
 
template<typename Number >
void swap (LinearAlgebra::ReadWriteVector< Number > &u, LinearAlgebra::ReadWriteVector< Number > &v)
 
template<typename Number >
void swap (Vector< Number > &u, Vector< Number > &v)
 
template<typename number >
std::ostream & operator<< (std::ostream &out, const Vector< number > &v)
 

Information about the object

AlignedVector< Number > values
 
std::shared_ptr< parallel::internal::TBBPartitionerthread_loop_partitioner
 
template<typename Number2 >
class Vector
 
bool in_local_range (const size_type global_index) const
 
IndexSet locally_owned_elements () const
 
size_type size () const
 
size_type locally_owned_size () const
 
bool all_zero () const
 
bool is_non_negative () const
 
std::size_t memory_consumption () const
 
bool has_ghost_elements () const
 
void maybe_reset_thread_partitioner ()
 
void do_reinit (const size_type new_size, const bool omit_zeroing_entries, const bool reset_partitioner)
 

Subscriptor functionality

Classes derived from Subscriptor provide a facility to subscribe to this object. This is mostly used by the SmartPointer class.

std::atomic< unsigned int > counter
 
std::map< std::string, unsigned int > counter_map
 
std::vector< std::atomic< bool > * > validity_pointers
 
const std::type_info * object_info
 
void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
 
unsigned int n_subscriptions () const
 
template<typename StreamType >
void list_subscribers (StreamType &stream) const
 
void list_subscribers () const
 
void check_no_subscribers () const noexcept
 
using map_value_type = decltype(counter_map)::value_type
 
using map_iterator = decltype(counter_map)::iterator
 
static std::mutex mutex
 
static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)
 
static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)
 

Detailed Description

template<typename Number>
class Vector< Number >

A class that represents a vector of numerical elements. As for the other classes, in the Vector classes group, this class has a substantial number of member functions. These include:

In contrast to the C++ standard library class std::vector, this class intends to implement not simply an array that allows access to its elements, but indeed a vector that is a member of the mathematical concept of a "vector space" suitable for numerical computations.

Note
Instantiations for this template are provided for <float>, <double>, <std::complex<float>>, <std::complex<double>>; others can be generated in application programs (see the section on Template instantiations in the manual).

Definition at line 108 of file vector.h.

Member Function Documentation

◆ lp_norm()

Vector< int >::real_type Vector< int >::lp_norm ( const  real_type) const

Definition at line 83 of file vector.cc.

Friends And Related Function Documentation

◆ swap() [1/3]

template<typename Number >
void swap ( LinearAlgebra::CUDAWrappers::Vector< Number > &  u,
LinearAlgebra::CUDAWrappers::Vector< Number > &  v 
)
related

Global function swap which overloads the default implementation of the C++ standard library which uses a temporary object. The function simply exchanges the data of the two vectors.

Definition at line 360 of file cuda_vector.h.

◆ swap() [2/3]

template<typename Number , typename MemorySpace >
void swap ( LinearAlgebra::distributed::Vector< Number, MemorySpace > &  u,
LinearAlgebra::distributed::Vector< Number, MemorySpace > &  v 
)
related

Global function swap which overloads the default implementation of the C++ standard library which uses a temporary object. The function simply exchanges the data of the two vectors.

Definition at line 1861 of file la_parallel_vector.h.

◆ swap() [3/3]

template<typename Number >
void swap ( LinearAlgebra::ReadWriteVector< Number > &  u,
LinearAlgebra::ReadWriteVector< Number > &  v 
)
related

Global function swap which overloads the default implementation of the C++ standard library which uses a temporary object. The function simply exchanges the data of the two vectors.

Definition at line 1090 of file read_write_vector.h.


The documentation for this class was generated from the following files: