Vector< ValueType > Class Template Reference

Vector&lt; ValueType &gt; Class Template Reference#

Reference API: gko::experimental::distributed::Vector< ValueType > Class Template Reference
Reference API

#include <ginkgo/core/distributed/vector.hpp>

Inheritance diagram for gko::experimental::distributed::Vector< ValueType >:
[legend]

Public Types

using value_type = ValueType
 
using absolute_type = remove_complex< Vector >
 
using real_type = absolute_type
 
using complex_type = Vector< to_complex< value_type > >
 
using local_vector_type = gko::matrix::Dense< value_type >
 
- Public Types inherited from gko::EnablePolymorphicAssignment< ConcreteLinOp >
using result_type = ConcreteLinOp
 
- Public Types inherited from gko::ConvertibleTo< ResultType >
using result_type = ResultType
 
- Public Types inherited from gko::EnableAbsoluteComputation< AbsoluteLinOp >
using absolute_type = AbsoluteLinOp
 

Public Member Functions

void read_distributed (const device_matrix_data< ValueType, int64 > &data, ptr_param< const Partition< int64, int64 > > partition)
 
void read_distributed (const device_matrix_data< ValueType, int64 > &data, ptr_param< const Partition< int32, int64 > > partition)
 
void read_distributed (const device_matrix_data< ValueType, int32 > &data, ptr_param< const Partition< int32, int32 > > partition)
 
void read_distributed (const matrix_data< ValueType, int64 > &data, ptr_param< const Partition< int64, int64 > > partition)
 
void read_distributed (const matrix_data< ValueType, int64 > &data, ptr_param< const Partition< int32, int64 > > partition)
 
void read_distributed (const matrix_data< ValueType, int32 > &data, ptr_param< const Partition< int32, int32 > > partition)
 
void convert_to (Vector< next_precision< ValueType > > *result) const override
 
void move_to (Vector< next_precision< ValueType > > *result) override
 
void convert_to (Vector< next_precision< next_precision< ValueType > > > *result) const override
 
void move_to (Vector< next_precision< next_precision< ValueType > > > *result) override
 
std::unique_ptr< absolute_type > compute_absolute () const override
 
void compute_absolute_inplace () override
 
std::unique_ptr< complex_typemake_complex () const
 
void make_complex (ptr_param< complex_type > result) const
 
std::unique_ptr< real_type > get_real () const
 
void get_real (ptr_param< real_type > result) const
 
std::unique_ptr< real_type > get_imag () const
 
void get_imag (ptr_param< real_type > result) const
 
void fill (ValueType value)
 
void scale (ptr_param< const LinOp > alpha)
 
void inv_scale (ptr_param< const LinOp > alpha)
 
void add_scaled (ptr_param< const LinOp > alpha, ptr_param< const LinOp > b)
 
void sub_scaled (ptr_param< const LinOp > alpha, ptr_param< const LinOp > b)
 
void compute_dot (ptr_param< const LinOp > b, ptr_param< LinOp > result) const
 
void compute_dot (ptr_param< const LinOp > b, ptr_param< LinOp > result, array< char > &tmp) const
 
void compute_conj_dot (ptr_param< const LinOp > b, ptr_param< LinOp > result) const
 
void compute_conj_dot (ptr_param< const LinOp > b, ptr_param< LinOp > result, array< char > &tmp) const
 
void compute_squared_norm2 (ptr_param< LinOp > result) const
 
void compute_squared_norm2 (ptr_param< LinOp > result, array< char > &tmp) const
 
void compute_norm2 (ptr_param< LinOp > result) const
 
void compute_norm2 (ptr_param< LinOp > result, array< char > &tmp) const
 
void compute_norm1 (ptr_param< LinOp > result) const
 
void compute_norm1 (ptr_param< LinOp > result, array< char > &tmp) const
 
void compute_mean (ptr_param< LinOp > result) const
 
void compute_mean (ptr_param< LinOp > result, array< char > &tmp) const
 
value_type & at_local (size_type row, size_type col) noexcept
 
value_type at_local (size_type row, size_type col) const noexcept
 
