Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Related Symbols | List of all members
Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > Class Template Reference

A distributed dense vector. More...

#include <Tpetra_Vector_decl.hpp>

Inheritance diagram for Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >:
Inheritance graph
[legend]

Public Types

Typedefs to facilitate template metaprogramming
typedef Scalar scalar_type
 This class' first template parameter; the type of each entry in the Vector.
 
typedef base_type::impl_scalar_type impl_scalar_type
 The type used internally in place of Scalar.
 
typedef LocalOrdinal local_ordinal_type
 This class' second template parameter; the type of local indices.
 
typedef GlobalOrdinal global_ordinal_type
 This class' third template parameter; the type of global indices.
 
typedef Node::device_type device_type
 The Kokkos device type.
 
typedef Node node_type
 The Kokkos Node type.
 
typedef base_type::dot_type dot_type
 Type of an inner ("dot") product result.
 
typedef base_type::mag_type mag_type
 Type of a norm result.
 
typedef base_type::dual_view_type dual_view_type
 Kokkos::DualView specialization used by this class.
 
typedef base_type::wrapped_dual_view_type wrapped_dual_view_type
 WrappedDualView specialization used by this class.
 
typedef base_type::map_type map_type
 The type of the Map specialization used by this class.
 
Typedefs to facilitate template metaprogramming.
using execution_space = typename device_type::execution_space
 Type of the (new) Kokkos execution space.
 
Typedefs
using packet_type = typename ::Kokkos::ArithTraits< Scalar >::val_type
 The type of each datum being sent or received in an Import or Export.
 

Public Member Functions

Constructors and destructor
 Vector ()
 Default constructor: makes a Vector with no rows or columns.
 
 Vector (const Teuchos::RCP< const map_type > &map, const bool zeroOut=true)
 Basic constructor.
 
 Vector (const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView)
 Copy constructor (shallow or deep copy).
 
 Vector (const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::RCP< const map_type > &map, const local_ordinal_type rowOffset=0)
 "Offset view" constructor that views the input Vector's local data, but with the given Map, using the given row offset.
 
 Vector (const Teuchos::RCP< const map_type > &map, const Teuchos::ArrayView< const Scalar > &A)
 Set vector values from an existing array (copy)
 
 Vector (const Teuchos::RCP< const map_type > &map, const dual_view_type &view)
 Expert mode constructor, that takes a Kokkos::DualView of the Vector's data, and returns a Vector that views those data.
 
 Vector (const Teuchos::RCP< const map_type > &map, const dual_view_type &view, const dual_view_type &origView)
 Expert mode constructor, that takes a Kokkos::DualView of the Vector's data and the "original" Kokkos::DualView of the data, and returns a Vector that views those data.
 
 Vector (const Teuchos::RCP< const map_type > &map, const wrapped_dual_view_type &d_view)
 Expert mode constructor, that takes a WrappedDualView of the MultiVector's data.
 
 Vector (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const size_t j)
 Create a Vector that views a single column of the input MultiVector.
 
 Vector (const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &)=default
 Copy constructor (shallow copy).
 
 Vector (Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &&)=default
 Move constructor (shallow move).
 
Vectoroperator= (const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &)=default
 Copy assignment (shallow copy).
 
Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & operator= (Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &&)=default
 Move assigment (shallow move).
 
virtual ~Vector ()=default
 Destructor (virtual for memory safety of derived classes).
 
Post-construction modification routines
void replaceGlobalValue (const GlobalOrdinal globalRow, const Scalar &value)
 Replace current value at the specified location with specified value.
 
void sumIntoGlobalValue (const GlobalOrdinal globalRow, const Scalar &value, const bool atomic=base_type::useAtomicUpdatesByDefault)
 Add value to existing value, using global (row) index.
 
void replaceLocalValue (const LocalOrdinal myRow, const Scalar &value)
 Replace current value at the specified location with specified values.
 
void sumIntoLocalValue (const LocalOrdinal myRow, const Scalar &value, const bool atomic=base_type::useAtomicUpdatesByDefault)
 Add value to existing value, using local (row) index.
 
Extraction methods
void get1dCopy (const Teuchos::ArrayView< Scalar > &A) const
 Return multi-vector values in user-provided two-dimensional array (using Teuchos memory management classes).
 
Teuchos::ArrayRCP< ScalargetDataNonConst ()
 View of the local values of this vector.
 
Teuchos::ArrayRCP< const ScalargetData () const
 Const view of the local values of this vector.
 
Mathematical methods
dot_type dot (const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &y) const
 Return the dot product of this Vector and the input Vector x.
 
mag_type norm1 () const
 Return the one-norm of this Vector.
 
mag_type norm2 () const
 Return the two-norm of this Vector.
 
mag_type normInf () const
 Return the infinity-norm of this Vector.
 
Scalar meanValue () const
 Compute mean (average) value of this Vector.
 
Implementation of the Teuchos::Describable interface
virtual std::string description () const
 Return a one-line description of this object.
 
virtual void describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
 Describe this object in a human-readable way to the given output stream.
 
Constructors and destructor
void swap (MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &mv)
 Swap contents of mv with contents of *this.
 
Get a copy or view of a subset of rows and/or columns

The following methods get either a (deep) copy or a view (shallow copy) of a subset of rows and/or columns of the MultiVector. They return one of the following:

  • Another MultiVector
  • A Kokkos::View or Kokkos::DualView
  • A Teuchos::ArrayRCP (see the Teuchos Memory Management Classes)

We prefer use of Kokkos classes to Teuchos Memory Management Classes. In particular, Teuchos::ArrayRCP reference counts are not thread safe, while Kokkos::View (and Kokkos::DualView) reference counts are thread safe.

Not all of these methods are valid for a particular MultiVector. For instance, calling a method that accesses a view of the data in a 1-D format (i.e., get1dView) requires that the target MultiVector have constant stride.

This category of methods also includes sync(), modify(), and getLocalView(), which help MultiVector implement DualView semantics.

Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > subCopy (const Teuchos::Range1D &colRng) const
 Return a MultiVector with copies of selected columns.
 
Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > subCopy (const Teuchos::ArrayView< const size_t > &cols) const
 Return a MultiVector with copies of selected columns.
 
Teuchos::RCP< const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > subView (const Teuchos::Range1D &colRng) const
 Return a const MultiVector with const views of selected columns.
 
Teuchos::RCP< const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > subView (const Teuchos::ArrayView< const size_t > &cols) const
 Return a const MultiVector with const views of selected columns.
 
Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > subViewNonConst (const Teuchos::Range1D &colRng)
 Return a MultiVector with views of selected columns.
 
Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > subViewNonConst (const Teuchos::ArrayView< const size_t > &cols)
 Return a MultiVector with views of selected columns.
 
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector (const size_t j) const
 Return a Vector which is a const view of column j.
 
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst (const size_t j)
 Return a Vector which is a nonconst view of column j.
 
Teuchos::ArrayRCP< const ScalargetData (size_t j) const
 Const view of the local values in a particular vector of this multivector.
 
Teuchos::ArrayRCP< ScalargetDataNonConst (size_t j)
 View of the local values in a particular vector of this multivector.
 
void get1dCopy (const Teuchos::ArrayView< Scalar > &A, const size_t LDA) const
 Fill the given array with a copy of this multivector's local values.
 
void get2dCopy (const Teuchos::ArrayView< const Teuchos::ArrayView< Scalar > > &ArrayOfPtrs) const
 Fill the given array with a copy of this multivector's local values.
 
Teuchos::ArrayRCP< const Scalarget1dView () const
 Const persisting (1-D) view of this multivector's local values.
 
Teuchos::ArrayRCP< Teuchos::ArrayRCP< const Scalar > > get2dView () const
 Return const persisting pointers to values.
 
Teuchos::ArrayRCP< Scalarget1dViewNonConst ()
 Nonconst persisting (1-D) view of this multivector's local values.
 
Teuchos::ArrayRCP< Teuchos::ArrayRCP< Scalar > > get2dViewNonConst ()
 Return non-const persisting pointers to values.
 
dual_view_type::t_host::const_type getLocalViewHost (Access::ReadOnlyStruct) const
 Return a read-only, up-to-date view of this MultiVector's local data on host. This requires that there are no live device-space views.
 
dual_view_type::t_host getLocalViewHost (Access::ReadWriteStruct)
 Return a mutable, up-to-date view of this MultiVector's local data on host. This requires that there are no live device-space views.
 
dual_view_type::t_host getLocalViewHost (Access::OverwriteAllStruct)
 Return a mutable view of this MultiVector's local data on host, assuming all existing data will be overwritten. This requires that there are no live device-space views.
 
dual_view_type::t_dev::const_type getLocalViewDevice (Access::ReadOnlyStruct) const
 Return a read-only, up-to-date view of this MultiVector's local data on device. This requires that there are no live host-space views.
 
dual_view_type::t_dev getLocalViewDevice (Access::ReadWriteStruct)
 Return a mutable, up-to-date view of this MultiVector's local data on device. This requires that there are no live host-space views.
 
dual_view_type::t_dev getLocalViewDevice (Access::OverwriteAllStruct)
 Return a mutable view of this MultiVector's local data on device, assuming all existing data will be overwritten. This requires that there are no live host-space views.
 
wrapped_dual_view_type getWrappedDualView () const
 Return the wrapped dual view holding this MultiVector's local data.
 
template<class TargetDeviceType >
bool need_sync () const
 Whether this MultiVector needs synchronization to the given space.
 
bool need_sync_host () const
 Whether this MultiVector needs synchronization to the host.
 
bool need_sync_device () const
 Whether this MultiVector needs synchronization to the device.
 
template<class TargetDeviceType >
std::remove_reference< decltype(std::declval< dual_view_type >().templateview< TargetDeviceType >())>::type::const_type getLocalView (Access::ReadOnlyStruct s) const
 Return a view of the local data on a specific device, with the given access mode. The return type is either dual_view_type::t_dev, dual_view_type::t_host, or the const_type of one of those.
 
Mathematical methods
void dot (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< dot_type > &dots) const
 Compute the dot product of each corresponding pair of vectors (columns) in A and B.
 
template<typename T >
std::enable_if<!(std::is_same< dot_type, T >::value), void >::type dot (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< T > &dots) const
 Compute the dot product of each corresponding pair of vectors (columns) in A and B.
 
template<typename T >
std::enable_if<!(std::is_same< dot_type, T >::value), void >::type dot (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, std::vector< T > &dots) const
 Like the above dot() overload, but for std::vector output.
 
void dot (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Kokkos::View< dot_type *, Kokkos::HostSpace > &norms) const
 Compute the dot product of each corresponding pair of vectors (columns) in A and B, storing the result in a device View.
 
template<typename T >
std::enable_if<!(std::is_same< dot_type, T >::value), void >::type dot (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Kokkos::View< T *, device_type > &dots) const
 Compute the dot product of each corresponding pair of vectors (columns) in A and B, storing the result in a device view.
 
