LAMA
|
The template DenseVector represents a distributed 1D Vector with elements of type T. More...
#include <DenseVector.hpp>
Public Types | |
typedef T | ValueType |
the Type of elements of this. | |
typedef const Vector & | ExpressionMemberType |
ExpressionMemberType is the type that is used the template Expression to store a Vector. | |
Public Member Functions | |
DenseVector () | |
Default constructor, creates replicated 0 vector. | |
DenseVector (DistributionPtr distribution) | |
creates a not initialized distributed DenseVector of the passed global size. | |
DenseVector (const IndexType size, const ValueType value) | |
creates a replicated DenseVector of the passed size initialized to the passed value. | |
DenseVector (DistributionPtr distribution, const ValueType value) | |
creates a distributed DenseVector of the passed global size initialized to the passed value. | |
template<typename OtherValueType > | |
DenseVector (const IndexType size, const OtherValueType *values) | |
Constructor of a replicated vector by replicated C++ array. | |
DenseVector (const DenseVector< ValueType > &other) | |
Override the default assignment operator. | |
DenseVector (const Vector &other) | |
More general constructor that creates a copy of an arbitrary vector. | |
DenseVector (const Vector &other, DistributionPtr distribution) | |
creates a redistributed copy of the passed vector | |
DenseVector (const _LAMAArray &localValues, DistributionPtr distribution) | |
creates a distributed DenseVector with given local values. | |
DenseVector (const std::string &filename) | |
This constructor creates a vector with the size and values stored in the file with the given filename. | |
DenseVector (const Expression< Scalar, Vector, Times > &expression) | |
creates a DenseVector with the Expression alpha*x. | |
DenseVector (const Expression< Expression< Scalar, Vector, Times >, Expression< Scalar, Vector, Times >, Plus > &expression) | |
creates a DenseVector with the Expression alpha*x+beta*y. | |
DenseVector (const Expression< Expression< Scalar, Expression< Matrix, Vector, Times >, Times >, Expression< Scalar, Vector, Times >, Plus > &expression) | |
creates a DenseVector with the Expression alpha * A * x + beta * y. | |
DenseVector (const Expression< Scalar, Expression< Matrix, Vector, Times >, Times > &expression) | |
creates a DenseVector with the Expression alpha*A*x. | |
DenseVector (const Expression< Matrix, Vector, Times > &expression) | |
creates a DenseVector with the Expression A*x. | |
virtual | ~DenseVector () |
releases all allocated resources. | |
void | allocate (DistributionPtr distribution) |
Allocate a vector with a certain distribution, values are undefined. | |
DenseVector & | operator= (const DenseVector< T > &other) |
Override the default assignment operator. | |
DenseVector & | operator= (const Scalar) |
Reimplement scalar assignment as otherwise type conversion rules do not apply. | |
virtual Scalar::ScalarType | getValueType () const |
Query the value type of the vector elements, e.g. | |
virtual void | buildValues (_LAMAArray &values) const |
Implementation of pure method. | |
virtual void | setValues (const _LAMAArray &values) |
Implementation of pure method. | |
virtual std::auto_ptr< Vector > | create () const |
Create is a virtual constructor, which creates a new Vector with the same concrete class, size and distribuiton than this. | |
virtual std::auto_ptr< Vector > | create (DistributionPtr distribution) const |
Create is a virtual constructor, which creates a new Vector with the same concrete class than this. | |
LAMAArray< T > & | getLocalValues () |
get a non constant reference to local values of this Dense Vector. | |
const LAMAArray< T > & | getLocalValues () const |
get a constant reference to local values of this Dense Vector. | |
LAMAArray< T > & | getHaloValues () const |
get a reference to halo values of this Dense Vector. | |
void | updateHalo (const Halo &halo) const |
update the halo values according to the passed Halo. | |
std::auto_ptr< SyncToken > | updateHaloAsync (const Halo &halo) const |
update the halo values according to the passed Halo asynchronously. | |
virtual Scalar | getValue (IndexType globalIndex) const |
returns a copy of the value at the passed global index. | |
virtual Scalar | min () const |
returns the global minimum value of this. | |
virtual Scalar | max () const |
returns the global maximum value of this. | |
virtual Scalar | l1Norm () const |
returns the L1 norm of this. | |
virtual Scalar | l2Norm () const |
returns the L2 norm of this. | |
virtual Scalar | maxNorm () const |
returns the max norm of this. | |
virtual void | swap (Vector &other) |
Swap the content of of this vector with another vector. | |
virtual void | writeAt (std::ostream &stream) const |
Write some information about this to the passed stream. | |
virtual void | assign (const Expression< Expression< Scalar, Vector, Times >, Expression< Scalar, Vector, Times >, Plus > &expression) |
Assignment of a 'full' vector expression. | |
virtual void | assign (const Scalar value) |
Assign this vector with a scalar values, does not change size, distribution. | |
virtual void | assign (const Vector &other) |
Assign this vector with another vector, inherits size and distribution. | |
virtual void | assign (const _LAMAArray &localValues, DistributionPtr dist) |
Assignment to vector by local values and distribution. | |
virtual void | buildLocalValues (_LAMAArray &localValues) const |
Build an array with local values of a distributed vector. | |
virtual Scalar | dotProduct (const Vector &other) const |
virtual void | prefetch (const ContextPtr location) const |
Starts a prefetch to make this valid at the passed context. | |
virtual void | wait () const |
wait for a possibly running prefetch. | |
virtual void | invert () |
This method inverts all elements of the vector and is completely local. | |
virtual size_t | getMemoryUsage () const |
getMemoryUsage returns the global memory that is allocated to hold this vector. | |
virtual void | redistribute (DistributionPtr distribution) |
redistributes this vector to the new passed distribution. | |
void | writeToFile (const std::string &fileBaseName, const File::FileType fileType=File::XDR, const File::DataType dataType=File::DOUBLE) const |
Vector & | operator*= (const Scalar value) |
Vector & | operator+= (const Vector &other) |
Vector & | operator+= (const Expression< Scalar, Vector, Times > &expression) |
Vector & | operator-= (const Vector &other) |
const Scalar | operator() (const IndexType i) const |
returns a copy of the value at the passed global index. | |
Scalar | operator* (const Vector &other) const |
returns the dot product of this and other | |
IndexType | size () const |
Returns the size of the vector. | |
void | setContext (ContextPtr location) |
Set the 'preferred' context where data resides and computations are done. | |
ContextPtr | getContext () const |
Getter for the context (pointer) of a vector. | |
void | resize (DistributionPtr distributionPtr) |
Allocate this vector for a given distribution. | |
const Distribution & | getDistribution () const |
DistributionPtr | getDistributionPtr () const |
Static Public Member Functions | |
static void | vectorPlusVector (ContextPtr context, LAMAArrayView< T > result, const T alpha, const LAMAArrayConstView< T > x, const T beta, const LAMAArrayConstView< T > y) |
static std::auto_ptr< Vector > | createVector (const Scalar::ScalarType valueType, DistributionPtr distribution) |
Protected Member Functions | |
virtual void | resizeImpl () |
LAMA_LOG_DECL_STATIC_LOGGER (logger) | |
void | swap (Distributed &other) |
void | swapVector (Vector &other) |
Swap member variables of Vector class. | |
void | setDistributionPtr (DistributionPtr distributionPtr) |
Protected Attributes | |
ContextPtr | mContext |
decides about location of vector operations | |
Private Member Functions | |
long | getDataTypeSize (const File::DataType dataType) const |
void | writeVectorToFormattedFile (const std::string &fileName) const |
void | writeVectorToBinaryFile (const std::string &fileName, const long outputDataTypeSize) const |
void | writeVectorToXDRFile (const std::string &fileName, const long outputDataTypeSize) const |
void | writeVectorDataToBinaryFile (std::fstream &outFile, const long dataTypeSize) const |
void | readVectorHeader (const std::string &filename, File::FileType &fileType, long &dataTypeSize) |
void | writeVectorHeader (const std::string &fileName, const File::FileType &fileType, const long dataTypeSize) const |
void | writeVectorToMMFile (const std::string &filename, const File::DataType &dataType) const |
void | readVectorFromFormattedFile (const std::string &fileName) |
void | readVectorFromBinaryFile (const std::string &fileName, const long dataTypeSize) |
void | readVectorFromXDRFile (const std::string &fileName, const long dataTypeSizeHeader) |
void | readVectorDataFromBinaryFile (std::fstream &inFile, const long dataTypeSize) |
Private Attributes | |
LAMAArray< T > | mLocalValues |
my local values of vector | |
LAMAArray< T > | mHaloValues |
my halo values of vector |
The template DenseVector represents a distributed 1D Vector with elements of type T.
T | the value type for the elements of this. |
typedef const Vector& lama::Vector::ExpressionMemberType [inherited] |
ExpressionMemberType is the type that is used the template Expression to store a Vector.
typedef T lama::DenseVector< T >::ValueType |
the Type of elements of this.
lama::DenseVector< T >::DenseVector | ( | ) |
Default constructor, creates replicated 0 vector.
lama::DenseVector< T >::DenseVector | ( | DistributionPtr | distribution | ) |
creates a not initialized distributed DenseVector of the passed global size.
[in] | distribution | the distribution to use for the new vector. |
lama::DenseVector< T >::DenseVector | ( | const IndexType | size, |
const ValueType | value | ||
) |
creates a replicated DenseVector of the passed size initialized to the passed value.
[in] | size | the size of the new DenseVector. |
[in] | value | the value to assign to all elements of the new DenseVector. |
lama::DenseVector< T >::DenseVector | ( | DistributionPtr | distribution, |
const ValueType | value | ||
) |
creates a distributed DenseVector of the passed global size initialized to the passed value.
[in] | distribution | the distribution to use for the new vector. |
[in] | value | the value to assign to all elements of the new DenseVector. |
lama::DenseVector< T >::DenseVector | ( | const IndexType | size, |
const OtherValueType * | values | ||
) |
Constructor of a replicated vector by replicated C++ array.
creates a new replicated DenseVector initialized with the passed values.
[in] | size | the size of the new DenseVector. |
[in] | values | the values to initialize the new DenseVector with. |
References lama::DenseVector< T >::mLocalValues, and lama::Vector::size().
lama::DenseVector< T >::DenseVector | ( | const DenseVector< ValueType > & | other | ) |
Override the default assignment operator.
[in] | other | the dense vector that will be copied |
The new constructed vector has the same distribution as the input vector.
References lama::Distributed::getDistribution(), lama::DenseVector< T >::getLocalValues(), lama::DenseVector< T >::mLocalValues, and lama::Vector::size().
lama::DenseVector< T >::DenseVector | ( | const Vector & | other | ) |
More general constructor that creates a copy of an arbitrary vector.
References lama::DenseVector< T >::allocate(), lama::DenseVector< T >::assign(), and lama::Distributed::getDistributionPtr().
lama::DenseVector< T >::DenseVector | ( | const Vector & | other, |
DistributionPtr | distribution | ||
) |
creates a redistributed copy of the passed vector
[in] | other | the vector to take a copy from |
[in] | distribution | the distribution to use for the new vector. |
Must be valid: other.size() == distribution.getGlobalSize()
References lama::DenseVector< T >::assign(), and lama::DenseVector< T >::redistribute().
lama::DenseVector< T >::DenseVector | ( | const _LAMAArray & | localValues, |
DistributionPtr | distribution | ||
) |
creates a distributed DenseVector with given local values.
[in] | localValues | the local values to initialize the new DenseVector with. |
[in] | distribution | the distribution the |
References lama::DenseVector< T >::assign(), LAMA_ASSERT_EQUAL_ERROR, lama::DenseVector< T >::mLocalValues, and lama::_LAMAArray::size().
lama::DenseVector< T >::DenseVector | ( | const std::string & | filename | ) |
This constructor creates a vector with the size and values stored in the file with the given filename.
[in] | filename | the name of the file to read the Vector from. |
The distribution of the vector is CYCLIC(n) where n is the size of the vector. So only the first processor will hold all values.
Note: Only the first processor will read the matrix file.
References lama::File::BINARY, lama::File::FORMATTED, lama::CommunicatorFactory::get(), and lama::File::XDR.
lama::DenseVector< T >::DenseVector | ( | const Expression< Scalar, Vector, Times > & | expression | ) |
creates a DenseVector with the Expression alpha*x.
[in] | expression | alpha*x |
References lama::DenseVector< T >::operator=().
lama::DenseVector< T >::DenseVector | ( | const Expression< Expression< Scalar, Vector, Times >, Expression< Scalar, Vector, Times >, Plus > & | expression | ) |
creates a DenseVector with the Expression alpha*x+beta*y.
[in] | expression | a*x+b*y |
References lama::DenseVector< T >::allocate(), lama::Distributed::getDistributionPtr(), and lama::DenseVector< T >::operator=().
lama::DenseVector< T >::DenseVector | ( | const Expression< Expression< Scalar, Expression< Matrix, Vector, Times >, Times >, Expression< Scalar, Vector, Times >, Plus > & | expression | ) |
creates a DenseVector with the Expression alpha * A * x + beta * y.
[in] | expression | a*A*x+b*y |
References lama::DenseVector< T >::allocate(), lama::Distributed::getDistributionPtr(), and lama::DenseVector< T >::operator=().
lama::DenseVector< T >::DenseVector | ( | const Expression< Scalar, Expression< Matrix, Vector, Times >, Times > & | expression | ) |
creates a DenseVector with the Expression alpha*A*x.
[in] | expression | a*A*x |
References lama::DenseVector< T >::allocate(), lama::Distributed::getDistributionPtr(), and lama::DenseVector< T >::operator=().
lama::DenseVector< T >::DenseVector | ( | const Expression< Matrix, Vector, Times > & | expression | ) |
creates a DenseVector with the Expression A*x.
[in] | expression | A*x |
References lama::DenseVector< T >::allocate(), lama::Distributed::getDistributionPtr(), and lama::DenseVector< T >::operator=().
lama::DenseVector< T >::~DenseVector | ( | ) | [virtual] |
releases all allocated resources.
void lama::DenseVector< T >::allocate | ( | DistributionPtr | distribution | ) |
Allocate a vector with a certain distribution, values are undefined.
Referenced by lama::DenseVector< T >::DenseVector(), and lama::DenseMatrix< T >::getDiagonalImpl().
void lama::DenseVector< T >::assign | ( | const Expression< Expression< Scalar, Vector, Times >, Expression< Scalar, Vector, Times >, Plus > & | expression | ) | [virtual] |
Assignment of a 'full' vector expression.
Implements lama::Vector.
References lama::ReadAccess< T >::get(), lama::Vector::getValue(), LAMA_THROWEXCEPTION, lama::DenseVector< T >::mLocalValues, lama::WriteAccess< T >::resize(), and lama::_LAMAArray::size().
Referenced by lama::DenseVector< T >::DenseVector().
void lama::DenseVector< T >::assign | ( | const Scalar | value | ) | [virtual] |
Assign this vector with a scalar values, does not change size, distribution.
Implements lama::Vector.
References lama::LAMAArrayUtils::assign().
void lama::DenseVector< T >::assign | ( | const Vector & | other | ) | [virtual] |
Assign this vector with another vector, inherits size and distribution.
Implements lama::Vector.
References lama::Vector::buildLocalValues(), and lama::Distributed::getDistributionPtr().
void lama::DenseVector< T >::assign | ( | const _LAMAArray & | localValues, |
DistributionPtr | distribution | ||
) | [virtual] |
Assignment to vector by local values and distribution.
Implements lama::Vector.
References lama::LAMAArrayUtils::assign(), LAMA_ASSERT_EQUAL_ERROR, and lama::_LAMAArray::size().
void lama::DenseVector< T >::buildLocalValues | ( | _LAMAArray & | localValues | ) | const [virtual] |
Build an array with local values of a distributed vector.
[out] | localValues | will be an array that contains local values of the vector |
For different value types, implicit format conversion will be done. A sparse vector should generate an array with all values.
Implements lama::Vector.
References lama::LAMAArrayUtils::assign().
void lama::DenseVector< T >::buildValues | ( | _LAMAArray & | values | ) | const [virtual] |
std::auto_ptr< Vector > lama::DenseVector< T >::create | ( | ) | const [virtual] |
Create is a virtual constructor, which creates a new Vector with the same concrete class, size and distribuiton than this.
Implements lama::Vector.
std::auto_ptr< Vector > lama::DenseVector< T >::create | ( | DistributionPtr | distribution | ) | const [virtual] |
Create is a virtual constructor, which creates a new Vector with the same concrete class than this.
[in] | distribution | the distribution to use for the new Vector. |
Implements lama::Vector.
References lama::Vector::setContext().
std::auto_ptr< Vector > lama::Vector::createVector | ( | const Scalar::ScalarType | valueType, |
DistributionPtr | distribution | ||
) | [static, inherited] |
References lama::File::DOUBLE, lama::File::FLOAT, and LAMA_THROWEXCEPTION.
Referenced by lama::SingleGridSetup::initialize(), lama::SpecializedJacobi::initialize(), and lama::DefaultJacobi::initialize().
Scalar lama::DenseVector< T >::dotProduct | ( | const Vector & | other | ) | const [virtual] |
Implements lama::Vector.
References lama::ReadAccess< T >::get(), lama::Distributed::getDistribution(), lama::LAMAInterfaceRegistry::getInterface(), lama::LAMAInterfaceRegistry::getRegistry(), LAMA_ASSERT_EQUAL_DEBUG, LAMA_CONTEXT_ACCESS, LAMA_THROWEXCEPTION, and lama::DenseVector< T >::mLocalValues.
ContextPtr lama::Vector::getContext | ( | ) | const [inline, inherited] |
Getter for the context (pointer) of a vector.
References lama::Vector::mContext.
long lama::DenseVector< T >::getDataTypeSize | ( | const File::DataType | dataType | ) | const [private] |
References lama::File::DOUBLE, lama::File::FLOAT, lama::File::INTERNAL, and LAMA_THROWEXCEPTION.
const Distribution & lama::Distributed::getDistribution | ( | ) | const [inline, inherited] |
References lama::Distributed::mDistribution.
Referenced by lama::SparseMatrix< T >::assignTransposeImpl(), lama::Matrix::checkSettings(), lama::LUSolver::computeLUFactorization(), lama::InverseSolver::decompose(), lama::DenseMatrix< T >::DenseMatrix(), lama::DenseVector< T >::DenseVector(), lama::DenseVector< T >::dotProduct(), lama::MatrixCreator< T >::fillRandom(), lama::SparseMatrix< T >::getLocalRow(), lama::SparseMatrix< T >::getRow(), lama::DenseMatrix< T >::getRow(), lama::DenseMatrixOps::invert(), lama::InverseSolver::invert(), lama::DenseMatrixOps::invertCyclic(), lama::DenseMatrixOps::invertReplicated(), lama::Matrix::Matrix(), lama::DenseMatrix< T >::matrixTimesMatrix(), lama::SparseMatrix< T >::matrixTimesMatrixImpl(), lama::CRTPMatrix< DenseMatrix< T >, T >::matrixTimesVector(), lama::SparseMatrix< T >::matrixTimesVector(), lama::SparseMatrix< T >::matrixTimesVectorNImpl(), lama::DenseMatrix< T >::maxDiffNorm(), lama::SparseMatrix< T >::maxDiffNorm(), lama::DenseMatrix< T >::maxDiffNormImpl(), lama::SparseMatrix< T >::maxDiffNormImpl(), lama::Matrix::operator=(), lama::SparseMatrix< T >::scale(), lama::SparseMatrix< T >::setDiagonal(), lama::LUSolver::solve(), lama::Solver::solveInit(), lama::Vector::Vector(), and lama::Vector::~Vector().
DistributionPtr lama::Distributed::getDistributionPtr | ( | ) | const [inline, inherited] |
References lama::Distributed::mDistribution.
Referenced by lama::SparseMatrix< T >::assign(), lama::DenseMatrix< T >::assign(), lama::DenseVector< T >::assign(), lama::DenseMatrix< T >::assignSparse(), lama::SparseMatrix< T >::assignTransposeImpl(), lama::DenseMatrix< T >::copyDenseMatrix(), lama::DenseVector< T >::DenseVector(), lama::MatrixCreator< T >::fillRandom(), lama::SingleGridSetup::initialize(), lama::CG::initialize(), lama::DefaultJacobi::initialize(), lama::GMRES::initialize(), lama::DenseMatrixOps::invert(), lama::DenseMatrix< T >::invert(), lama::DenseMatrixOps::invertCyclic(), lama::GMRES::iterate(), lama::SparseMatrix< T >::matrixTimesMatrixImpl(), lama::CRTPMatrix< DenseMatrix< T >, T >::matrixTimesVector(), lama::Vector::operator=(), lama::Vector::size(), and lama::Vector::writeAt().
LAMAArray<T>& lama::DenseVector< T >::getHaloValues | ( | ) | const [inline] |
get a reference to halo values of this Dense Vector.
Referenced by lama::SOR::iterateImpl(), lama::SpecializedJacobi::iterateTyped(), and lama::SparseMatrix< T >::matrixTimesVectorImpl().
LAMAArray<T>& lama::DenseVector< T >::getLocalValues | ( | ) | [inline] |
get a non constant reference to local values of this Dense Vector.
Referenced by lama::DenseVector< T >::DenseVector(), lama::DenseMatrix< T >::getDiagonalImpl(), lama::SparseMatrix< T >::getLocalRow(), lama::DenseMatrix< T >::getRow(), lama::DefaultJacobi::iterate(), lama::SOR::iterateImpl(), lama::SpecializedJacobi::iterateTyped(), lama::DenseMatrix< T >::matrixTimesVectorImpl(), lama::SparseMatrix< T >::matrixTimesVectorImpl(), lama::LUSolver::ptrsm(), lama::DenseMatrix< T >::scale(), lama::DenseMatrix< T >::setDiagonal(), and lama::LUSolver::solve().
const LAMAArray<T>& lama::DenseVector< T >::getLocalValues | ( | ) | const [inline] |
get a constant reference to local values of this Dense Vector.
size_t lama::DenseVector< T >::getMemoryUsage | ( | ) | const [virtual] |
getMemoryUsage returns the global memory that is allocated to hold this vector.
getMemoryUsage returns the global memory that is allocated to hold this vector. For a distributed vector all partitions are summed together.
Implements lama::Vector.
Scalar lama::DenseVector< T >::getValue | ( | IndexType | globalIndex | ) | const [virtual] |
returns a copy of the value at the passed global index.
[in] | globalIndex | the global index to get the value at. |
As this operation requires communication in SPMD mode it can be very inefficient in some situations.
Implements lama::Vector.
References lama::nIndex.
Scalar::ScalarType lama::DenseVector< T >::getValueType | ( | ) | const [virtual] |
void lama::DenseVector< T >::invert | ( | ) | [virtual] |
This method inverts all elements of the vector and is completely local.
Implements lama::Vector.
References lama::WriteAccess< T >::get(), LAMA_CONTEXT_ACCESS, and LAMA_INTERFACE_FN_T.
Scalar lama::DenseVector< T >::l1Norm | ( | ) | const [virtual] |
returns the L1 norm of this.
l1Norm computes the sum of the absolute values of this.
Implements lama::Vector.
References lama::ReadAccess< T >::get(), lama::LAMAInterface::getBLAS1Interface(), lama::LAMAInterfaceRegistry::getInterface(), lama::LAMAInterfaceRegistry::getRegistry(), and LAMA_CONTEXT_ACCESS.
Scalar lama::DenseVector< T >::l2Norm | ( | ) | const [virtual] |
returns the L2 norm of this.
l2Norm computes the sum of the absolute values of this.
Implements lama::Vector.
References lama::ReadAccess< T >::get(), lama::LAMAInterface::getBLAS1Interface(), lama::LAMAInterfaceRegistry::getInterface(), lama::LAMAInterfaceRegistry::getRegistry(), LAMA_CONTEXT_ACCESS, and lama::sqrt().
lama::DenseVector< T >::LAMA_LOG_DECL_STATIC_LOGGER | ( | logger | ) | [protected] |
Reimplemented from lama::Vector.
Scalar lama::DenseVector< T >::max | ( | ) | const [virtual] |
returns the global maximum value of this.
Implements lama::Vector.
References lama::max(), and lama::ReadAccess< T >::size().
Scalar lama::DenseVector< T >::maxNorm | ( | ) | const [virtual] |
returns the max norm of this.
maxNorm computes the value of this with the largest magnitude.
Implements lama::Vector.
References lama::ReadAccess< T >::get(), LAMA_CONTEXT_ACCESS, LAMA_INTERFACE_FN_DEFAULT_T, and lama::Communicator::max().
Scalar lama::DenseVector< T >::min | ( | ) | const [virtual] |
returns the global minimum value of this.
Implements lama::Vector.
References lama::min(), and lama::ReadAccess< T >::size().
returns a copy of the value at the passed global index.
[in] | i | the global index to get the value at. |
As this operator requires communication ins SPMD mode it can be very inefficient in some situations.
References lama::Vector::getValue().
returns the dot product of this and other
[in] | other | the vector do calculate the dot product with. |
References lama::Vector::dotProduct(), and LAMA_REGION.
References lama::Vector::operator=().
References lama::Vector::operator=().
Vector & lama::Vector::operator+= | ( | const Expression< Scalar, Vector, Times > & | expression | ) | [inherited] |
References lama::Vector::operator=(), and lama::Plus.
References lama::Vector::operator=(), and lama::Plus.
DenseVector< T > & lama::DenseVector< T >::operator= | ( | const DenseVector< T > & | other | ) |
Override the default assignment operator.
Note: all other assignment operators are inherited from class Vector.
Referenced by lama::DenseVector< T >::DenseVector().
DenseVector< T > & lama::DenseVector< T >::operator= | ( | const Scalar | value | ) |
Reimplement scalar assignment as otherwise type conversion rules do not apply.
Reimplemented from lama::Vector.
void lama::DenseVector< T >::prefetch | ( | const ContextPtr | context | ) | const [virtual] |
Starts a prefetch to make this valid at the passed context.
[in] | context | specifies the location to make this vector valid at |
Implements lama::Vector.
Referenced by lama::DenseMatrix< T >::matrixTimesVectorImpl(), and lama::SparseMatrix< T >::matrixTimesVectorImpl().
void lama::DenseVector< T >::readVectorDataFromBinaryFile | ( | std::fstream & | inFile, |
const long | dataTypeSize | ||
) | [private] |
References lama::WriteAccess< T >::get(), LAMA_THROWEXCEPTION, and lama::writeData().
void lama::DenseVector< T >::readVectorFromBinaryFile | ( | const std::string & | fileName, |
const long | dataTypeSize | ||
) | [private] |
References LAMA_THROWEXCEPTION.
void lama::DenseVector< T >::readVectorFromFormattedFile | ( | const std::string & | fileName | ) | [private] |
References LAMA_THROWEXCEPTION.
void lama::DenseVector< T >::readVectorFromXDRFile | ( | const std::string & | fileName, |
const long | dataTypeSizeHeader | ||
) | [private] |
References LAMA_THROWEXCEPTION, lama::WriteAccess< T >::resize(), and lama::writeData().
void lama::DenseVector< T >::readVectorHeader | ( | const std::string & | filename, |
File::FileType & | fileType, | ||
long & | dataTypeSize | ||
) | [private] |
References lama::File::BINARY, lama::File::FORMATTED, LAMA_THROWEXCEPTION, and lama::File::XDR.
void lama::DenseVector< T >::redistribute | ( | DistributionPtr | distribution | ) | [virtual] |
redistributes this vector to the new passed distribution.
[in] | distribution | the new distribution for this vector. |
The global vector itself remains unchanged; only local parts can be now different.
Implements lama::Vector.
References lama::ReadAccess< T >::get(), lama::WriteAccess< T >::get(), LAMA_ASSERT_DEBUG, LAMA_ASSERT_EQUAL_ERROR, and lama::LAMAArray< T >::swap().
Referenced by lama::DenseVector< T >::DenseVector().
void lama::Vector::resize | ( | DistributionPtr | distributionPtr | ) | [inherited] |
Allocate this vector for a given distribution.
All elements of the vector are undefined after this operation. Elements can be set e.g. with
References lama::Vector::resizeImpl(), and lama::Distributed::setDistributionPtr().
Referenced by lama::SparseMatrix< T >::getDiagonal(), lama::CRTPMatrix< DenseMatrix< T >, T >::matrixTimesVector(), lama::SparseMatrix< T >::matrixTimesVector(), and lama::Vector::operator=().
void lama::DenseVector< T >::resizeImpl | ( | ) | [protected, virtual] |
Implements lama::Vector.
References lama::WriteAccess< T >::resize().
void lama::Vector::setContext | ( | ContextPtr | location | ) | [inherited] |
Set the 'preferred' context where data resides and computations are done.
References lama::Vector::mContext.
Referenced by lama::DenseVector< T >::create(), and lama::GMRES::initialize().
void lama::Distributed::setDistributionPtr | ( | DistributionPtr | distributionPtr | ) | [protected, inherited] |
References lama::Distributed::mDistribution.
Referenced by lama::Vector::resize(), and lama::Matrix::setDistributedMatrix().
void lama::DenseVector< T >::setValues | ( | const _LAMAArray & | values | ) | [virtual] |
Implementation of pure method.
Implements lama::Vector.
References lama::LAMAArrayUtils::assign(), LAMA_ASSERT_ERROR, and lama::_LAMAArray::size().
IndexType lama::Vector::size | ( | ) | const [inline, inherited] |
Returns the size of the vector.
References lama::Distributed::getDistributionPtr().
Referenced by lama::DenseVector< T >::DenseVector(), and lama::Solver::solveInit().
void lama::Distributed::swap | ( | Distributed & | other | ) | [protected, inherited] |
References lama::Distributed::mDistribution.
Referenced by lama::Matrix::swapMatrix().
void lama::DenseVector< T >::swap | ( | Vector & | other | ) | [virtual] |
Swap the content of of this vector with another vector.
[in,out] | other | the Vector to swap the contents with. |
Swap is only possible if both vectors are of the same kind (DENSE) and have the same value type.
Implements lama::Vector.
References LAMA_THROWEXCEPTION, lama::DenseVector< T >::mHaloValues, lama::DenseVector< T >::mLocalValues, and lama::Vector::swapVector().
void lama::Vector::swapVector | ( | Vector & | other | ) | [protected, inherited] |
Swap member variables of Vector class.
References lama::Vector::mContext, and lama::Vector::swap().
Referenced by lama::DenseVector< T >::swap().
void lama::DenseVector< T >::updateHalo | ( | const Halo & | halo | ) | const |
update the halo values according to the passed Halo.
[in] | halo | the halo which describes which remote values should be put into the halo cache. |
References lama::Halo::getHaloSize(), lama::WriteAccess< T >::release(), and lama::WriteAccess< T >::reserve().
Referenced by lama::SOR::iterateImpl().
std::auto_ptr< SyncToken > lama::DenseVector< T >::updateHaloAsync | ( | const Halo & | halo | ) | const |
update the halo values according to the passed Halo asynchronously.
[in] | halo | the halo which describes which remote values should be put into the halo cache. |
References lama::Halo::getHaloSize(), lama::WriteAccess< T >::release(), and lama::WriteAccess< T >::reserve().
void lama::DenseVector< T >::vectorPlusVector | ( | ContextPtr | context, |
LAMAArrayView< T > | result, | ||
const T | alpha, | ||
const LAMAArrayConstView< T > | x, | ||
const T | beta, | ||
const LAMAArrayConstView< T > | y | ||
) | [static] |
void lama::DenseVector< T >::wait | ( | ) | const [virtual] |
wait for a possibly running prefetch.
Implements lama::Vector.
void lama::DenseVector< T >::writeAt | ( | std::ostream & | stream | ) | const [virtual] |
Write some information about this to the passed stream.
[out] | stream | the stream to write to. |
Reimplemented from lama::Vector.
void lama::DenseVector< T >::writeToFile | ( | const std::string & | fileBaseName, |
const File::FileType | fileType = File::XDR , |
||
const File::DataType | dataType = File::DOUBLE |
||
) | const |
References lama::File::BINARY, lama::File::FORMATTED, lama::File::MATRIX_MARKET, and lama::File::XDR.
void lama::DenseVector< T >::writeVectorDataToBinaryFile | ( | std::fstream & | outFile, |
const long | dataTypeSize | ||
) | const [private] |
References lama::ReadAccess< T >::get(), and LAMA_THROWEXCEPTION.
void lama::DenseVector< T >::writeVectorHeader | ( | const std::string & | fileName, |
const File::FileType & | fileType, | ||
const long | dataTypeSize | ||
) | const [private] |
void lama::DenseVector< T >::writeVectorToBinaryFile | ( | const std::string & | fileName, |
const long | outputDataTypeSize | ||
) | const [private] |
void lama::DenseVector< T >::writeVectorToFormattedFile | ( | const std::string & | fileName | ) | const [private] |
void lama::DenseVector< T >::writeVectorToMMFile | ( | const std::string & | filename, |
const File::DataType & | dataType | ||
) | const [private] |
void lama::DenseVector< T >::writeVectorToXDRFile | ( | const std::string & | fileName, |
const long | outputDataTypeSize | ||
) | const [private] |
References lama::ReadAccess< T >::get().
ContextPtr lama::Vector::mContext [protected, inherited] |
decides about location of vector operations
Referenced by lama::Vector::getContext(), lama::Vector::setContext(), lama::Vector::swapVector(), and lama::Vector::Vector().
LAMAArray<T> lama::DenseVector< T >::mHaloValues [mutable, private] |
my halo values of vector
Referenced by lama::DenseVector< T >::swap().
LAMAArray<T> lama::DenseVector< T >::mLocalValues [private] |
my local values of vector
Referenced by lama::DenseVector< T >::assign(), lama::DenseVector< T >::DenseVector(), lama::DenseVector< T >::dotProduct(), and lama::DenseVector< T >::swap().