ValueType & at_local (size_type idx) noexcept
 
ValueType at_local (size_type idx) const noexcept
 
value_type * get_local_values ()
 
const value_type * get_const_local_values () const
 
const local_vector_typeget_local_vector () const
 
std::unique_ptr< const real_type > create_real_view () const
 
std::unique_ptr< real_type > create_real_view ()
 
size_type get_stride () const noexcept
 
- Public Member Functions inherited from gko::EnableLinOp< ConcreteLinOp, PolymorphicBase >
const ConcreteLinOp * apply (ptr_param< const LinOp > b, ptr_param< LinOp > x) const
 
ConcreteLinOp * apply (ptr_param< const LinOp > b, ptr_param< LinOp > x)
 
const ConcreteLinOp * apply (ptr_param< const LinOp > alpha, ptr_param< const LinOp > b, ptr_param< const LinOp > beta, ptr_param< LinOp > x) const
 
ConcreteLinOp * apply (ptr_param< const LinOp > alpha, ptr_param< const LinOp > b, ptr_param< const LinOp > beta, ptr_param< LinOp > x)
 
- Public Member Functions inherited from gko::EnableAbstractPolymorphicObject< AbstractObject, PolymorphicBase >
std::unique_ptr< AbstractObject > create_default (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< AbstractObject > create_default () const
 
std::unique_ptr< AbstractObject > clone (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< AbstractObject > clone () const
 
AbstractObject * copy_from (const PolymorphicObject *other)
 
template<typename Derived >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, AbstractObject > * copy_from (std::unique_ptr< Derived > &&other)
 
template<typename Derived >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, AbstractObject > * copy_from (const std::unique_ptr< Derived > &other)
 
AbstractObject * copy_from (const std::shared_ptr< const PolymorphicObject > &other)
 
AbstractObject * move_from (ptr_param< PolymorphicObject > other)
 
AbstractObject * clear ()
 
- Public Member Functions inherited from gko::PolymorphicObject
PolymorphicObjectoperator= (const PolymorphicObject &)
 
std::unique_ptr< PolymorphicObjectcreate_default (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< PolymorphicObjectcreate_default () const
 
std::unique_ptr< PolymorphicObjectclone (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< PolymorphicObjectclone () const
 
PolymorphicObjectcopy_from (const PolymorphicObject *other)
 
template<typename Derived , typename Deleter >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, PolymorphicObject > * copy_from (std::unique_ptr< Derived, Deleter > &&other)
 
template<typename Derived , typename Deleter >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, PolymorphicObject > * copy_from (const std::unique_ptr< Derived, Deleter > &other)
 
PolymorphicObjectcopy_from (const std::shared_ptr< const PolymorphicObject > &other)
 
PolymorphicObjectmove_from (ptr_param< PolymorphicObject > other)
 
PolymorphicObjectclear ()
 
std::shared_ptr< const Executorget_executor () const noexcept
 
- Public Member Functions inherited from gko::log::EnableLogging< PolymorphicObject >
void add_logger (std::shared_ptr< const Logger > logger) override
 
void remove_logger (const Logger *logger) override
 
void remove_logger (ptr_param< const Logger > logger)
 
const std::vector< std::shared_ptr< const Logger > > & get_loggers () const override
 
void clear_loggers () override
 
- Public Member Functions inherited from gko::log::Loggable
void remove_logger (ptr_param< const Logger > logger)
 
- Public Member Functions inherited from gko::EnablePolymorphicAssignment< ConcreteLinOp >
void convert_to (result_type *result) const override
 
void move_to (result_type *result) override
 
- Public Member Functions inherited from gko::ConvertibleTo< ResultType >
virtual void convert_to (result_type *result) const =0
 
void convert_to (ptr_param< result_type > result) const
 
virtual void move_to (result_type *result)=0
 
void move_to (ptr_param< result_type > result)
 
- Public Member Functions inherited from gko::EnableAbsoluteComputation< AbsoluteLinOp >
std::unique_ptr< LinOpcompute_absolute_linop () const override
 
- Public Member Functions inherited from gko::experimental::distributed::DistributedBase
 DistributedBase (const DistributedBase &other)=default
 
 DistributedBase (DistributedBase &&other)=default
 
DistributedBaseoperator= (const DistributedBase &)
 
DistributedBaseoperator= (DistributedBase &&) noexcept
 
mpi::communicator get_communicator () const
 

Static Public Member Functions

static std::unique_ptr< Vectorcreate_with_config_of (ptr_param< const Vector > other)
 
static std::unique_ptr< Vectorcreate_with_type_of (ptr_param< const Vector > other, std::shared_ptr< const Executor > exec)
 
static std::unique_ptr< Vectorcreate_with_type_of (ptr_param< const Vector > other, std::shared_ptr< const Executor > exec, const dim< 2 > &global_size, const dim< 2 > &local_size, size_type stride)
 
static std::unique_ptr< Vectorcreate (std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size, dim< 2 > local_size, size_type stride)
 
static std::unique_ptr< Vectorcreate (std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size={}, dim< 2 > local_size={})
 
static std::unique_ptr< Vectorcreate (std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size, std::unique_ptr< local_vector_type > local_vector)
 
static std::unique_ptr< Vectorcreate (std::shared_ptr< const Executor > exec, mpi::communicator comm, std::unique_ptr< local_vector_type > local_vector)
 
static std::unique_ptr< const Vectorcreate_const (std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size, std::unique_ptr< const local_vector_type > local_vector)
 
static std::unique_ptr< const Vectorcreate_const (std::shared_ptr< const Executor > exec, mpi::communicator comm, std::unique_ptr< const local_vector_type > local_vector)
 

Protected Member Functions

 Vector (std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size, dim< 2 > local_size, size_type stride)
 
 Vector (std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size={}, dim< 2 > local_size={})
 
 Vector (std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size, std::unique_ptr< local_vector_type > local_vector)
 
 Vector (std::shared_ptr< const Executor > exec, mpi::communicator comm, std::unique_ptr< local_vector_type > local_vector)
 
void resize (dim< 2 > global_size, dim< 2 > local_size)
 
template<typename LocalIndexType , typename GlobalIndexType >
void read_distributed_impl (const device_matrix_data< ValueType, GlobalIndexType > &data, const Partition< LocalIndexType, GlobalIndexType > *partition)
 
void apply_impl (const LinOp *, LinOp *) const override
 
void apply_impl (const LinOp *, const LinOp *, const LinOp *, LinOp *) const override
 
virtual std::unique_ptr< Vectorcreate_with_same_config () const
 
virtual std::unique_ptr< Vectorcreate_with_type_of_impl (std::shared_ptr< const Executor > exec, const dim< 2 > &global_size, const dim< 2 > &local_size, size_type stride) const
 
- Protected Member Functions inherited from gko::EnableLinOp< ConcreteLinOp, PolymorphicBase >
ConcreteLinOp * self () noexcept
 
const ConcreteLinOp * self () const noexcept
 
- Protected Member Functions inherited from gko::EnablePolymorphicObject< ConcreteObject, PolymorphicBase >
std::unique_ptr< PolymorphicObjectcreate_default_impl (std::shared_ptr< const Executor > exec) const override
 
PolymorphicObjectcopy_from_impl (const PolymorphicObject *other) override
 
PolymorphicObjectcopy_from_impl (std::unique_ptr< PolymorphicObject > other) override
 
PolymorphicObjectmove_from_impl (PolymorphicObject *other) override
 
PolymorphicObjectmove_from_impl (std::unique_ptr< PolymorphicObject > other) override
 
PolymorphicObjectclear_impl () override
 
- Protected Member Functions inherited from gko::PolymorphicObject
 PolymorphicObject (std::shared_ptr< const Executor > exec)
 
 PolymorphicObject (const PolymorphicObject &other)
 
- Protected Member Functions inherited from gko::log::EnableLogging< PolymorphicObject >
void log (Params &&... params) const
 
- Protected Member Functions inherited from gko::experimental::distributed::DistributedBase
 DistributedBase (mpi::communicator comm)
 

Friends

class EnablePolymorphicObject< Vector, LinOp >
 
class Vector< to_complex< ValueType > >
 
class Vector< remove_complex< ValueType > >
 
class Vector< previous_precision< ValueType > >
 
class Vector< previous_precision< previous_precision< ValueType > > >
 

Additional Inherited Members

- Protected Attributes inherited from gko::log::EnableLogging< PolymorphicObject >
std::vector< std::shared_ptr< const Logger > > loggers_
 

Detailed Description

template<typename ValueType = double>
class gko::experimental::distributed::Vector< ValueType >

Vector is a format which explicitly stores (multiple) distributed column vectors in a dense storage format.

The (multi-)vector is distributed by row, which is described by a

See also
Partition. The local vectors are stored using the
Dense format. The vector should be filled using the read_distributed method, e.g.
auto vector = Vector<...>::create(exec, comm);
vector->read_distributed(matrix_data, part);
static std::unique_ptr< Partition > build_from_mapping(std::shared_ptr< const Executor > exec, const array< comm_index_type > &mapping, comm_index_type num_parts)
static std::unique_ptr< Vector > create(std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size, dim< 2 > local_size, size_type stride)
Definition matrix_data.hpp:126
Using this approach the size of the global vectors, as well as the size of the local vectors, will be automatically inferred. It is possible to create a vector with specified global and local sizes and fill the local vectors using the accessor get_local_vector.
Note
Operations between two vectors (axpy, dot product, etc.) are only valid if both vectors where created using the same partition.
Template Parameters
ValueTypeThe precision of vector elements.

Member Function Documentation

◆ add_scaled()

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::add_scaled ( ptr_param< const LinOp alpha,
ptr_param< const LinOp b 
)

Adds b scaled by alpha to the vectors (aka: BLAS axpy).

Parameters
alphaIf alpha is 1x1 Dense matrix, the all vectors of b are scaled by alpha. If it is a Dense row vector of values, then i-th column vector of b is scaled with the i-th element of alpha (the number of columns of alpha has to match the number of vectors).
ba (multi-)vector of the same dimension as this

◆ at_local() [1/4]

template<typename ValueType = double>
ValueType gko::experimental::distributed::Vector< ValueType >::at_local ( size_type  idx) const
noexcept

◆ at_local() [2/4]

template<typename ValueType = double>
ValueType & gko::experimental::distributed::Vector< ValueType >::at_local ( size_type  idx)
noexcept

Returns a single element of the multi-vector.

Useful for iterating across all elements of the multi-vector. However, it is less efficient than the two-parameter variant of this method.

Parameters
idxa linear index of the requested element (ignoring the stride)
Note
the method has to be called on the same Executor the matrix is stored at (e.g. trying to call this method on a GPU matrix from the OMP results in a runtime error)

◆ at_local() [3/4]

template<typename ValueType = double>
value_type gko::experimental::distributed::Vector< ValueType >::at_local ( size_type  row,
size_type  col 
) const
noexcept

◆ at_local() [4/4]

template<typename ValueType = double>
value_type & gko::experimental::distributed::Vector< ValueType >::at_local ( size_type  row,
size_type  col 
)
noexcept

Returns a single element of the multi-vector.

Parameters
rowthe local row of the requested element
colthe local column of the requested element
Note
the method has to be called on the same Executor the multi-vector is stored at (e.g. trying to call this method on a GPU multi-vector from the OMP results in a runtime error)

◆ compute_absolute()

template<typename ValueType = double>
std::unique_ptr< absolute_type > gko::experimental::distributed::Vector< ValueType >::compute_absolute ( ) const
overridevirtual

Gets the AbsoluteLinOp

Returns
a pointer to the new absolute object

Implements gko::EnableAbsoluteComputation< AbsoluteLinOp >.

◆ compute_absolute_inplace()

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_absolute_inplace ( )
overridevirtual

Compute absolute inplace on each element.

Implements gko::AbsoluteComputable.

◆ compute_conj_dot() [1/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_conj_dot ( ptr_param< const LinOp b,
ptr_param< LinOp result 
) const

Computes the column-wise dot product of this (multi-)vector and conj(b) using a global reduction.

Parameters
ba (multi-)vector of same dimension as this
resulta Dense row matrix, used to store the dot product (the number of column in result must match the number of columns of this)

◆ compute_conj_dot() [2/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_conj_dot ( ptr_param< const LinOp b,
ptr_param< LinOp result,
array< char > &  tmp 
) const

Computes the column-wise dot product of this (multi-)vector and conj(b) using a global reduction.

Parameters
ba (multi-)vector of same dimension as this
resulta Dense row matrix, used to store the dot product (the number of column in result must match the number of columns of this)
tmpthe temporary storage to use for partial sums during the reduction computation. It may be resized and/or reset to the correct executor.

◆ compute_dot() [1/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_dot ( ptr_param< const LinOp b,
ptr_param< LinOp result 
) const

Computes the column-wise dot product of this (multi-)vector and b using a global reduction.

Parameters
ba (multi-)vector of same dimension as this
resulta Dense row matrix, used to store the dot product (the number of column in result must match the number of columns of this)

◆ compute_dot() [2/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_dot ( ptr_param< const LinOp b,
ptr_param< LinOp result,
array< char > &  tmp 
) const

Computes the column-wise dot product of this (multi-)vector and b using a global reduction.

Parameters
ba (multi-)vector of same dimension as this
resulta Dense row matrix, used to store the dot product (the number of column in result must match the number of columns of this)
tmpthe temporary storage to use for partial sums during the reduction computation. It may be resized and/or reset to the correct executor.

◆ compute_mean() [1/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_mean ( ptr_param< LinOp result) const

Computes the column-wise mean of this (multi-)vector using a global reduction.

Parameters
resulta Dense row matrix, used to store the mean (the number of columns in result must match the number of columns of this)

◆ compute_mean() [2/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_mean ( ptr_param< LinOp result,
array< char > &  tmp 
) const

Computes the column-wise arithmetic mean of this (multi-)vector using a global reduction.

Parameters
resulta Dense row matrix, used to store the mean (the number of columns in result must match the number of columns of this)
tmpthe temporary storage to use for partial sums during the reduction computation. It may be resized and/or reset to the correct executor.

◆ compute_norm1() [1/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_norm1 ( ptr_param< LinOp result) const

Computes the column-wise (L^1) norm of this (multi-)vector.

Parameters
resulta Dense row matrix, used to store the norm (the number of columns in result must match the number of columns of this)

◆ compute_norm1() [2/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_norm1 ( ptr_param< LinOp result,
array< char > &  tmp 
) const

Computes the column-wise (L^1) norm of this (multi-)vector using a global reduction.

Parameters
resulta Dense row matrix, used to store the norm (the number of columns in result must match the number of columns of this)
tmpthe temporary storage to use for partial sums during the reduction computation. It may be resized and/or reset to the correct executor.

◆ compute_norm2() [1/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_norm2 ( ptr_param< LinOp result) const

Computes the Euclidean (L^2) norm of this (multi-)vector using a global reduction.

Parameters
resulta Dense row matrix, used to store the norm (the number of columns in result must match the number of columns of this)

◆ compute_norm2() [2/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_norm2 ( ptr_param< LinOp result,
array< char > &  tmp 
) const

Computes the Euclidean (L^2) norm of this (multi-)vector using a global reduction.

Parameters
resulta Dense row matrix, used to store the norm (the number of columns in result must match the number of columns of this)
tmpthe temporary storage to use for partial sums during the reduction computation. It may be resized and/or reset to the correct executor.

◆ compute_squared_norm2() [1/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_squared_norm2 ( ptr_param< LinOp result) const

Computes the square of the column-wise Euclidean ( \(L^2\)) norm of this (multi-)vector using a global reduction.

Parameters
resulta Dense row vector, used to store the norm (the number of columns in the vector must match the number of columns of this)

◆ compute_squared_norm2() [2/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::compute_squared_norm2 ( ptr_param< LinOp result,
array< char > &  tmp 
) const

Computes the square of the column-wise Euclidean ( \(L^2\)) norm of this (multi-)vector using a global reduction.

Parameters
resulta Dense row vector, used to store the norm (the number of columns in the vector must match the number of columns of this)
tmpthe temporary storage to use for partial sums during the reduction computation. It may be resized and/or reset to the correct executor.

◆ create() [1/4]

template<typename ValueType = double>
static std::unique_ptr< Vector > gko::experimental::distributed::Vector< ValueType >::create ( std::shared_ptr< const Executor exec,
mpi::communicator  comm,
dim< 2 >  global_size,
dim< 2 >  local_size,
size_type  stride 
)
static

Creates an empty distributed vector with a specified size

Parameters
execExecutor associated with vector
commCommunicator associated with vector
global_sizeGlobal size of the vector
local_sizeProcessor-local size of the vector
strideStride of the local vector.
Returns
A smart pointer to the newly created vector.

◆ create() [2/4]

template<typename ValueType = double>
static std::unique_ptr< Vector > gko::experimental::distributed::Vector< ValueType >::create ( std::shared_ptr< const Executor exec,
mpi::communicator  comm,
dim< 2 >  global_size,
std::unique_ptr< local_vector_type local_vector 
)
static

Creates a distributed vector from local vectors with a specified size.

Note
The data form the local_vector will be moved into the new distributed vector. You could either move in a std::unique_ptr directly, copy a local vector with gko::clone, or create a unique non-owining view of a given local vector with gko::make_dense_view.
Parameters
execExecutor associated with this vector
commCommunicator associated with this vector
global_sizeThe global size of the vector
local_vectorThe underlying local vector, the data will be moved into this
Returns
A smart pointer to the newly created vector.

◆ create() [3/4]

template<typename ValueType = double>
static std::unique_ptr< Vector > gko::experimental::distributed::Vector< ValueType >::create ( std::shared_ptr< const Executor exec,
mpi::communicator  comm,
dim< 2 >  global_size = {},
dim< 2 >  local_size = {} 
)
static

Creates an empty distributed vector with a specified size

Parameters
execExecutor associated with vector
commCommunicator associated with vector
global_sizeGlobal size of the vector
local_sizeProcessor-local size of the vector, uses local_size[1] as the stride
Returns
A smart pointer to the newly created vector.

◆ create() [4/4]

template<typename ValueType = double>
static std::unique_ptr< Vector > gko::experimental::distributed::Vector< ValueType >::create ( std::shared_ptr< const Executor exec,
mpi::communicator  comm,
std::unique_ptr< local_vector_type local_vector 
)
static

Creates a distributed vector from local vectors. The global size will be deduced from the local sizes, which will incur a collective communication.

Note
The data form the local_vector will be moved into the new distributed vector. You could either move in a std::unique_ptr directly, copy a local vector with gko::clone, or create a unique non-owining view of a given local vector with gko::make_dense_view.
Parameters
execExecutor associated with this vector
commCommunicator associated with this vector
local_vectorThe underlying local vector, the data will be moved into this.
Returns
A smart pointer to the newly created vector.

◆ create_const() [1/2]

template<typename ValueType = double>
static std::unique_ptr< const Vector > gko::experimental::distributed::Vector< ValueType >::create_const ( std::shared_ptr< const Executor exec,
mpi::communicator  comm,
dim< 2 >  global_size,
std::unique_ptr< const local_vector_type local_vector 
)
static

Creates a constant (immutable) distributed Vector from a constant local vector.

Parameters
execExecutor associated with this vector
commCommunicator associated with this vector
global_sizeThe global size of the vector
local_vectorThe underlying local vector, of which a view is created
Returns
A smart pointer to the newly created vector.

◆ create_const() [2/2]

template<typename ValueType = double>
static std::unique_ptr< const Vector > gko::experimental::distributed::Vector< ValueType >::create_const ( std::shared_ptr< const Executor exec,
mpi::communicator  comm,
std::unique_ptr< const local_vector_type local_vector 
)
static

Creates a constant (immutable) distributed Vector from a constant local vector. The global size will be deduced from the local sizes, which will incur a collective communication.

Parameters
execExecutor associated with this vector
commCommunicator associated with this vector
local_vectorThe underlying local vector, of which a view is created
Returns
A smart pointer to the newly created vector.

◆ create_real_view() [1/2]

template<typename ValueType = double>
std::unique_ptr< real_type > gko::experimental::distributed::Vector< ValueType >::create_real_view ( )

Create a real view of the (potentially) complex original multi-vector. If the original vector is real, nothing changes. If the original vector is complex, the result is created by viewing the complex vector with as real with a reinterpret_cast with twice the number of columns and double the stride.

◆ create_real_view() [2/2]

template<typename ValueType = double>
std::unique_ptr< const real_type > gko::experimental::distributed::Vector< ValueType >::create_real_view ( ) const

Create a real view of the (potentially) complex original multi-vector. If the original vector is real, nothing changes. If the original vector is complex, the result is created by viewing the complex vector with as real with a reinterpret_cast with twice the number of columns and double the stride.

◆ create_with_config_of()

template<typename ValueType = double>
static std::unique_ptr< Vector > gko::experimental::distributed::Vector< ValueType >::create_with_config_of ( ptr_param< const Vector< ValueType > >  other)
static

Creates a distributed Vector with the same size and stride as another Vector.

Parameters
otherThe other vector whose configuration needs to copied.

◆ create_with_same_config()

template<typename ValueType = double>
virtual std::unique_ptr< Vector > gko::experimental::distributed::Vector< ValueType >::create_with_same_config ( ) const
protectedvirtual

Creates a distributed vector with the same size and stride as the callers vector.

Returns
a Vector with the same size and stride as the caller.

◆ create_with_type_of() [1/2]

template<typename ValueType = double>
static std::unique_ptr< Vector > gko::experimental::distributed::Vector< ValueType >::create_with_type_of ( ptr_param< const Vector< ValueType > >  other,
std::shared_ptr< const Executor exec 
)
static

Creates an empty Vector with the same type as another Vector, but on a different executor.

Parameters
otherThe other multi-vector whose type we target.
execThe executor of the new multi-vector.
Note
The new multi-vector uses the same communicator as other.
Returns
an empty Vector with the type of other.

◆ create_with_type_of() [2/2]

template<typename ValueType = double>
static std::unique_ptr< Vector > gko::experimental::distributed::Vector< ValueType >::create_with_type_of ( ptr_param< const Vector< ValueType > >  other,
std::shared_ptr< const Executor exec,
const dim< 2 > &  global_size,
const dim< 2 > &  local_size,
size_type  stride 
)
static

Creates an Vector with the same type as another Vector, but on a different executor and with a different size.

Parameters
otherThe other multi-vector whose type we target.
execThe executor of the new multi-vector.
global_sizeThe global size of the multi-vector.
local_sizeThe local size of the multi-vector.
strideThe stride of the new multi-vector.
Returns
a Vector of specified size with the type of other.

◆ create_with_type_of_impl()

template<typename ValueType = double>
virtual std::unique_ptr< Vector > gko::experimental::distributed::Vector< ValueType >::create_with_type_of_impl ( std::shared_ptr< const Executor exec,
const dim< 2 > &  global_size,
const dim< 2 > &  local_size,
size_type  stride 
) const
protectedvirtual

Creates a Vector with the same type as the callers multi-vector.

Note
The new vector will use the same communicator as the caller.
Parameters
execthe executor of the new vector.
global_sizeglobal_size of the vector.
local_sizethe size of the local Dense vector.
stridethe stride of the local Dense vector.
Returns
a Vector with the same type as the caller.

◆ fill()

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::fill ( ValueType  value)

Fill the distributed vectors with a given value.

Parameters
valuethe value to be filled

◆ get_const_local_values()

template<typename ValueType = double>
const value_type * gko::experimental::distributed::Vector< ValueType >::get_const_local_values ( ) const

Returns a pointer to the array of local values of the multi-vector.

Returns
the pointer to the array of local values
Note
This is the constant version of the function, which can be significantly more memory efficient than the non-constant version, so always prefer this version.

◆ get_imag() [1/2]

template<typename ValueType = double>
std::unique_ptr< real_type > gko::experimental::distributed::Vector< ValueType >::get_imag ( ) const

Creates new real vectors and extracts the imaginary part of the original vectors into that.

◆ get_imag() [2/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::get_imag ( ptr_param< real_type >  result) const

Extracts the imaginary part of the original vectors into given real vectors.

◆ get_local_values()

template<typename ValueType = double>
value_type * gko::experimental::distributed::Vector< ValueType >::get_local_values ( )

Returns a pointer to the array of local values of the multi-vector.

Returns
the pointer to the array of local values

◆ get_local_vector()

template<typename ValueType = double>
const local_vector_type * gko::experimental::distributed::Vector< ValueType >::get_local_vector ( ) const

Direct (read) access to the underlying local local_vector_type vectors.

Returns
a constant pointer to the underlying local_vector_type vectors

◆ get_real() [1/2]

template<typename ValueType = double>
std::unique_ptr< real_type > gko::experimental::distributed::Vector< ValueType >::get_real ( ) const

Creates new real vectors and extracts the real part of the original vectors into that.

◆ get_real() [2/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::get_real ( ptr_param< real_type >  result) const

Extracts the real part of the original vectors into given real vectors.

◆ inv_scale()

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::inv_scale ( ptr_param< const LinOp alpha)

Scales the vectors with the inverse of a scalar.

Parameters
alphaIf alpha is 1x1 Dense matrix, the all vectors are scaled by 1 / alpha. If it is a Dense row vector of values, then i-th column vector is scaled with the inverse of the i-th element of alpha (the number of columns of alpha has to match the number of vectors).

◆ make_complex() [1/2]

template<typename ValueType = double>
std::unique_ptr< complex_type > gko::experimental::distributed::Vector< ValueType >::make_complex ( ) const

Creates a complex copy of the original vectors. If the original vectors were real, the imaginary part of the result will be zero.

◆ make_complex() [2/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::make_complex ( ptr_param< complex_type result) const

Writes a complex copy of the original vectors to given complex vectors. If the original vectors were real, the imaginary part of the result will be zero.

◆ read_distributed() [1/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::read_distributed ( const device_matrix_data< ValueType, int64 > &  data,
ptr_param< const Partition< int64, int64 > >  partition 
)

Reads a vector from the device_matrix_data structure and a global row partition.

The number of rows of the matrix data is ignored, only its number of columns is relevant. Both the number of local and global rows are inferred from the row partition.

Note
The matrix data can contain entries for rows other than those owned by the process. Entries for those rows are discarded.
Parameters
dataThe device_matrix_data structure
partitionThe global row partition

◆ read_distributed() [2/2]

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::read_distributed ( const matrix_data< ValueType, int64 > &  data,
ptr_param< const Partition< int64, int64 > >  partition 
)

Reads a vector from the matrix_data structure and a global row partition.

See @read_distributed

Note
For efficiency it is advised to use the device_matrix_data overload.

◆ scale()

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::scale ( ptr_param< const LinOp alpha)

Scales the vectors with a scalar (aka: BLAS scal).

Parameters
alphaIf alpha is 1x1 Dense matrx, the all vectors are scaled by alpha. If it is a Dense row vector of values, then i-th column vector is scaled with the i-th element of alpha (the number of columns of alpha has to match the number of vectors).

◆ sub_scaled()

template<typename ValueType = double>
void gko::experimental::distributed::Vector< ValueType >::sub_scaled ( ptr_param< const LinOp alpha,
ptr_param< const LinOp b 
)

Subtracts b scaled by alpha from the vectors (aka: BLAS axpy).

Parameters
alphaIf alpha is 1x1 Dense matrix, the all vectors of b are scaled by alpha. If it is a Dense row vector of values, then i-th column vector of b is scaled with the i-th element of alpha (the number of c
ba (multi-)vector of the same dimension as this

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