void abs (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
 Put element-wise absolute values of input Multi-vector in target: A = abs(this)
 
void reciprocal (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
 Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,j).
 
void scale (const Scalar &alpha)
 Scale in place: this = alpha*this.
 
void scale (const Teuchos::ArrayView< const Scalar > &alpha)
 Scale each column in place: this[j] = alpha[j]*this[j].
 
void scale (const Kokkos::View< const impl_scalar_type *, device_type > &alpha)
 Scale each column in place: this[j] = alpha[j]*this[j].
 
void scale (const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
 Scale in place: this = alpha * A.
 
void update (const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
 Update: this = beta*this + alpha*A.
 
void update (const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &gamma)
 Update: this = gamma*this + alpha*A + beta*B.
 
void norm1 (const Kokkos::View< mag_type *, Kokkos::HostSpace > &norms) const
 Compute the one-norm of each vector (column), storing the result in a host view.
 
template<typename T >
std::enable_if<!(std::is_same< mag_type, T >::value), void >::type norm1 (const Kokkos::View< T *, device_type > &norms) const
 Compute the one-norm of each vector (column), storing the result in a device view.
 
void norm1 (const Teuchos::ArrayView< mag_type > &norms) const
 Compute the one-norm of each vector (column).
 
template<typename T >
std::enable_if<!(std::is_same< mag_type, T >::value), void >::type norm1 (const Teuchos::ArrayView< T > &norms) const
 Compute the one-norm of each vector (column).
 
void norm2 (const Kokkos::View< mag_type *, Kokkos::HostSpace > &norms) const
 Compute the two-norm of each vector (column), storing the result in a host View.
 
template<typename T >
std::enable_if<!(std::is_same< mag_type, T >::value), void >::type norm2 (const Kokkos::View< T *, device_type > &norms) const
 Compute the two-norm of each vector (column), storing the result in a device view.
 
void norm2 (const Teuchos::ArrayView< mag_type > &norms) const
 Compute the two-norm of each vector (column).
 
template<typename T >
std::enable_if<!(std::is_same< mag_type, T >::value), void >::type norm2 (const Teuchos::ArrayView< T > &norms) const
 Compute the two-norm of each vector (column).
 
void normInf (const Kokkos::View< mag_type *, Kokkos::HostSpace > &norms) const
 Compute the infinity-norm of each vector (column), storing the result in a host View.
 
template<typename T >
std::enable_if<!(std::is_same< mag_type, T >::value), void >::type normInf (const Kokkos::View< T *, device_type > &norms) const
 Compute the infinity-norm of each vector (column), storing the result in a device view.
 
void normInf (const Teuchos::ArrayView< mag_type > &norms) const
 Compute the infinity-norm of each vector (column), storing the result in a Teuchos::ArrayView.
 
template<typename T >
std::enable_if<!(std::is_same< mag_type, T >::value), void >::type normInf (const Teuchos::ArrayView< T > &norms) const
 Compute the infinity-norm of each vector (column), storing the result in a Teuchos::ArrayView.
 
void meanValue (const Teuchos::ArrayView< impl_scalar_type > &means) const
 Compute mean (average) value of each column.
 
void multiply (Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &beta)
 Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
 
void elementWiseMultiply (Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)
 Multiply a Vector A elementwise by a MultiVector B.
 
Attribute access functions
size_t getNumVectors () const
 Number of columns in the multivector.
 
size_t getLocalLength () const
 Local number of rows on the calling process.
 
global_size_t getGlobalLength () const
 Global number of rows in the multivector.
 
size_t getStride () const
 Stride between columns in the multivector.
 
bool isConstantStride () const
 Whether this multivector has constant stride between columns.
 
bool aliases (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &other) const
 Whether this multivector's memory might alias other. This is conservative: if either this or other is not constant stride, then it simply checks whether the contiguous memory allocations overlap. It doesn't check whether the sets of columns overlap. This is a symmetric relation: X.aliases(Y) == Y.aliases(X).
 
Public methods for redistributing data
void doImport (const SrcDistObject &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const CombineMode CM, const bool restrictedMode=false)
 Import data into this object using an Import object ("forward mode").
 
void doImport (const SrcDistObject &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, const CombineMode CM, const bool restrictedMode=false)
 Import data into this object using an Export object ("reverse mode").
 
void doExport (const SrcDistObject &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, const CombineMode CM, const bool restrictedMode=false)
 Export data into this object using an Export object ("forward mode").
 
void doExport (const SrcDistObject &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const CombineMode CM, const bool restrictedMode=false)
 Export data into this object using an Import object ("reverse mode").
 
bool transferArrived () const
 Whether the data from an import/export operation has arrived, and is ready for the unpack and combine step.
 
Attribute accessor methods
bool isDistributed () const
 Whether this is a globally distributed object.
 
virtual Teuchos::RCP< const map_typegetMap () const
 The Map describing the parallel distribution of this object.
 
I/O methods
void print (std::ostream &os) const
 Print this object to the given output stream.
 

Protected Member Functions

Misc. implementation details
std::string descriptionImpl (const std::string &className) const
 Implementation of description() for this class, and its subclass Vector.
 
std::string localDescribeToString (const Teuchos::EVerbosityLevel vl) const
 Print the calling process' verbose describe() information to the returned string.
 
void describeImpl (Teuchos::FancyOStream &out, const std::string &className, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
 Implementation of describe() for this class, and its subclass Vector.
 
template<class T >
Teuchos::ArrayRCP< TgetSubArrayRCP (Teuchos::ArrayRCP< T > arr, size_t j) const
 Persisting view of j-th column in the given ArrayRCP.
 
size_t getOrigNumLocalRows () const
 "Original" number of rows in the (local) data.
 
size_t getOrigNumLocalCols () const
 "Original" number of columns in the (local) data.
 

Related Symbols

(Note that these are not member symbols.)

template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > createMultiVector (const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const size_t numVectors)
 Nonmember MultiVector "constructor": Create a MultiVector from a given Map.
 
template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > createCopy (const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &src)
 Return a deep copy of the given Vector.
 
template<class Scalar , class LocalOrdinal , class GlobalOrdinal , class Node >
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > createVector (const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
 Nonmember Vector "constructor": Create a Vector from a given Map.
 
template<class DS , class DL , class DG , class DN , class SS , class SL , class SG , class SN >
void deep_copy (MultiVector< DS, DL, DG, DN > &dst, const MultiVector< SS, SL, SG, SN > &src)
 Copy the contents of the MultiVector src into dst.
 
template<class ST , class LO , class GO , class NT >
MultiVector< ST, LO, GO, NTcreateCopy (const MultiVector< ST, LO, GO, NT > &src)
 Return a deep copy of the given MultiVector.
 

Post-construction modification routines

void replaceGlobalValue (const GlobalOrdinal gblRow, const size_t col, const impl_scalar_type &value)
 Replace value in host memory, using global row index.
 
template<typename T >
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type replaceGlobalValue (GlobalOrdinal globalRow, size_t col, const T &value)
 Like the above replaceGlobalValue, but only enabled if T differs from impl_scalar_type.
 
void sumIntoGlobalValue (const GlobalOrdinal gblRow, const size_t col, const impl_scalar_type &value, const bool atomic=useAtomicUpdatesByDefault)
 Update (+=) a value in host memory, using global row index.
 
template<typename T >
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type sumIntoGlobalValue (const GlobalOrdinal gblRow, const size_t col, const T &val, const bool atomic=useAtomicUpdatesByDefault)
 Like the above sumIntoGlobalValue, but only enabled if T differs from impl_scalar_type.
 
void replaceLocalValue (const LocalOrdinal lclRow, const size_t col, const impl_scalar_type &value)
 Replace value in host memory, using local (row) index.
 
template<typename T >
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type replaceLocalValue (const LocalOrdinal lclRow, const size_t col, const T &val)
 Like the above replaceLocalValue, but only enabled if T differs from impl_scalar_type.
 
void sumIntoLocalValue (const LocalOrdinal lclRow, const size_t col, const impl_scalar_type &val, const bool atomic=useAtomicUpdatesByDefault)
 Update (+=) a value in host memory, using local row index.
 
template<typename T >
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type sumIntoLocalValue (const LocalOrdinal lclRow, const size_t col, const T &val, const bool atomic=useAtomicUpdatesByDefault)
 Like the above sumIntoLocalValue, but only enabled if T differs from impl_scalar_type.
 
void putScalar (const Scalar &value)
 Set all values in the multivector with the given value.
 
template<typename T >
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type putScalar (const T &value)
 Set all values in the multivector with the given value.
 
void randomize ()
 Set all values in the multivector to pseudorandom numbers.
 
void randomize (const Scalar &minVal, const Scalar &maxVal)
 Set all values in the multivector to pseudorandom numbers in the given range.
 
void replaceMap (const Teuchos::RCP< const map_type > &map)
 Replace the underlying Map in place.
 
void reduce ()
 Sum values of a locally replicated multivector across all processes.
 
static const bool useAtomicUpdatesByDefault
 Whether sumIntoLocalValue and sumIntoGlobalValue should use atomic updates by default.
 

Overridden from Teuchos::Describable

virtual void removeEmptyProcessesInPlace (const Teuchos::RCP< const map_type > &newMap) override
 Remove processes owning zero rows from the Map and their communicator.
 
void setCopyOrView (const Teuchos::DataAccess copyOrView)
 Set whether this has copy (copyOrView = Teuchos::Copy) or view (copyOrView = Teuchos::View) semantics.
 
Teuchos::DataAccess getCopyOrView () const
 Get whether this has copy (copyOrView = Teuchos::Copy) or view (copyOrView = Teuchos::View) semantics.
 
void assign (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &src)
 Copy the contents of src into *this (deep copy).
 
template<class T >
Teuchos::RCP< MultiVector< T, LocalOrdinal, GlobalOrdinal, Node > > convert () const
 Return another MultiVector with the same entries, but converted to a different Scalar type T.
 
bool isSameSize (const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
 
wrapped_dual_view_type view_
 The Kokkos::DualView containing the MultiVector's data.
 
Teuchos::Array< size_twhichVectors_
 Indices of columns this multivector is viewing.
 

Methods for use only by experts

virtual void removeEmptyProcessesInPlace (const Teuchos::RCP< const map_type > &newMap)
 Remove processes which contain no entries in this object's Map.
 
enum  ReverseOption
 Whether the data transfer should be performed in forward or reverse mode. More...
 
using buffer_memory_space = ::Tpetra::Details::DefaultTypes::comm_buffer_memory_space< device_type >
 Kokkos memory space for communication buffers.
 
virtual void doTransfer (const SrcDistObject &src, const ::Tpetra::Details::Transfer< local_ordinal_type, global_ordinal_type, node_type > &transfer, const char modeString[], const ReverseOption revOp, const CombineMode CM, const bool restrictedMode)
 Redistribute data across (MPI) processes.
 
virtual bool reallocArraysForNumPacketsPerLid (const size_t numExportLIDs, const size_t numImportLIDs)
 Reallocate numExportPacketsPerLID_ and/or numImportPacketsPerLID_, if necessary.
 
void beginTransfer (const SrcDistObject &src, const ::Tpetra::Details::Transfer< local_ordinal_type, global_ordinal_type, node_type > &transfer, const char modeString[], const ReverseOption revOp, const CombineMode CM, const bool restrictedMode)
 Implementation detail of doTransfer.
 

Implementation of Tpetra::DistObject

using buffer_device_type = typename DistObject< scalar_type, local_ordinal_type, global_ordinal_type, node_type >::buffer_device_type
 Kokkos::Device specialization for communication buffers.
 
virtual bool checkSizes (const SrcDistObject &sourceObj) override
 Whether data redistribution between sourceObj and this object is legal.
 
virtual size_t constantNumberOfPackets () const override
 Number of packets to send per LID.
 
virtual void copyAndPermute (const SrcDistObject &sourceObj, const size_t numSameIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteToLIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteFromLIDs, const CombineMode CM, const execution_space &space) override
 Same as copyAndPermute, but do operations in space.
 
virtual void copyAndPermute (const SrcDistObject &sourceObj, const size_t numSameIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteToLIDs, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &permuteFromLIDs, const CombineMode CM) override
 Perform copies and permutations that are local to the calling (MPI) process.
 
virtual bool reallocImportsIfNeeded (const size_t newSize, const bool verbose, const std::string *prefix, const bool areRemoteLIDsContiguous=false, const CombineMode CM=INSERT) override
 Reallocate imports_ if needed.
 

Methods implemented by subclasses and used by doTransfer().

The doTransfer() method uses the subclass' implementations of these methods to implement data transfer. Subclasses of DistObject must implement these methods. This is an instance of the Template Method Pattern. ("Template" here doesn't mean "C++ template"; it means "pattern with holes that are filled in by the subclass' method implementations.")

Teuchos::RCP< const map_typemap_
 The Map over which this object is distributed.
 
Kokkos::DualView< packet_type *, buffer_device_typeimports_
 Buffer into which packed data are imported (received from other processes).
 
Kokkos::DualView< size_t *, buffer_device_typenumImportPacketsPerLID_
 Number of packets to receive for each receive operation.
 
Kokkos::DualView< packet_type *, buffer_device_typeexports_
 Buffer from which packed data are exported (sent to other processes).
 
Kokkos::DualView< size_t *, buffer_device_typenumExportPacketsPerLID_
 Number of packets to send for each send operation.
 
virtual void packAndPrepare (const SrcDistObject &source, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &exportLIDs, Kokkos::DualView< packet_type *, buffer_device_type > &exports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, size_t &constantNumPackets)
 Pack data and metadata for communication (sends).
 
virtual void packAndPrepare (const SrcDistObject &source, const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &exportLIDs, Kokkos::DualView< packet_type *, buffer_device_type > &exports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, size_t &constantNumPackets, const execution_space &space)
 Same as packAndPrepare, but in an execution space instance.
 
virtual void unpackAndCombine (const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &importLIDs, Kokkos::DualView< packet_type *, buffer_device_type > imports, Kokkos::DualView< size_t *, buffer_device_type > numPacketsPerLID, const size_t constantNumPackets, const CombineMode combineMode)
 Perform any unpacking and combining after communication.
 

Detailed Description

template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
class Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >

A distributed dense vector.

Template Parameters
ScalarThe type of each entry of the vector. (You can use real-valued or complex-valued types here, unlike in Epetra, where the scalar type is always double.)
LocalOrdinalThe type of local indices. See the documentation of Map for requirements.
GlobalOrdinalThe type of global indices. See the documentation of Map for requirements.
NodeThe Kokkos Node type. See the documentation of Map for requirements.

This class inherits from MultiVector, and has the same template parameters. A Vector is a special case of a MultiVector that has only one vector (column). It may be used wherever a MultiVector may be used. Please see the documentation of MultiVector for more details.

Definition at line 44 of file Tpetra_Vector_decl.hpp.

Member Typedef Documentation

◆ scalar_type

This class' first template parameter; the type of each entry in the Vector.

Definition at line 54 of file Tpetra_Vector_decl.hpp.

◆ impl_scalar_type

The type used internally in place of Scalar.

Some Scalar types might not work with Kokkos on all execution spaces, due to missing CUDA device macros or volatile overloads. The C++ standard type std::complex<T> has this problem. To fix this, we replace std::complex<T> values internally with the (usually) bitwise identical type Kokkos::complex<T>. The latter is the impl_scalar_type corresponding to Scalar = std::complex.

Definition at line 64 of file Tpetra_Vector_decl.hpp.

◆ local_ordinal_type

This class' second template parameter; the type of local indices.

Definition at line 66 of file Tpetra_Vector_decl.hpp.

◆ global_ordinal_type

This class' third template parameter; the type of global indices.

Definition at line 68 of file Tpetra_Vector_decl.hpp.

◆ device_type

typedef Node::device_type Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::device_type

The Kokkos device type.

Definition at line 70 of file Tpetra_Vector_decl.hpp.

◆ node_type

The Kokkos Node type.

Definition at line 73 of file Tpetra_Vector_decl.hpp.

◆ dot_type

Type of an inner ("dot") product result.

This is usually the same as impl_scalar_type, but may differ if impl_scalar_type is e.g., an uncertainty quantification type from the Stokhos package.

Definition at line 80 of file Tpetra_Vector_decl.hpp.

◆ mag_type

Type of a norm result.

This is usually the same as the type of the magnitude (absolute value) of impl_scalar_type, but may differ if impl_scalar_type is e.g., an uncertainty quantification type from the Stokhos package.

Definition at line 88 of file Tpetra_Vector_decl.hpp.

◆ dual_view_type

Kokkos::DualView specialization used by this class.

Definition at line 91 of file Tpetra_Vector_decl.hpp.

◆ wrapped_dual_view_type

WrappedDualView specialization used by this class.

Definition at line 94 of file Tpetra_Vector_decl.hpp.

◆ map_type

The type of the Map specialization used by this class.

Definition at line 97 of file Tpetra_Vector_decl.hpp.

◆ execution_space

using Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::execution_space = typename device_type::execution_space
inherited

Type of the (new) Kokkos execution space.

The execution space implements parallel operations, like parallel_for, parallel_reduce, and parallel_scan.

Definition at line 414 of file Tpetra_MultiVector_decl.hpp.

◆ buffer_device_type

Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::buffer_device_type
protectedinherited

Kokkos::Device specialization for communication buffers.

See #1088 for why this is not just device_type::device_type.

Definition at line 2274 of file Tpetra_MultiVector_decl.hpp.

◆ packet_type

using Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::packet_type = typename ::Kokkos::ArithTraits<Scalar >::val_type
inherited

The type of each datum being sent or received in an Import or Export.

Note that this type does not always correspond to the Scalar template parameter of subclasses.

Definition at line 298 of file Tpetra_DistObject_decl.hpp.

◆ buffer_memory_space

Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::buffer_memory_space
protectedinherited

Kokkos memory space for communication buffers.

Definition at line 719 of file Tpetra_DistObject_decl.hpp.

Member Enumeration Documentation

◆ ReverseOption

Whether the data transfer should be performed in forward or reverse mode.

"Reverse mode" means calling doExport() with an Import object, or calling doImport() with an Export object. "Forward mode" means calling doExport() with an Export object, or calling doImport() with an Import object.

Definition at line 649 of file Tpetra_DistObject_decl.hpp.

Constructor & Destructor Documentation

◆ Vector() [1/11]

Default constructor: makes a Vector with no rows or columns.

Definition at line 25 of file Tpetra_Vector_def.hpp.

◆ Vector() [2/11]

Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::Vector ( const Teuchos::RCP< const map_type > &  map,
const bool  zeroOut = true 
)
explicit

Basic constructor.

Parameters
map[in] The Vector's Map. The Map describes the distribution of rows over process(es) in the Map's communicator.
zeroOut[in] If true (the default), require that all the Vector's entries be zero on return. If false, the Vector's entries have undefined values on return, and must be set explicitly.

Definition at line 30 of file Tpetra_Vector_def.hpp.

◆ Vector() [3/11]

Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::Vector ( const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  source,
const Teuchos::DataAccess  copyOrView 
)

Copy constructor (shallow or deep copy).

Parameters
source[in] The Vector to copy.
copyOrView[in] If Teuchos::View, return a shallow copy (a view) of source. If Teuchos::Copy, return a deep copy of source. Regardless, the result has "view semantics." This means that copy construction or assignment (operator=) with the resulting object will always do a shallow copy, and will transmit view semantics to the result of the shallow copy.

Definition at line 36 of file Tpetra_Vector_def.hpp.

◆ Vector() [4/11]

Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::Vector ( const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  source,
const Teuchos::RCP< const map_type > &  map,
const local_ordinal_type  rowOffset = 0 
)

"Offset view" constructor that views the input Vector's local data, but with the given Map, using the given row offset.

Parameters
source[in] The Vector to view.
map[in] The Map to use to interpret the local data.

Definition at line 42 of file Tpetra_Vector_def.hpp.

◆ Vector() [5/11]

Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::Vector ( const Teuchos::RCP< const map_type > &  map,
const Teuchos::ArrayView< const Scalar > &  A 
)

Set vector values from an existing array (copy)

Definition at line 49 of file Tpetra_Vector_def.hpp.

◆ Vector() [6/11]

Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::Vector ( const Teuchos::RCP< const map_type > &  map,
const dual_view_type view 
)

Expert mode constructor, that takes a Kokkos::DualView of the Vector's data, and returns a Vector that views those data.

Warning
This constructor is only for expert users. We make no promises about backwards compatibility for this interface. It may change or go away at any time.

See the documentation of the MultiVector (parent class) constructor that takes the same arguments.

Parameters
map[in] Map describing the distribution of rows.
view[in] View of the data (shallow copy).

Definition at line 55 of file Tpetra_Vector_def.hpp.

◆ Vector() [7/11]

Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::Vector ( const Teuchos::RCP< const map_type > &  map,
const dual_view_type view,
const dual_view_type origView 
)

Expert mode constructor, that takes a Kokkos::DualView of the Vector's data and the "original" Kokkos::DualView of the data, and returns a Vector that views those data.

Warning
This constructor is only for expert users. We make no promises about backwards compatibility for this interface. It may change or go away at any time.

See the documentation of the MultiVector (parent class) constructor that takes the same arguments.

Parameters
map[in] Map describing the distribution of rows.
view[in] View of the data (shallow copy).
origView[in] "Original" view of the data (shallow copy).

Definition at line 61 of file Tpetra_Vector_def.hpp.

◆ Vector() [8/11]

Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::Vector ( const Teuchos::RCP< const map_type > &  map,
const wrapped_dual_view_type d_view 
)

Expert mode constructor, that takes a WrappedDualView of the MultiVector's data.

Warning
This constructor is only for expert users. We make no promises about backwards compatibility for this interface. It may change or go away at any time. It is mainly useful for Tpetra developers and we do not expect it to be useful for anyone else.

Definition at line 68 of file Tpetra_Vector_def.hpp.

◆ Vector() [9/11]

Create a Vector that views a single column of the input MultiVector.

Parameters
X[in] Input MultiVector to view (in possibly nonconst fashion).
j[in] The column of X to view.

Definition at line 74 of file Tpetra_Vector_def.hpp.

◆ Vector() [10/11]

Copy constructor (shallow copy).

Vector's copy constructor always does a shallow copy. Use the nonmember function Tpetra::deep_copy (see Tpetra_MultiVector_decl.hpp) to deep-copy one existing Vector to another, and use the two-argument "copy constructor" below (with copyOrView=Teuchos::Copy) to create a Vector that is a deep copy of an existing Vector.

◆ Vector() [11/11]

Move constructor (shallow move).

◆ ~Vector()

Destructor (virtual for memory safety of derived classes).

Note
To Tpetra developers: See the C++ Core Guidelines C.21 ("If you define or <tt>=delete</tt> any default operation, define or <tt>=delete</tt> them all"), in particular the AbstractBase example, for why this destructor declaration implies that we need the above four =default declarations for copy construction, move construction, copy assignment, and move assignment.

Member Function Documentation

◆ operator=() [1/2]

Copy assignment (shallow copy).

Vector's copy assignment operator always does a shallow copy. Use the nonmember function Tpetra::deep_copy (see Tpetra_MultiVector_decl.hpp) to deep-copy one existing Vector to another.

◆ operator=() [2/2]

Move assigment (shallow move).

◆ replaceGlobalValue() [1/3]

void Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::replaceGlobalValue ( const GlobalOrdinal  globalRow,
const Scalar value 
)

Replace current value at the specified location with specified value.

Precondition
globalRow must be a valid global element on this node, according to the row map.

Definition at line 80 of file Tpetra_Vector_def.hpp.

◆ sumIntoGlobalValue() [1/3]

Add value to existing value, using global (row) index.

Add the given value to the existing value at row globalRow (a global index).

This method affects the host memory version of the data. If the DeviceType template parameter is a device that has two memory spaces, and you want to modify the non-host version of the data, you must access the device View directly by calling getLocalView(). Please see modify(), sync(), and the discussion of DualView semantics elsewhere in the documentation.

Parameters
globalRow[in] Global row index of the entry to modify. This must be a valid global row index on the calling process with respect to the Vector's Map.
value[in] Incoming value to add to the entry.
atomic[in] Whether to use an atomic update. If this class' execution space is not Kokkos::Serial, then this is true by default, else it is false by default.

Definition at line 86 of file Tpetra_Vector_def.hpp.

◆ replaceLocalValue() [1/3]

void Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::replaceLocalValue ( const LocalOrdinal  myRow,
const Scalar value 
)

Replace current value at the specified location with specified values.

Precondition
localRow must be a valid local element on this node, according to the row map.

Definition at line 94 of file Tpetra_Vector_def.hpp.

◆ sumIntoLocalValue() [1/3]

Add value to existing value, using local (row) index.

Add the given value to the existing value at row localRow (a local index).

This method affects the host memory version of the data. If the DeviceType template parameter is a device that has two memory spaces, and you want to modify the non-host version of the data, you must access the device View directly by calling getLocalView(). Please see modify(), sync(), and the discussion of DualView semantics elsewhere in the documentation.

Parameters
localRow[in] Local row index of the entry to modify.
value[in] Incoming value to add to the entry.
atomic[in] Whether to use an atomic update. If this class' execution space is not Kokkos::Serial, then this is true by default, else it is false by default.

Definition at line 100 of file Tpetra_Vector_def.hpp.

◆ get1dCopy() [1/2]

void Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::get1dCopy ( const Teuchos::ArrayView< Scalar > &  A) const

Return multi-vector values in user-provided two-dimensional array (using Teuchos memory management classes).

Definition at line 108 of file Tpetra_Vector_def.hpp.

◆ getDataNonConst() [1/2]

Teuchos::ArrayRCP< Scalar > Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getDataNonConst ( )
inline

View of the local values of this vector.

Definition at line 305 of file Tpetra_Vector_decl.hpp.

◆ getData() [1/2]

Teuchos::ArrayRCP< const Scalar > Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getData ( ) const
inline

Const view of the local values of this vector.

Definition at line 311 of file Tpetra_Vector_decl.hpp.

◆ dot() [1/6]

Return the dot product of this Vector and the input Vector x.

Definition at line 116 of file Tpetra_Vector_def.hpp.

◆ norm1() [1/5]

Return the one-norm of this Vector.

Definition at line 134 of file Tpetra_Vector_def.hpp.

◆ norm2() [1/5]

Return the two-norm of this Vector.

Definition at line 143 of file Tpetra_Vector_def.hpp.

◆ normInf() [1/5]

Return the infinity-norm of this Vector.

Definition at line 152 of file Tpetra_Vector_def.hpp.

◆ meanValue() [1/2]

Compute mean (average) value of this Vector.

Definition at line 125 of file Tpetra_Vector_def.hpp.

◆ description()

std::string Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::description ( ) const
virtual

Return a one-line description of this object.

Reimplemented from Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

Definition at line 160 of file Tpetra_Vector_def.hpp.

◆ describe()

void Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::describe ( Teuchos::FancyOStream &  out,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::Describable::verbLevel_default 
) const
virtual

Describe this object in a human-readable way to the given output stream.

You must call this method as a collective over all processes in this object's communicator.

Parameters
out[out] Output stream to which to write. Only Process 0 in this object's communicator may write to the output stream.
verbLevel[in] Verbosity level. This also controls whether this method does any communication. At verbosity levels higher (greater) than Teuchos::VERB_LOW, this method may behave as a collective over the object's communicator.

Teuchos::FancyOStream wraps std::ostream. It adds features like tab levels. If you just want to wrap std::cout, try this:

auto out = Teuchos::getFancyOStream (Teuchos::rcpFromRef (std::out));
Struct that holds views of the contents of a CrsMatrix.

Reimplemented from Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

Definition at line 166 of file Tpetra_Vector_def.hpp.

◆ swap()

void Tpetra::MultiVector< ST, LO, GO, NT >::swap ( MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  mv)
inherited

Swap contents of mv with contents of *this.

Definition at line 4566 of file Tpetra_MultiVector_def.hpp.

◆ replaceGlobalValue() [2/3]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::replaceGlobalValue ( const GlobalOrdinal  gblRow,
const size_t  col,
const impl_scalar_type value 
)
inherited

Replace value in host memory, using global row index.

Replace the current value at row gblRow (a global index) and column col with the given value. The column index is zero based.

This method affects the host memory version of the data. If device_type is a Kokkos device that has two memory spaces, and you want to modify the non-host version of the data, you must access the device View directly by calling getLocalView(). Please see modify(), sync(), and the discussion of DualView semantics elsewhere in the documentation. This method calls sync_host() before modifying host data, and modify_host() afterwards.

This method does not have an "atomic" option like sumIntoGlobalValue. This is deliberate. Replacement is not commutative, unlike += (modulo rounding error). Concurrent calls to replaceGlobalValue on different threads that modify the same entry/ies have undefined results. (It's not just that one thread might win; it's that the value might get messed up.)

Parameters
gblRow[in] Global row index of the entry to modify. This must be a valid global row index on the calling process with respect to the MultiVector's Map.
col[in] Column index of the entry to modify.
value[in] Incoming value to add to the entry.

Definition at line 4191 of file Tpetra_MultiVector_def.hpp.

◆ replaceGlobalValue() [3/3]

template<typename T >
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::replaceGlobalValue ( GlobalOrdinal  globalRow,
size_t  col,
const T value 
)
inlineinherited

Like the above replaceGlobalValue, but only enabled if T differs from impl_scalar_type.

This method only exists if its template parameter T and impl_scalar_type differ, and if it is syntactically possible to convert T to impl_scalar_type. This method is mainly useful for backwards compatibility, when the Scalar template parameter differs from impl_scalar_type. That is commonly only the case when Scalar is std::complex<U> for some type U.

This method affects the host memory version of the data. If device_type is a Kokkos device that has two memory spaces, and you want to modify the non-host version of the data, you must access the device View directly by calling getLocalView(). Please see modify(), sync(), and the discussion of DualView semantics elsewhere in the documentation. This method calls sync_host() before modifying host data, and modify_host() afterwards.

This method does not have an "atomic" option like sumIntoGlobalValue. This is deliberate. Replacement is not commutative, unlike += (modulo rounding error). Concurrent calls to replaceGlobalValue on different threads that modify the same entry/ies have undefined results. (It's not just that one thread might win; it's that the value might get messed up.)

Parameters
gblRow[in] Global row index of the entry to modify. This must be a valid global row index on the calling process with respect to the MultiVector's Map.
col[in] Column index of the entry to modify.
value[in] Incoming value to add to the entry.

Definition at line 887 of file Tpetra_MultiVector_decl.hpp.

◆ sumIntoGlobalValue() [2/3]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::sumIntoGlobalValue ( const GlobalOrdinal  gblRow,
const size_t  col,
const impl_scalar_type value,
const bool  atomic = useAtomicUpdatesByDefault 
)
inherited

Update (+=) a value in host memory, using global row index.

Add the given value to the existing value at row gblRow (a global index) and column col. The column index is zero based.

This method affects the host memory version of the data. If device_type is a Kokkos device that has two memory spaces, and you want to modify the non-host version of the data, you must access the device View directly by calling getLocalView(). Please see modify(), sync(), and the discussion of DualView semantics elsewhere in the documentation. This method calls sync_host() before modifying host data, and modify_host() afterwards.

Parameters
gblRow[in] Global row index of the entry to modify. This must be a valid global row index on the calling process with respect to the MultiVector's Map.
col[in] Column index of the entry to modify.
value[in] Incoming value to add to the entry.
atomic[in] Whether to use an atomic update. If this class' execution space is not Kokkos::Serial, then this is true by default, else it is false by default.

Definition at line 4213 of file Tpetra_MultiVector_def.hpp.

◆ sumIntoGlobalValue() [3/3]

template<typename T >
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::sumIntoGlobalValue ( const GlobalOrdinal  gblRow,
const size_t  col,
const T val,
const bool  atomic = useAtomicUpdatesByDefault 
)
inlineinherited

Like the above sumIntoGlobalValue, but only enabled if T differs from impl_scalar_type.

This method only exists if its template parameter T and impl_scalar_type differ, and if it is syntactically possible to convert T to impl_scalar_type. This method is mainly useful for backwards compatibility, when the Scalar template parameter differs from impl_scalar_type. That is commonly only the case when Scalar is std::complex<U> for some type U.

This method affects the host memory version of the data. If device_type is a Kokkos device that has two memory spaces, and you want to modify the non-host version of the data, you must access the device View directly by calling getLocalView(). Please see modify(), sync(), and the discussion of DualView semantics elsewhere in the documentation. This method calls sync_host() before modifying host data, and modify_host() afterwards.

Parameters
gblRow[in] Global row index of the entry to modify. This must be a valid global row index on the calling process with respect to the MultiVector's Map.
col[in] Column index of the entry to modify.
val[in] Incoming value to add to the entry.
atomic[in] Whether to use an atomic update. If this class' execution space is not Kokkos::Serial, then this is true by default, else it is false by default.

Definition at line 953 of file Tpetra_MultiVector_decl.hpp.

◆ replaceLocalValue() [2/3]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::replaceLocalValue ( const LocalOrdinal  lclRow,
const size_t  col,
const impl_scalar_type value 
)
inherited

Replace value in host memory, using local (row) index.

Replace the current value at row lclRow (a local index) and column col with the given value. The column index is zero based.

This method affects the host memory version of the data. If device_type is a Kokkos device that has two memory spaces, and you want to modify the non-host version of the data, you must access the device View directly by calling getLocalView(). Please see modify(), sync(), and the discussion of DualView semantics elsewhere in the documentation. This method calls sync_host() before modifying host data, and modify_host() afterwards.

This method does not have an "atomic" option like sumIntoLocalValue. This is deliberate. Replacement is not commutative, unlike += (modulo rounding error). Concurrent calls to replaceLocalValue on different threads that modify the same entry/ies have undefined results. (It's not just that one thread might win; it's that the value might get messed up.)

Parameters
lclRow[in] Local row index of the entry to modify. Must be a valid local index in this MultiVector's Map on the calling process.
col[in] Column index of the entry to modify.
value[in] Incoming value to add to the entry.

Definition at line 4131 of file Tpetra_MultiVector_def.hpp.

◆ replaceLocalValue() [3/3]

template<typename T >
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::replaceLocalValue ( const LocalOrdinal  lclRow,
const size_t  col,
const T val 
)
inlineinherited

Like the above replaceLocalValue, but only enabled if T differs from impl_scalar_type.

This method only exists if its template parameter T and impl_scalar_type differ, and if it is syntactically possible to convert T to impl_scalar_type. This method is mainly useful for backwards compatibility, when the Scalar template parameter differs from impl_scalar_type. That is commonly only the case when Scalar is std::complex<U> for some type U.

This method affects the host memory version of the data. If device_type is a Kokkos device that has two memory spaces, and you want to modify the non-host version of the data, you must access the device View directly by calling getLocalView(). Please see modify(), sync(), and the discussion of DualView semantics elsewhere in the documentation. This method calls sync_host() before modifying host data, and modify_host() afterwards.

This method does not have an "atomic" option like sumIntoLocalValue. This is deliberate. Replacement is not commutative, unlike += (modulo rounding error). Concurrent calls to replaceLocalValue on different threads that modify the same entry/ies have undefined results. (It's not just that one thread might win; it's that the value might get messed up.)

Parameters
lclRow[in] Local row index of the entry to modify. Must be a valid local index in this MultiVector's Map on the calling process.
col[in] Column index of the entry to modify.
val[in] Incoming value to add to the entry.

Definition at line 1029 of file Tpetra_MultiVector_decl.hpp.

◆ sumIntoLocalValue() [2/3]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::sumIntoLocalValue ( const LocalOrdinal  lclRow,
const size_t  col,
const impl_scalar_type val,
const bool  atomic = useAtomicUpdatesByDefault 
)
inherited

Update (+=) a value in host memory, using local row index.

Add the given value to the existing value at row localRow (a local index) and column col. The column index is zero based.

This method affects the host memory version of the data. If device_type is a Kokkos device that has two memory spaces, and you want to modify the non-host version of the data, you must access the device View directly by calling getLocalView(). Please see modify(), sync(), and the discussion of DualView semantics elsewhere in the documentation. This method calls sync_host() before modifying host data, and modify_host() afterwards.

Parameters
lclRow[in] Local row index of the entry to modify. Must be a valid local index in this MultiVector's Map on the calling process.
col[in] Column index of the entry to modify.
val[in] Incoming value to add to the entry.
atomic[in] Whether to use an atomic update. If this class' execution space is not Kokkos::Serial, then this is true by default, else it is false by default.

Definition at line 4158 of file Tpetra_MultiVector_def.hpp.

◆ sumIntoLocalValue() [3/3]

template<typename T >
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::sumIntoLocalValue ( const LocalOrdinal  lclRow,
const size_t  col,
const T val,
const bool  atomic = useAtomicUpdatesByDefault 
)
inlineinherited

Like the above sumIntoLocalValue, but only enabled if T differs from impl_scalar_type.

This method only exists if its template parameter T and impl_scalar_type differ, and if it is syntactically possible to convert T to impl_scalar_type. This method is mainly useful for backwards compatibility, when the Scalar template parameter differs from impl_scalar_type. That is commonly only the case when Scalar is std::complex<U> for some type U.

This method affects the host memory version of the data. If device_type is a Kokkos device that has two memory spaces, and you want to modify the non-host version of the data, you must access the device View directly by calling getLocalView(). Please see modify(), sync(), and the discussion of DualView semantics elsewhere in the documentation. This method calls sync_host() before modifying host data, and modify_host() afterwards.

Parameters
lclRow[in] Local row index of the entry to modify.
col[in] Column index of the entry to modify.
val[in] Incoming value to add to the entry.
atomic[in] Whether to use an atomic update. If this class' execution space is not Kokkos::Serial, then this is true by default, else it is false by default.

Definition at line 1093 of file Tpetra_MultiVector_decl.hpp.

◆ putScalar() [1/2]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::putScalar ( const Scalar value)
inherited

Set all values in the multivector with the given value.

Definition at line 2560 of file Tpetra_MultiVector_def.hpp.

◆ putScalar() [2/2]

template<typename T >
std::enable_if<!std::is_same< T, impl_scalar_type >::value &&std::is_convertible< T, impl_scalar_type >::value, void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::putScalar ( const T value)
inlineinherited

Set all values in the multivector with the given value.

This method only exists if its template parameter T and impl_scalar_type differ, and if it is syntactically possible to convert T to impl_scalar_type. This method is mainly useful for backwards compatibility, when the Scalar template parameter differs from impl_scalar_type. That is commonly only the case when Scalar is std::complex<U> for some type U.

Definition at line 1113 of file Tpetra_MultiVector_decl.hpp.

◆ randomize() [1/2]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::randomize ( )
inherited

Set all values in the multivector to pseudorandom numbers.

Note
Do not expect repeatable results.
Behavior of this method may or may not depend on external use of the C library routines srand() and rand(). In particular, setting the seed there may not affect it here.
Warning
This method does not promise to use a distributed-memory parallel pseudorandom number generator. Corresponding values on different processes might be correlated. It also does not promise to use a high-quality pseudorandom number generator within each process.

Definition at line 2513 of file Tpetra_MultiVector_def.hpp.

◆ randomize() [2/2]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::randomize ( const Scalar minVal,
const Scalar maxVal 
)
inherited

Set all values in the multivector to pseudorandom numbers in the given range.

Note
Do not expect repeatable results.
Behavior of this method may or may not depend on external use of the C library routines srand() and rand(). In particular, setting the seed there may not affect it here.
Warning
This method does not promise to use a distributed-memory parallel pseudorandom number generator. Corresponding values on different processes might be correlated. It also does not promise to use a high-quality pseudorandom number generator within each process.

Definition at line 2531 of file Tpetra_MultiVector_def.hpp.

◆ replaceMap()

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::replaceMap ( const Teuchos::RCP< const map_type > &  map)
inherited

Replace the underlying Map in place.

Warning
The normal use case of this method, with an input Map that is compatible with the object's current Map and has the same communicator, is safe. However, if the input Map has a different communicator (with a different number of processes, in particular) than this object's current Map, the semantics of this method are tricky. We recommend that only experts try the latter use case.
Precondition
If the new Map's communicator is similar to the original Map's communicator, then the original Map and new Map must be compatible: map->isCompatible (this->getMap ()). "Similar" means that the communicators have the same number of processes, though these need not be in the same order (have the same assignments of ranks) or represent the same communication contexts. It means the same thing as the MPI_SIMILAR return value of MPI_COMM_COMPARE. See MPI 3.0 Standard, Section 6.4.1.
If the new Map's communicator contains more processes than the original Map's communicator, then the projection of the original Map onto the new communicator must be compatible with the new Map.
If the new Map's communicator contains fewer processes than the original Map's communicator, then the projection of the new Map onto the original communicator must be compatible with the original Map.

This method replaces this object's Map with the given Map. This relabels the rows of the multivector using the global IDs in the input Map. Thus, it implicitly applies a permutation, without actually moving data. If the new Map's communicator has more processes than the original Map's communicator, it "projects" the MultiVector onto the new Map by filling in missing rows with zeros. If the new Map's communicator has fewer processes than the original Map's communicator, the method "forgets about" any rows that do not exist in the new Map. (It mathematical terms, if one considers a MultiVector as a function from one vector space to another, this operation restricts the range.)

This method must always be called collectively on the communicator with the largest number of processes: either this object's current communicator (this->getMap()->getComm()), or the new Map's communicator (map->getComm()). If the new Map's communicator has fewer processes, then the new Map must be null on processes excluded from the original communicator, and the current Map must be nonnull on all processes. If the new Map has more processes, then it must be nonnull on all those processes, and the original Map must be null on those processes which are not in the new Map's communicator. (The latter case can only happen to a MultiVector to which a replaceMap() operation has happened before.)

Warning
This method must always be called as a collective operation on all processes in the original communicator (this->getMap ()->getComm ()). We reserve the right to do checking in debug mode that requires this method to be called collectively in order not to deadlock.
Note
This method does not do data redistribution. If you need to move data around, use Import or Export.

Definition at line 2600 of file Tpetra_MultiVector_def.hpp.

◆ reduce()

Sum values of a locally replicated multivector across all processes.

Warning
This method may only be called for locally replicated MultiVectors.
Precondition
isDistributed() == false

Definition at line 4099 of file Tpetra_MultiVector_def.hpp.

◆ subCopy() [1/2]

Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::subCopy ( const Teuchos::Range1D &  colRng) const
inherited

Return a MultiVector with copies of selected columns.

Definition at line 3146 of file Tpetra_MultiVector_def.hpp.

◆ subCopy() [2/2]

Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::subCopy ( const Teuchos::ArrayView< const size_t > &  cols) const
inherited

Return a MultiVector with copies of selected columns.

Definition at line 3119 of file Tpetra_MultiVector_def.hpp.

◆ subView() [1/2]

Teuchos::RCP< const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::subView ( const Teuchos::Range1D &  colRng) const
inherited

Return a const MultiVector with const views of selected columns.

Definition at line 3375 of file Tpetra_MultiVector_def.hpp.

◆ subView() [2/2]

Teuchos::RCP< const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::subView ( const Teuchos::ArrayView< const size_t > &  cols) const
inherited

Return a const MultiVector with const views of selected columns.

Definition at line 3328 of file Tpetra_MultiVector_def.hpp.

◆ subViewNonConst() [1/2]

Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::subViewNonConst ( const Teuchos::Range1D &  colRng)
inherited

Return a MultiVector with views of selected columns.

Definition at line 3488 of file Tpetra_MultiVector_def.hpp.

◆ subViewNonConst() [2/2]

Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::subViewNonConst ( const Teuchos::ArrayView< const size_t > &  cols)
inherited

Return a MultiVector with views of selected columns.

Definition at line 3480 of file Tpetra_MultiVector_def.hpp.

◆ getVector()

Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getVector ( const size_t  j) const
inherited

Return a Vector which is a const view of column j.

Definition at line 3543 of file Tpetra_MultiVector_def.hpp.

◆ getVectorNonConst()

Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getVectorNonConst ( const size_t  j)
inherited

Return a Vector which is a nonconst view of column j.

Definition at line 3551 of file Tpetra_MultiVector_def.hpp.

◆ getData() [2/2]

Teuchos::ArrayRCP< const Scalar > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getData ( size_t  j) const
inherited

Const view of the local values in a particular vector of this multivector.

Definition at line 3065 of file Tpetra_MultiVector_def.hpp.

◆ getDataNonConst() [2/2]

Teuchos::ArrayRCP< Scalar > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getDataNonConst ( size_t  j)
inherited

View of the local values in a particular vector of this multivector.

Definition at line 3094 of file Tpetra_MultiVector_def.hpp.

◆ get1dCopy() [2/2]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::get1dCopy ( const Teuchos::ArrayView< Scalar > &  A,
const size_t  LDA 
) const
inherited

Fill the given array with a copy of this multivector's local values.

Parameters
A[out] View of the array to fill. We consider A as a matrix with column-major storage.
LDA[in] Leading dimension of the matrix A.

problematic example

  • a host view is checked out by users ; this increase ref count on host view
  • when the view is const view, it does not raise modify_host() flag
  • when we use useHostVersion logic (this->need_sync_device()) to figure out more recent version, the flag is false as the user checked out a const view
  • as a result, it attempts to use device view and it volate ref count rule
  • the other case of using device view is also problematic solution
  • any non const view is alive outside, we cannot give a copy
  • if a user takes a const view, we use the same host/device view not to violate ref count rule.

there is non-const host or device view outside, we cannot give a copy as a user can change the local data and we do not know which one the user want as a copy

Definition at line 3558 of file Tpetra_MultiVector_def.hpp.

◆ get2dCopy()

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::get2dCopy ( const Teuchos::ArrayView< const Teuchos::ArrayView< Scalar > > &  ArrayOfPtrs) const
inherited

Fill the given array with a copy of this multivector's local values.

Parameters
ArrayOfPtrs[out] Array of arrays, one for each column of the multivector. On output, we fill ArrayOfPtrs[j] with the data for column j of this multivector.

Definition at line 3633 of file Tpetra_MultiVector_def.hpp.

◆ get1dView()

Teuchos::ArrayRCP< const Scalar > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::get1dView ( ) const
inherited

Const persisting (1-D) view of this multivector's local values.

This method assumes that the columns of the multivector are stored contiguously. If not, this method throws std::runtime_error.

Definition at line 3669 of file Tpetra_MultiVector_def.hpp.

◆ get2dView()

Teuchos::ArrayRCP< Teuchos::ArrayRCP< const Scalar > > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::get2dView ( ) const
inherited

Return const persisting pointers to values.

Definition at line 3787 of file Tpetra_MultiVector_def.hpp.

◆ get1dViewNonConst()

Teuchos::ArrayRCP< Scalar > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::get1dViewNonConst ( )
inherited

Nonconst persisting (1-D) view of this multivector's local values.

This method assumes that the columns of the multivector are stored contiguously. If not, this method throws std::runtime_error.

Definition at line 3693 of file Tpetra_MultiVector_def.hpp.

◆ get2dViewNonConst()

Teuchos::ArrayRCP< Teuchos::ArrayRCP< Scalar > > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::get2dViewNonConst ( )
inherited

Return non-const persisting pointers to values.

Definition at line 3713 of file Tpetra_MultiVector_def.hpp.

◆ getLocalViewHost() [1/3]

MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type::t_host::const_type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getLocalViewHost ( Access::ReadOnlyStruct  s) const
inherited

Return a read-only, up-to-date view of this MultiVector's local data on host. This requires that there are no live device-space views.

Definition at line 3738 of file Tpetra_MultiVector_def.hpp.

◆ getLocalViewHost() [2/3]

MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type::t_host Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getLocalViewHost ( Access::ReadWriteStruct  s)
inherited

Return a mutable, up-to-date view of this MultiVector's local data on host. This requires that there are no live device-space views.

Definition at line 3745 of file Tpetra_MultiVector_def.hpp.

◆ getLocalViewHost() [3/3]

MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type::t_host Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getLocalViewHost ( Access::OverwriteAllStruct  s)
inherited

Return a mutable view of this MultiVector's local data on host, assuming all existing data will be overwritten. This requires that there are no live device-space views.

Definition at line 3752 of file Tpetra_MultiVector_def.hpp.

◆ getLocalViewDevice() [1/3]

MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type::t_dev::const_type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getLocalViewDevice ( Access::ReadOnlyStruct  s) const
inherited

Return a read-only, up-to-date view of this MultiVector's local data on device. This requires that there are no live host-space views.

Definition at line 3759 of file Tpetra_MultiVector_def.hpp.

◆ getLocalViewDevice() [2/3]

MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type::t_dev Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getLocalViewDevice ( Access::ReadWriteStruct  s)
inherited

Return a mutable, up-to-date view of this MultiVector's local data on device. This requires that there are no live host-space views.

Definition at line 3766 of file Tpetra_MultiVector_def.hpp.

◆ getLocalViewDevice() [3/3]

MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type::t_dev Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getLocalViewDevice ( Access::OverwriteAllStruct  s)
inherited

Return a mutable view of this MultiVector's local data on device, assuming all existing data will be overwritten. This requires that there are no live host-space views.

Definition at line 3773 of file Tpetra_MultiVector_def.hpp.

◆ getWrappedDualView()

Return the wrapped dual view holding this MultiVector's local data.

Warning
This method is ONLY for use by experts. We highly recommend accessing the local data by using the member functions getLocalViewHost and getLocalViewDevice.

Definition at line 3780 of file Tpetra_MultiVector_def.hpp.

◆ need_sync()

template<class TargetDeviceType >
bool Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::need_sync ( ) const
inlineinherited

Whether this MultiVector needs synchronization to the given space.

Definition at line 1447 of file Tpetra_MultiVector_decl.hpp.

◆ need_sync_host()

bool Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::need_sync_host ( ) const
inherited

Whether this MultiVector needs synchronization to the host.

Definition at line 4256 of file Tpetra_MultiVector_def.hpp.

◆ need_sync_device()

bool Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::need_sync_device ( ) const
inherited

Whether this MultiVector needs synchronization to the device.

Definition at line 4262 of file Tpetra_MultiVector_def.hpp.

◆ getLocalView()

template<class TargetDeviceType >
std::remove_reference< decltype(std::declval< dual_view_type >().templateview< TargetDeviceType >())>::type::const_type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getLocalView ( Access::ReadOnlyStruct  s) const
inlineinherited

Return a view of the local data on a specific device, with the given access mode. The return type is either dual_view_type::t_dev, dual_view_type::t_host, or the const_type of one of those.

Template Parameters
TargetDeviceTypeThe Kokkos Device type whose data to return.

For example, suppose you create a Tpetra::MultiVector for the Kokkos::Cuda device, like this:

typedef Tpetra::KokkosCompat::KokkosDeviceWrapperNode<Kokkos::Cuda> > node_type;
mv_type DV (map, 3);
Node node_type
The Kokkos Node type.
base_type::map_type map_type
The type of the Map specialization used by this class.

If you want to get the CUDA device Kokkos::View as read-write, do this:

typedef typename mv_type::dual_view_type dual_view_type;
typedef typename dual_view_type::t_dev device_view_type;
device_view_type cudaView = DV.getLocalView<Kokkos::Cuda> (Access::ReadWrite);
base_type::dual_view_type dual_view_type
Kokkos::DualView specialization used by this class.

and if you want to get the host mirror of that View, do this:

typedef typename dual_view_type::host_mirror_space host_execution_space;
typedef typename dual_view_type::t_host host_view_type;
host_view_type hostView = DV.getLocalView<host_execution_space> (Access::ReadWrite);

Definition at line 1487 of file Tpetra_MultiVector_decl.hpp.

◆ dot() [2/6]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dot ( const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  A,
const Teuchos::ArrayView< dot_type > &  dots 
) const
inherited

Compute the dot product of each corresponding pair of vectors (columns) in A and B.

The "dot product" is the standard Euclidean inner product. If the type of entries of the vectors (impl_scalar_type) is complex, then A is transposed, not *this. For example, if x and y each have one column, then x.dot (y, dots) computes $y^* x = \bar{y}^T x = \sum_i \bar{y}_i \cdot x_i$.

Precondition
*this and A have the same number of columns (vectors).
dots has at least as many entries as the number of columns in A.
Postcondition
dots[j] == (this->getVector[j])->dot (* (A.getVector[j]))

Definition at line 2294 of file Tpetra_MultiVector_def.hpp.

◆ dot() [3/6]

template<typename T >
std::enable_if<!(std::is_same< dot_type, T >::value), void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dot ( const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  A,
const Teuchos::ArrayView< T > &  dots 
) const
inlineinherited

Compute the dot product of each corresponding pair of vectors (columns) in A and B.

Template Parameters
TThe output type of the dot products.

This method only exists if dot_type and T are different types. For example, if impl_scalar_type and dot_type differ, then this method ensures backwards compatibility with the previous interface (that returned dot products as impl_scalar_type rather than as dot_type). The complicated enable_if expression just ensures that the method only exists if dot_type and T are different types; the method still returns void, as above.

Definition at line 1537 of file Tpetra_MultiVector_decl.hpp.

◆ dot() [4/6]

template<typename T >
std::enable_if<!(std::is_same< dot_type, T >::value), void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dot ( const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  A,
std::vector< T > &  dots 
) const
inlineinherited

Like the above dot() overload, but for std::vector output.

Definition at line 1551 of file Tpetra_MultiVector_decl.hpp.

◆ dot() [5/6]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dot ( const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  A,
const Kokkos::View< dot_type *, Kokkos::HostSpace > &  norms 
) const
inherited

Compute the dot product of each corresponding pair of vectors (columns) in A and B, storing the result in a device View.

The "dot product" is the standard Euclidean inner product. If the type of entries of the vectors (impl_scalar_type) is complex, then A is transposed, not *this. For example, if x and y each have one column, then x.dot (y, dots) computes $y^* x = \bar{y}^T x = \sum_i \bar{y}_i \cdot x_i$.

Parameters
A[in] MultiVector with which to dot *this.
dots[out] Device View with getNumVectors() entries.
Precondition
this->getNumVectors () == A.getNumVectors ()
dots.extent (0) == A.getNumVectors ()
Postcondition
dots(j) == (this->getVector[j])->dot (* (A.getVector[j]))

Definition at line 2150 of file Tpetra_MultiVector_def.hpp.

◆ dot() [6/6]

template<typename T >
std::enable_if<!(std::is_same< dot_type, T >::value), void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dot ( const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  A,
const Kokkos::View< T *, device_type > &  dots 
) const
inlineinherited

Compute the dot product of each corresponding pair of vectors (columns) in A and B, storing the result in a device view.

Template Parameters
TThe output type of the dot products.

This method only exists if dot_type and T are different types. For example, if Scalar and dot_type differ, then this method ensures backwards compatibility with the previous interface (that returned dot products as Scalar rather than as dot_type). The complicated enable_if expression just ensures that the method only exists if dot_type and T are different types; the method still returns void, as above.

Definition at line 1609 of file Tpetra_MultiVector_decl.hpp.

◆ abs()

Put element-wise absolute values of input Multi-vector in target: A = abs(this)

Definition at line 2903 of file Tpetra_MultiVector_def.hpp.

◆ reciprocal()

Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,j).

Definition at line 2865 of file Tpetra_MultiVector_def.hpp.

◆ scale() [1/4]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::scale ( const Scalar alpha)
inherited

Scale in place: this = alpha*this.

Replace this MultiVector with alpha times this MultiVector. This method will always multiply, even if alpha is zero. That means, for example, that if *this contains NaN entries before calling this method, the NaN entries will remain after this method finishes.

Definition at line 2678 of file Tpetra_MultiVector_def.hpp.

◆ scale() [2/4]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::scale ( const Teuchos::ArrayView< const Scalar > &  alpha)
inherited

Scale each column in place: this[j] = alpha[j]*this[j].

Replace each column j of this MultiVector with alpha[j] times the current column j of this MultiVector. This method will always multiply, even if all the entries of alpha are zero. That means, for example, that if *this contains NaN entries before calling this method, the NaN entries will remain after this method finishes.

Definition at line 2729 of file Tpetra_MultiVector_def.hpp.

◆ scale() [3/4]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::scale ( const Kokkos::View< const impl_scalar_type *, device_type > &  alpha)
inherited

Scale each column in place: this[j] = alpha[j]*this[j].

Replace each column j of this MultiVector with alpha[j] times the current column j of this MultiVector. This method will always multiply, even if all the entries of alpha are zero. That means, for example, that if *this contains NaN entries before calling this method, the NaN entries will remain after this method finishes.

Definition at line 2753 of file Tpetra_MultiVector_def.hpp.

◆ scale() [4/4]

Scale in place: this = alpha * A.

Replace this MultiVector with scaled values of A. This method will always multiply, even if alpha is zero. That means, for example, that if *this contains NaN entries before calling this method, the NaN entries will remain after this method finishes. It is legal for the input A to alias this MultiVector.

Definition at line 2821 of file Tpetra_MultiVector_def.hpp.

◆ update() [1/2]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::update ( const Scalar alpha,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  A,
const Scalar beta 
)
inherited

Update: this = beta*this + alpha*A.

Update this MultiVector with scaled values of A. If beta is zero, overwrite *this unconditionally, even if it contains NaN entries. It is legal for the input A to alias this MultiVector.

Definition at line 2941 of file Tpetra_MultiVector_def.hpp.

◆ update() [2/2]

Update: this = gamma*this + alpha*A + beta*B.

Update this MultiVector with scaled values of A and B. If gamma is zero, overwrite *this unconditionally, even if it contains NaN entries. It is legal for the inputs A or B to alias this MultiVector.

Definition at line 2992 of file Tpetra_MultiVector_def.hpp.

◆ norm1() [2/5]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm1 ( const Kokkos::View< mag_type *, Kokkos::HostSpace > &  norms) const
inherited

Compute the one-norm of each vector (column), storing the result in a host view.

Parameters
norms[out] Host View with getNumVectors() entries.
Precondition
norms.extent (0) == this->getNumVectors ()
Postcondition
norms(j) == (this->getVector[j])->norm1 (* (A.getVector[j]))

The one-norm of a vector is the sum of the magnitudes of the vector's entries. On exit, norms(j) is the one-norm of column j of this MultiVector.

Definition at line 2371 of file Tpetra_MultiVector_def.hpp.

◆ norm1() [3/5]

template<typename T >
std::enable_if<!(std::is_same< mag_type, T >::value), void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm1 ( const Kokkos::View< T *, device_type > &  norms) const
inlineinherited

Compute the one-norm of each vector (column), storing the result in a device view.

Template Parameters
TThe output type of the dot products.

See the above norm1() method for documentation.

This method only exists if mag_type and T are different types. For example, if Teuchos::ScalarTraits<Scalar>::magnitudeType and mag_type differ, then this method ensures backwards compatibility with the previous interface (that returned norms products as Teuchos::ScalarTraits<Scalar>::magnitudeType rather than as mag_type). The complicated enable_if expression just ensures that the method only exists if mag_type and T are different types; the method still returns void, as above.

Definition at line 1742 of file Tpetra_MultiVector_decl.hpp.

◆ norm1() [4/5]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm1 ( const Teuchos::ArrayView< mag_type > &  norms) const
inherited

Compute the one-norm of each vector (column).

See the uppermost norm1() method above for documentation.

Definition at line 2358 of file Tpetra_MultiVector_def.hpp.

◆ norm1() [5/5]

template<typename T >
std::enable_if<!(std::is_same< mag_type, T >::value), void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm1 ( const Teuchos::ArrayView< T > &  norms) const
inlineinherited

Compute the one-norm of each vector (column).

Template Parameters
TThe output type of the norms.

See the uppermost norm1() method above for documentation.

This method only exists if mag_type and T are different types. For example, if Teuchos::ScalarTraits<Scalar>::magnitudeType and mag_type differ, then this method ensures backwards compatibility with the previous interface (that returned norms as Teuchos::ScalarTraits<Scalar>::magnitudeType rather than as mag_type). The complicated enable_if expression just ensures that the method only exists if mag_type and T are different types; the method still returns void, as above.

Definition at line 1777 of file Tpetra_MultiVector_decl.hpp.

◆ norm2() [2/5]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm2 ( const Kokkos::View< mag_type *, Kokkos::HostSpace > &  norms) const
inherited

Compute the two-norm of each vector (column), storing the result in a host View.

Parameters
norms[out] Host View with getNumVectors() entries.
Precondition
norms.extent (0) == this->getNumVectors ()
Postcondition
norms(j) == (this->getVector[j])->dot (* (A.getVector[j]))

The two-norm of a vector is the standard Euclidean norm, the square root of the sum of squares of the magnitudes of the vector's entries. On exit, norms(k) is the two-norm of column k of this MultiVector.

Definition at line 2351 of file Tpetra_MultiVector_def.hpp.

◆ norm2() [3/5]

template<typename T >
std::enable_if<!(std::is_same< mag_type, T >::value), void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm2 ( const Kokkos::View< T *, device_type > &  norms) const
inlineinherited

Compute the two-norm of each vector (column), storing the result in a device view.

See the above norm2() method for documentation.

This method only exists if mag_type and T are different types. For example, if Teuchos::ScalarTraits<Scalar>::magnitudeType and mag_type differ, then this method ensures backwards compatibility with the previous interface (that returned norms as Teuchos::ScalarTraits<Scalar>::magnitudeType rather than as mag_type). The complicated enable_if expression just ensures that the method only exists if mag_type and T are different types; the method still returns void, as above.

Definition at line 1832 of file Tpetra_MultiVector_decl.hpp.

◆ norm2() [4/5]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm2 ( const Teuchos::ArrayView< mag_type > &  norms) const
inherited

Compute the two-norm of each vector (column).

See the uppermost norm2() method above for documentation.

Definition at line 2338 of file Tpetra_MultiVector_def.hpp.

◆ norm2() [5/5]

template<typename T >
std::enable_if<!(std::is_same< mag_type, T >::value), void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm2 ( const Teuchos::ArrayView< T > &  norms) const
inlineinherited

Compute the two-norm of each vector (column).

Template Parameters
TThe output type of the norms.

See the uppermost norm2() method above for documentation.

This method only exists if mag_type and T are different types. For example, if Teuchos::ScalarTraits<Scalar>::magnitudeType and mag_type differ, then this method ensures backwards compatibility with the previous interface (that returned norms products as Teuchos::ScalarTraits<Scalar>::magnitudeType rather than as mag_type). The complicated enable_if expression just ensures that the method only exists if mag_type and T are different types; the method still returns void, as above.

Definition at line 1867 of file Tpetra_MultiVector_decl.hpp.

◆ normInf() [2/5]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::normInf ( const Kokkos::View< mag_type *, Kokkos::HostSpace > &  norms) const
inherited

Compute the infinity-norm of each vector (column), storing the result in a host View.

The infinity-norm of a vector is the maximum of the magnitudes of the vector's entries. On exit, norms(j) is the infinity-norm of column j of this MultiVector.

Definition at line 2391 of file Tpetra_MultiVector_def.hpp.

◆ normInf() [3/5]

template<typename T >
std::enable_if<!(std::is_same< mag_type, T >::value), void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::normInf ( const Kokkos::View< T *, device_type > &  norms) const
inlineinherited

Compute the infinity-norm of each vector (column), storing the result in a device view.

See the above normInf() method for documentation.

This method only exists if mag_type and T are different types. For example, if Teuchos::ScalarTraits<Scalar>::magnitudeType and mag_type differ, then this method ensures backwards compatibility with the previous interface (that returned norms as Teuchos::ScalarTraits<Scalar>::magnitudeType rather than as mag_type). The complicated enable_if expression just ensures that the method only exists if mag_type and T are different types; the method still returns void, as above.

Definition at line 1915 of file Tpetra_MultiVector_decl.hpp.

◆ normInf() [4/5]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::normInf ( const Teuchos::ArrayView< mag_type > &  norms) const
inherited

Compute the infinity-norm of each vector (column), storing the result in a Teuchos::ArrayView.

See the uppermost normInf() method above for documentation.

Definition at line 2378 of file Tpetra_MultiVector_def.hpp.

◆ normInf() [5/5]

template<typename T >
std::enable_if<!(std::is_same< mag_type, T >::value), void >::type Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::normInf ( const Teuchos::ArrayView< T > &  norms) const
inlineinherited

Compute the infinity-norm of each vector (column), storing the result in a Teuchos::ArrayView.

Template Parameters
TThe output type of the norms.

See the uppermost normInf() method above for documentation.

This method only exists if mag_type and T are different types. For example, if Teuchos::ScalarTraits<Scalar>::magnitudeType and mag_type differ, then this method ensures backwards compatibility with the previous interface (that returned norms products as Teuchos::ScalarTraits<Scalar>::magnitudeType rather than as mag_type). The complicated enable_if expression just ensures that the method only exists if mag_type and T are different types; the method still returns void, as above.

Definition at line 1952 of file Tpetra_MultiVector_decl.hpp.

◆ meanValue() [2/2]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::meanValue ( const Teuchos::ArrayView< impl_scalar_type > &  means) const
inherited

Compute mean (average) value of each column.

The outcome of this routine is undefined for non-floating point scalar types (e.g., int).

Definition at line 2398 of file Tpetra_MultiVector_def.hpp.

◆ multiply()

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::multiply ( Teuchos::ETransp  transA,
Teuchos::ETransp  transB,
const Scalar alpha,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  A,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  B,
const Scalar beta 
)
inherited

Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).

If beta is zero, overwrite *this unconditionally, even if it contains NaN entries. This imitates the semantics of analogous BLAS routines like DGEMM.

Definition at line 3814 of file Tpetra_MultiVector_def.hpp.

◆ elementWiseMultiply()

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::elementWiseMultiply ( Scalar  scalarAB,
const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  A,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  B,
Scalar  scalarThis 
)
inherited

Multiply a Vector A elementwise by a MultiVector B.

Compute this = scalarThis * this + scalarAB * B @ A where @ denotes element-wise multiplication. In pseudocode, if C denotes *this MultiVector:

C(i,j) = scalarThis * C(i,j) + scalarAB * B(i,j) * A(i,1);

for all rows i and columns j of C.

B must have the same dimensions as *this, while A must have the same number of rows but a single column.

We do not require that A, B, and *this have compatible Maps, as long as the number of rows in A, B, and *this on each process is the same. For example, one or more of these vectors might have a locally replicated Map, or a Map with a local communicator (MPI_COMM_SELF). This case may occur in block relaxation algorithms when applying a diagonal scaling.

Definition at line 4049 of file Tpetra_MultiVector_def.hpp.

◆ getNumVectors()

size_t Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getNumVectors ( ) const
inherited

Number of columns in the multivector.

Definition at line 2090 of file Tpetra_MultiVector_def.hpp.

◆ getLocalLength()

size_t Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getLocalLength ( ) const
inherited

Local number of rows on the calling process.

Definition at line 974 of file Tpetra_MultiVector_def.hpp.

◆ getGlobalLength()

global_size_t Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getGlobalLength ( ) const
inherited

Global number of rows in the multivector.

Definition at line 985 of file Tpetra_MultiVector_def.hpp.

◆ getStride()

size_t Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getStride ( ) const
inherited

Stride between columns in the multivector.

This is only meaningful if isConstantStride() returns true.

Warning
This may be different on different processes.

Definition at line 996 of file Tpetra_MultiVector_def.hpp.

◆ isConstantStride()

bool Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::isConstantStride ( ) const
inherited

Whether this multivector has constant stride between columns.

Warning
This may be different on different processes.

Definition at line 967 of file Tpetra_MultiVector_def.hpp.

◆ aliases()

Whether this multivector's memory might alias other. This is conservative: if either this or other is not constant stride, then it simply checks whether the contiguous memory allocations overlap. It doesn't check whether the sets of columns overlap. This is a symmetric relation: X.aliases(Y) == Y.aliases(X).

Definition at line 1002 of file Tpetra_MultiVector_def.hpp.

◆ removeEmptyProcessesInPlace() [1/2]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::removeEmptyProcessesInPlace ( const Teuchos::RCP< const map_type > &  newMap)
overridevirtualinherited

Remove processes owning zero rows from the Map and their communicator.

Warning
This method is ONLY for use by experts. We highly recommend using the nonmember function of the same name defined in Tpetra_DistObject_decl.hpp.
We make NO promises of backwards compatibility. This method may change or disappear at any time.
Parameters
newMap[in] This must be the result of calling the removeEmptyProcesses() method on the row Map. If it is not, this method's behavior is undefined. This pointer will be null on excluded processes.

Definition at line 4482 of file Tpetra_MultiVector_def.hpp.

◆ removeEmptyProcessesInPlace() [2/2]

void Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::removeEmptyProcessesInPlace ( const Teuchos::RCP< const map_type > &  newMap)
virtualinherited

Remove processes which contain no entries in this object's Map.

Warning
This method is ONLY for use by experts. We highly recommend using the nonmember function of the same name defined in this file.
We make NO promises of backwards compatibility. This method may change or disappear at any time.

On input, this object is distributed over the Map returned by getMap() (the "original Map," with its communicator, the "original communicator"). The input newMap of this method must be the same as the result of calling getMap()->removeEmptyProcesses(). On processes in the original communicator which contain zero entries ("excluded processes," as opposed to "included processes"), the input newMap must be Teuchos::null (which is what getMap()->removeEmptyProcesses() returns anyway).

On included processes, reassign this object's Map (that would be returned by getMap()) to the input newMap, and do any work that needs to be done to restore correct semantics. On excluded processes, free any data that needs freeing, and do any other work that needs to be done to restore correct semantics.

This method has collective semantics over the original communicator. On exit, the only method of this object which is safe to call on excluded processes is the destructor. This implies that subclasses' destructors must not contain communication operations.

Returns
The object's new Map. Its communicator is a new communicator, distinct from the old Map's communicator, which contains a subset of the processes in the old communicator.
Note
The name differs from Map's method removeEmptyProcesses(), in order to emphasize that the operation on DistObject happens in place, modifying the input, whereas the operation removeEmptyProcess() on Map does not modify the input.
To implementers of DistObject subclasses: The default implementation of this class throws std::logic_error.

Definition at line 636 of file Tpetra_DistObject_def.hpp.

◆ setCopyOrView()

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::setCopyOrView ( const Teuchos::DataAccess  copyOrView)
inlineinherited

Set whether this has copy (copyOrView = Teuchos::Copy) or view (copyOrView = Teuchos::View) semantics.

Warning
The Kokkos refactor version of MultiVector only implements view semantics. If you attempt to call this method with copyOrView == Teuchos::Copy, it will throw std::invalid_argument.
This method is only for expert use. It may change or disappear at any time.

Definition at line 2118 of file Tpetra_MultiVector_decl.hpp.

◆ getCopyOrView()

Teuchos::DataAccess Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getCopyOrView ( ) const
inlineinherited

Get whether this has copy (copyOrView = Teuchos::Copy) or view (copyOrView = Teuchos::View) semantics.

Warning
This method is only for expert use. It may change or disappear at any time.

Definition at line 2135 of file Tpetra_MultiVector_decl.hpp.

◆ assign()

Copy the contents of src into *this (deep copy).

Parameters
src[in] Source MultiVector (input of the deep copy).
Precondition
! src.getMap ().is_null () && ! this->getMap ().is_null ()
src.getMap ()->isCompatible (* (this->getMap ())
Postcondition
Any outstanding views of src or *this remain valid.
Note
To implementers: The postcondition implies that the implementation must not reallocate any memory of *this, or otherwise change its dimensions. This is not an assignment operator; it does not change anything in *this other than the contents of storage.

Definition at line 4488 of file Tpetra_MultiVector_def.hpp.

◆ convert()

template<class T >
Teuchos::RCP< MultiVector< T, LocalOrdinal, GlobalOrdinal, Node > > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::convert ( ) const
inherited

Return another MultiVector with the same entries, but converted to a different Scalar type T.

Definition at line 4540 of file Tpetra_MultiVector_def.hpp.

◆ isSameSize()

Parameters
src[in] MultiVector
Precondition
! vec.getMap ().is_null () && ! this->getMap ().is_null ()
vec.getMap ()->isCompatible (* (this->getMap ())
Postcondition
Any outstanding views of src or *this remain valid.

Definition at line 4552 of file Tpetra_MultiVector_def.hpp.

◆ descriptionImpl()

std::string Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::descriptionImpl ( const std::string &  className) const
protectedinherited

Implementation of description() for this class, and its subclass Vector.

Parameters
className[in] Name of the class calling this method: Either "Tpetra::MultiVector" or "Tpetra::Vector" (no quotes in the string, in either case).

Definition at line 4269 of file Tpetra_MultiVector_def.hpp.

◆ localDescribeToString()

std::string Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::localDescribeToString ( const Teuchos::EVerbosityLevel  vl) const
protectedinherited

Print the calling process' verbose describe() information to the returned string.

This is an implementation detail of describe().

Parameters
vl[in] Verbosity level with which to print.

want to print both the host and device views, without chaging state,

Definition at line 4343 of file Tpetra_MultiVector_def.hpp.

◆ describeImpl()

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::describeImpl ( Teuchos::FancyOStream &  out,
const std::string &  className,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::Describable::verbLevel_default 
) const
protectedinherited

Implementation of describe() for this class, and its subclass Vector.

Parameters
out[out] Output stream to which to write. Only Process 0 in this object's communicator may write to the output stream.
className[in] Name of the class calling this method.
verbLevel[in] Verbosity level. This also controls whether this method does any communication. At verbosity levels higher (greater) than Teuchos::VERB_LOW, this method behaves as a collective over the object's communicator.

Definition at line 4404 of file Tpetra_MultiVector_def.hpp.

◆ getSubArrayRCP()

template<class T >
Teuchos::ArrayRCP< T > Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getSubArrayRCP ( Teuchos::ArrayRCP< T arr,
size_t  j 
) const
protectedinherited

Persisting view of j-th column in the given ArrayRCP.

This method considers isConstantStride(). The ArrayRCP may correspond either to a compute buffer or a host view.

Definition at line 4242 of file Tpetra_MultiVector_def.hpp.

◆ getOrigNumLocalRows()

size_t Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getOrigNumLocalRows ( ) const
protectedinherited

"Original" number of rows in the (local) data.

Definition at line 3159 of file Tpetra_MultiVector_def.hpp.

◆ getOrigNumLocalCols()

size_t Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::getOrigNumLocalCols ( ) const
protectedinherited

"Original" number of columns in the (local) data.

Definition at line 3166 of file Tpetra_MultiVector_def.hpp.

◆ checkSizes()

bool Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::checkSizes ( const SrcDistObject sourceObj)
overrideprotectedvirtualinherited

Whether data redistribution between sourceObj and this object is legal.

This method is called in DistObject::doTransfer() to check whether data redistribution between the two objects is legal.

Implements Tpetra::DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

Definition at line 1013 of file Tpetra_MultiVector_def.hpp.

◆ constantNumberOfPackets()

size_t Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::constantNumberOfPackets ( ) const
overrideprotectedvirtualinherited

Number of packets to send per LID.

Reimplemented from Tpetra::DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

Definition at line 1035 of file Tpetra_MultiVector_def.hpp.

◆ copyAndPermute() [1/2]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::copyAndPermute ( const SrcDistObject source,
const size_t  numSameIDs,
const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &  permuteToLIDs,
const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &  permuteFromLIDs,
const CombineMode  CM,
const execution_space space 
)
overrideprotectedvirtualinherited

Same as copyAndPermute, but do operations in space.

Reimplemented from Tpetra::DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

Definition at line 1041 of file Tpetra_MultiVector_def.hpp.

◆ copyAndPermute() [2/2]

void Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::copyAndPermute ( const SrcDistObject source,
const size_t  numSameIDs,
const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &  permuteToLIDs,
const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &  permuteFromLIDs,
const CombineMode  CM 
)
overrideprotectedvirtualinherited

Perform copies and permutations that are local to the calling (MPI) process.

Subclasses must reimplement this function. Its default implementation does nothing. Note that the <t>target object of the Export or Import, namely *this, packs the source object's data.

Precondition
permuteToLIDs and permuteFromLIDs are sync'd to both host and device. That is, permuteToLIDs.need_sync_host(), permuteToLIDs.need_sync_device(), permuteFromLIDs.need_sync_host(), and permuteFromLIDs.need_sync_device() are all false.
Parameters
source[in] On entry, the source object of the Export or Import operation.
numSameIDs[in] The number of elements that are the same on the source and target objects. These elements live on the same process in both the source and target objects.
permuteToLIDs[in] List of the elements that are permuted. They are listed by their local index (LID) in the destination object.
permuteFromLIDs[in] List of the elements that are permuted. They are listed by their local index (LID) in the source object.
CM[in] CombineMode to be used during copyAndPermute; may or may not be used by the particular object being called; behavior with respect to CombineMode may differ by object.

Reimplemented from Tpetra::DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

Definition at line 1403 of file Tpetra_MultiVector_def.hpp.

◆ packAndPrepare() [1/2]

void Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::packAndPrepare ( const SrcDistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  source,
const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &  exportLIDs,
Kokkos::DualView< packet_type *, buffer_device_type > &  exports,
Kokkos::DualView< size_t *, buffer_device_type numPacketsPerLID,
size_t constantNumPackets 
)
protectedvirtualinherited

Pack data and metadata for communication (sends).

Subclasses must reimplement this function. Its default implementation does nothing. Note that the <t>target object of the Export or Import, namely *this, packs the source object's data.

Precondition
exportLIDs is sync'd to both host and device. That is, exportLIDs.need_sync_host () and exportLIDs.need_sync_device() are both false.
Parameters
source[in] Source object for the redistribution.
exportLIDs[in] List of the entries (as local IDs in the source object) that Tpetra will send to other processes.
exports[out] On exit, the packed data to send. Implementations must reallocate this as needed (prefer reusing the existing allocation if possible), and may modify and/or sync this wherever they like.
numPacketsPerLID[out] On exit, the implementation of this method must do one of two things: either set numPacketsPerLID[i] to the number of packets to be packed for exportLIDs[i] and set constantNumPackets to zero, or set constantNumPackets to a nonzero value. If the latter, the implementation must not modify the entries of numPacketsPerLID. If the former, the implementation may sync numPacketsPerLID this wherever it likes, either to host or to device. The allocation belongs to DistObject, not to subclasses; don't be tempted to change this to pass by reference.
constantNumPackets[out] On exit, 0 if the number of packets per LID could differ, else (if nonzero) the number of packets per LID (which must be constant).

Definition at line 881 of file Tpetra_DistObject_def.hpp.

◆ packAndPrepare() [2/2]

void Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::packAndPrepare ( const SrcDistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  source,
const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &  exportLIDs,
Kokkos::DualView< packet_type *, buffer_device_type > &  exports,
Kokkos::DualView< size_t *, buffer_device_type numPacketsPerLID,
size_t constantNumPackets,
const execution_space space 
)
protectedvirtualinherited

Same as packAndPrepare, but in an execution space instance.

Definition at line 894 of file Tpetra_DistObject_def.hpp.

◆ unpackAndCombine()

void Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::unpackAndCombine ( const Kokkos::DualView< const local_ordinal_type *, buffer_device_type > &  importLIDs,
Kokkos::DualView< packet_type *, buffer_device_type imports,
Kokkos::DualView< size_t *, buffer_device_type numPacketsPerLID,
const size_t  constantNumPackets,
const CombineMode  combineMode 
)
protectedvirtualinherited

Perform any unpacking and combining after communication.

Subclasses must reimplement this function. Its default implementation does nothing. Note that the <t>target object of the Export or Import, namely *this, unpacks the received data into itself, possibly modifying its entries.

Precondition
importLIDs is sync'd to both host and device. That is, importLIDs.need_sync_host () and importLIDs.need_sync_device() are both false.
Parameters
importLIDs[in] List of the entries (as LIDs in the destination object) we received from other processes.
imports[in/out] On input: Buffer of received data to unpack. DistObject promises nothing about where this is sync'd. Implementations may sync this wherever they like, either to host or to device. The allocation belongs to DistObject, not to subclasses; don't be tempted to change this to pass by reference.
numPacketsPerLID[in/out] On input: If constantNumPackets is zero, then numPacketsPerLID[i] contains the number of packets imported for importLIDs[i]. DistObject promises nothing about where this is sync'd. Implementations may sync this wherever they like, either to host or to device. The allocation belongs to DistObject, not to subclasses; don't be tempted to change this to pass by reference.
constantNumPackets[in] If nonzero, then the number of packets per LID is the same for all entries ("constant") and constantNumPackets is that number. If zero, then numPacketsPerLID[i] is the number of packets to unpack for LID importLIDs[i].
combineMode[in] The CombineMode to use when combining the imported entries with existing entries.

Definition at line 945 of file Tpetra_DistObject_def.hpp.

◆ reallocImportsIfNeeded()

bool Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::reallocImportsIfNeeded ( const size_t  newSize,
const bool  verbose,
const std::string *  prefix,
const bool  remoteLIDsContiguous = false,
const CombineMode  CM = INSERT 
)
overrideprotectedvirtualinherited

Reallocate imports_ if needed.

This unfortunately must be declared protected, for the same reason that imports_ is declared protected.

Parameters
newSize[in] New size of imports_.
verbose[in] Whether to print verbose debugging output to stderr on every (MPI) process in the communicator.
prefix[in] If verbose is true, then this is a nonnull prefix to print at the beginning of each line of verbose debugging output. Otherwise, not used.
Returns
Whether we actually reallocated.

We don't need a "reallocExportsIfNeeded" method, because exports_ always gets passed into packAndPrepare() by nonconst reference. Thus, that method can resize the DualView without needing to call other DistObject methods.

return false;

Reimplemented from Tpetra::DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node >.

Definition at line 1767 of file Tpetra_MultiVector_def.hpp.

◆ doImport() [1/2]

void Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::doImport ( const SrcDistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  source,
const Import< LocalOrdinal, GlobalOrdinal, Node > &  importer,
const CombineMode  CM,
const bool  restrictedMode = false 
)
inherited

Import data into this object using an Import object ("forward mode").

The input DistObject is always the source of the data redistribution operation, and the *this object is always the target.

If you don't know the difference between forward and reverse mode, then you probably want forward mode. Use this method with your precomputed Import object if you want to do an Import, else use doExport() with a precomputed Export object.

"Restricted Mode" does two things:

  1. Skips copyAndPermute
  2. Allows the "target" Map of the transfer to be a subset of the Map of *this, in a "locallyFitted" sense.

This cannot be used if (2) is not true, OR there are permutes. The "source" maps still need to match.

Parameters
source[in] The "source" object for redistribution.
importer[in] Precomputed data redistribution plan. Its source Map must be the same as the input DistObject's Map, and its target Map must be the same as this->getMap().
CM[in] How to combine incoming data with the same global index.

Definition at line 379 of file Tpetra_DistObject_def.hpp.

◆ doImport() [2/2]

void Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::doImport ( const SrcDistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  source,
const Export< LocalOrdinal, GlobalOrdinal, Node > &  exporter,
const CombineMode  CM,
const bool  restrictedMode = false 
)
inherited

Import data into this object using an Export object ("reverse mode").

The input DistObject is always the source of the data redistribution operation, and the *this object is always the target.

If you don't know the difference between forward and reverse mode, then you probably want forward mode. Use the version of doImport() that takes a precomputed Import object in that case.

"Restricted Mode" does two things:

  1. Skips copyAndPermute
  2. Allows the "target" Map of the transfer to be a subset of the Map of *this, in a "locallyFitted" sense.

This cannot be used if (2) is not true, OR there are permutes. The "source" maps still need to match.

Parameters
source[in] The "source" object for redistribution.
exporter[in] Precomputed data redistribution plan. Its target Map must be the same as the input DistObject's Map, and its source Map must be the same as this->getMap(). (Note the difference from forward mode.)
CM[in] How to combine incoming data with the same global index.

Definition at line 446 of file Tpetra_DistObject_def.hpp.

◆ doExport() [1/2]

void Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::doExport ( const SrcDistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  source,
const Export< LocalOrdinal, GlobalOrdinal, Node > &  exporter,
const CombineMode  CM,
const bool  restrictedMode = false 
)
inherited

Export data into this object using an Export object ("forward mode").

The input DistObject is always the source of the data redistribution operation, and the *this object is always the target.

If you don't know the difference between forward and reverse mode, then you probably want forward mode. Use this method with your precomputed Export object if you want to do an Export, else use doImport() with a precomputed Import object.

"Restricted Mode" does two things:

  1. Skips copyAndPermute
  2. Allows the "target" Map of the transfer to be a subset of the Map of *this, in a "locallyFitted" sense.

This cannot be used if (2) is not true, OR there are permutes. The "source" maps still need to match.

Parameters
source[in] The "source" object for redistribution.
exporter[in] Precomputed data redistribution plan. Its source Map must be the same as the input DistObject's Map, and its target Map must be the same as this->getMap().
CM[in] How to combine incoming data with the same global index.

Definition at line 412 of file Tpetra_DistObject_def.hpp.

◆ doExport() [2/2]

void Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::doExport ( const SrcDistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  source,
const Import< LocalOrdinal, GlobalOrdinal, Node > &  importer,
const CombineMode  CM,
const bool  restrictedMode = false 
)
inherited

Export data into this object using an Import object ("reverse mode").

The input DistObject is always the source of the data redistribution operation, and the *this object is always the target.

If you don't know the difference between forward and reverse mode, then you probably want forward mode. Use the version of doExport() that takes a precomputed Export object in that case.

"Restricted Mode" does two things:

  1. Skips copyAndPermute
  2. Allows the "target" Map of the transfer to be a subset of the Map of *this, in a "locallyFitted" sense.

This cannot be used if (2) is not true, OR there are permutes. The "source" maps still need to match.

Parameters
source[in] The "source" object for redistribution.
importer[in] Precomputed data redistribution plan. Its target Map must be the same as the input DistObject's Map, and its source Map must be the same as this->getMap(). (Note the difference from forward mode.)
CM[in] How to combine incoming data with the same global index.

Definition at line 480 of file Tpetra_DistObject_def.hpp.

◆ transferArrived()

bool Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::transferArrived ( ) const
inherited

Whether the data from an import/export operation has arrived, and is ready for the unpack and combine step.

Definition at line 535 of file Tpetra_DistObject_def.hpp.

◆ isDistributed()

bool Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::isDistributed ( ) const
inherited

Whether this is a globally distributed object.

For a definition of "globally distributed" (and its opposite, "locally replicated"), see the documentation of Map's isDistributed() method.

Definition at line 546 of file Tpetra_DistObject_def.hpp.

◆ getMap()

virtual Teuchos::RCP< const map_type > Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::getMap ( ) const
inlinevirtualinherited

The Map describing the parallel distribution of this object.

Note that some Tpetra objects might be distributed using multiple Map objects. For example, CrsMatrix has both a row Map and a column Map. It is up to the subclass to decide which Map to use when invoking the DistObject constructor.

Definition at line 554 of file Tpetra_DistObject_decl.hpp.

◆ print()

void Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::print ( std::ostream &  os) const
inherited

Print this object to the given output stream.

We generally assume that all MPI processes can print to the given stream.

Definition at line 564 of file Tpetra_DistObject_def.hpp.

◆ doTransfer()

void Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::doTransfer ( const SrcDistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  src,
const ::Tpetra::Details::Transfer< local_ordinal_type, global_ordinal_type, node_type > &  transfer,
const char  modeString[],
const ReverseOption  revOp,
const CombineMode  CM,
const bool  restrictedMode 
)
protectedvirtualinherited

Redistribute data across (MPI) processes.

Parameters
src[in] The source object, to redistribute into the target object, which is *this object.
transfer[in] The Export or Import object representing the communication pattern. (Details::Transfer is the common base class of these two objects.)
modeString[in] Human-readable string, for verbose debugging output and error output, explaining what function called this method. Example: "doImport (forward)", "doExport (reverse)".
revOp[in] Whether to do a forward or reverse mode redistribution.
CM[in] The combine mode that describes how to combine values that map to the same global ID on the same process.

Definition at line 692 of file Tpetra_DistObject_def.hpp.

◆ reallocArraysForNumPacketsPerLid()

bool Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::reallocArraysForNumPacketsPerLid ( const size_t  numExportLIDs,
const size_t  numImportLIDs 
)
protectedvirtualinherited

Reallocate numExportPacketsPerLID_ and/or numImportPacketsPerLID_, if necessary.

Parameters
numExportLIDs[in] Number of entries in the exportLIDs input array argument of doTransfer().
numImportLIDs[in] Number of entries in the remoteLIDs input array argument of doTransfer().
Returns
Whether we actually reallocated either of the arrays.
Warning
This is an implementation detail of doTransferNew(). This needs to be protected, but that doesn't mean users should call this method.

Definition at line 714 of file Tpetra_DistObject_def.hpp.

◆ beginTransfer()

void Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::beginTransfer ( const SrcDistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  src,
const ::Tpetra::Details::Transfer< local_ordinal_type, global_ordinal_type, node_type > &  transfer,
const char  modeString[],
const ReverseOption  revOp,
const CombineMode  CM,
const bool  restrictedMode 
)
protectedinherited

Implementation detail of doTransfer.

LID DualViews come from the Transfer object given to doTransfer. They are always sync'd on both host and device. Users must never attempt to modify or sync them.

Definition at line 743 of file Tpetra_DistObject_def.hpp.

Friends And Related Symbol Documentation

◆ createMultiVector()

Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > createMultiVector ( const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &  map,
const size_t  numVectors 
)
related

Nonmember MultiVector "constructor": Create a MultiVector from a given Map.

Parameters
map[in] Map describing the distribution of rows of the resulting MultiVector.
numVectors[in] Number of columns of the resulting MultiVector.

◆ createCopy() [1/2]

Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > createCopy ( const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  src)
related

Return a deep copy of the given Vector.

Definition at line 211 of file Tpetra_Vector_def.hpp.

◆ createVector()

Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > createVector ( const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &  map)
related

Nonmember Vector "constructor": Create a Vector from a given Map.

Parameters
map[in] Map describing the distribution of rows of the resulting Vector.

Definition at line 394 of file Tpetra_Vector_decl.hpp.

◆ deep_copy()

template<class DS , class DL , class DG , class DN , class SS , class SL , class SG , class SN >
void deep_copy ( MultiVector< DS, DL, DG, DN > &  dst,
const MultiVector< SS, SL, SG, SN > &  src 
)
related

Copy the contents of the MultiVector src into dst.

Precondition
The two inputs must have the same communicator.
The Map of src must be compatible with the Map of dst.
The two inputs must have the same number of columns.

Copy the contents of the MultiVector src into the MultiVector dst. ("Copy the contents" means the same thing as "deep copy.") The two MultiVectors need not necessarily have the same template parameters, but the assignment of their entries must make sense. Furthermore, their Maps must be compatible, that is, the MultiVectors' local dimensions must be the same on all processes.

This method must always be called as a collective operation on all processes over which the multivector is distributed. This is because the method reserves the right to check for compatibility of the two Maps, at least in debug mode, and throw if they are not compatible.

Definition at line 2420 of file Tpetra_MultiVector_decl.hpp.

◆ createCopy() [2/2]

template<class ST , class LO , class GO , class NT >
MultiVector< ST, LO, GO, NT > createCopy ( const MultiVector< ST, LO, GO, NT > &  src)
related

Return a deep copy of the given MultiVector.

Note
MultiVector's constructor returns a shallow copy of its input, by default. If you want a deep copy, use the two-argument copy constructor with Teuchos::Copy as the second argument, or call this function (createCopy).

Definition at line 4653 of file Tpetra_MultiVector_def.hpp.

Member Data Documentation

◆ useAtomicUpdatesByDefault

const bool Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::useAtomicUpdatesByDefault
staticprotectedinherited
Initial value:
=
true

Whether sumIntoLocalValue and sumIntoGlobalValue should use atomic updates by default.

Warning
This is an implementation detail.

Definition at line 811 of file Tpetra_MultiVector_decl.hpp.

◆ view_

The Kokkos::DualView containing the MultiVector's data.

This has to be declared mutable, so that get1dView() can retain its current const marking, even though it has always implied a device->host synchronization. Lesson to the reader: Use const sparingly!

Definition at line 2189 of file Tpetra_MultiVector_decl.hpp.

◆ whichVectors_

Teuchos::Array<size_t> Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::whichVectors_
protectedinherited

Indices of columns this multivector is viewing.

If this array has nonzero size, then this multivector is a view of another multivector (the "original" multivector). In that case, whichVectors_ contains the indices of the columns of the original multivector. Furthermore, isConstantStride() returns false in this case.

If this array has zero size, then this multivector is not a view of any other multivector. Furthermore, the stride between columns of this multivector is a constant: thus, isConstantStride() returns true.

Definition at line 2203 of file Tpetra_MultiVector_decl.hpp.

◆ map_

Teuchos::RCP<const map_type> Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::map_
protectedinherited

The Map over which this object is distributed.

Definition at line 970 of file Tpetra_DistObject_decl.hpp.

◆ imports_

Kokkos::DualView<packet_type*, buffer_device_type> Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::imports_
protectedinherited

Buffer into which packed data are imported (received from other processes).

Unfortunately, I had to declare these protected, because CrsMatrix uses them at one point. Please, nobody else use them.

Definition at line 983 of file Tpetra_DistObject_decl.hpp.

◆ numImportPacketsPerLID_

Kokkos::DualView<size_t*, buffer_device_type> Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::numImportPacketsPerLID_
protectedinherited

Number of packets to receive for each receive operation.

This array is used in Distributor::doPosts() (and doReversePosts()) when starting the ireceive operation.

This may be ignored in doTransfer() if constantNumPackets is nonzero, indicating a constant number of packets per LID. (For example, MultiVector sets the constantNumPackets output argument of packAndPrepare() to the number of columns in the multivector.)

Unfortunately, I had to declare this protected, because CrsMatrix uses it at one point. Please, nobody else use it.

Definition at line 1023 of file Tpetra_DistObject_decl.hpp.

◆ exports_

Kokkos::DualView<packet_type*, buffer_device_type> Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::exports_
protectedinherited

Buffer from which packed data are exported (sent to other processes).

Unfortunately, I had to declare this protected, because CrsMatrix uses it at one point. Please, nobody else use it.

Definition at line 1030 of file Tpetra_DistObject_decl.hpp.

◆ numExportPacketsPerLID_

Kokkos::DualView<size_t*, buffer_device_type> Tpetra::DistObject< Scalar , LocalOrdinal, GlobalOrdinal, Node >::numExportPacketsPerLID_
protectedinherited

Number of packets to send for each send operation.

This array is used in Distributor::doPosts() (and doReversePosts()) for preparing for the send operation.

This may be ignored in doTransfer() if constantNumPackets is nonzero, indicating a constant number of packets per LID. (For example, MultiVector sets the constantNumPackets output argument of packAndPrepare() to the number of columns in the multivector.)

Unfortunately, I had to declare this protected, because CrsMatrix uses them at one point. Please, nobody else use it.

Definition at line 1045 of file Tpetra_DistObject_decl.hpp.


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