Go to the documentation of this file.
7 #ifndef __IPDENSEVECTOR_HPP__
8 #define __IPDENSEVECTOR_HPP__
18 class DenseVectorSpace;
84 inline const Number* Values()
const;
90 const Number* ExpandedValues()
const;
142 virtual void CopyImpl(
146 virtual void ScalImpl(
150 virtual void AxpyImpl(
159 virtual Number Nrm2Impl()
const;
161 virtual Number AsumImpl()
const;
163 virtual Number AmaxImpl()
const;
165 virtual void SetImpl(
169 virtual void ElementWiseDivideImpl(
173 virtual void ElementWiseMultiplyImpl(
177 virtual void ElementWiseMaxImpl(
181 virtual void ElementWiseMinImpl(
185 virtual void ElementWiseReciprocalImpl();
187 virtual void ElementWiseAbsImpl();
189 virtual void ElementWiseSqrtImpl();
191 virtual void ElementWiseSgnImpl();
193 virtual void AddScalarImpl(
197 virtual Number MaxImpl()
const;
199 virtual Number MinImpl()
const;
201 virtual Number SumImpl()
const;
203 virtual Number SumLogsImpl()
const;
212 void AddTwoVectorsImpl(
227 void AddVectorQuotientImpl(
241 const std::string& name,
243 const std::string& prefix
246 PrintImplOffset(jnlst, level, category, name, indent, prefix, 1);
250 void PrintImplOffset(
254 const std::string& name,
256 const std::string& prefix,
261 friend class ParVector;
296 inline Number* values_allocated();
318 void set_values_from_scalar();
354 return MakeNewDenseVector();
364 inline Number* AllocateInternalStorage()
const;
367 inline void FreeInternalStorage(
377 bool HasStringMetaData(
378 const std::string tag
383 bool HasIntegerMetaData(
384 const std::string tag
389 bool HasNumericMetaData(
390 const std::string tag
394 inline const std::vector<std::string>& GetStringMetaData(
395 const std::string& tag
399 inline const std::vector<Index>& GetIntegerMetaData(
400 const std::string& tag
404 inline const std::vector<Number>& GetNumericMetaData(
405 const std::string& tag
409 inline void SetStringMetaData(
411 std::vector<std::string> meta_data
415 inline void SetIntegerMetaData(
417 std::vector<Index> meta_data
421 inline void SetNumericMetaData(
423 std::vector<Number> meta_data
504 const std::string tag
507 StringMetaDataMapType::const_iterator iter;
520 const std::string tag
523 IntegerMetaDataMapType::const_iterator iter;
536 const std::string tag
539 NumericMetaDataMapType::const_iterator iter;
551 const std::string& tag
555 StringMetaDataMapType::const_iterator iter;
561 const std::string& tag
565 IntegerMetaDataMapType::const_iterator iter;
571 const std::string& tag
575 NumericMetaDataMapType::const_iterator iter;
582 std::vector<std::string> meta_data
590 std::vector<Index> meta_data
598 std::vector<Number> meta_data
Number * values_
Dense Number array of vector values.
const NumericMetaDataMapType & GetNumericMetaData() const
Get map of meta data of type Number.
void set_values_from_scalar()
Auxiliary method for setting explicitly all elements in values_ to the current scalar value.
virtual void PrintImpl(const Journalist &jnlst, EJournalLevel level, EJournalCategory category, const std::string &name, Index indent, const std::string &prefix) const
Print the entire vector.
DenseVector * MakeNewDenseVector() const
Method for creating a new vector of this specific type.
This file contains a base class for all exceptions and a set of macros to help with exceptions.
double Number
Type of all numbers.
std::map< std::string, std::vector< Number > > NumericMetaDataMapType
bool HasNumericMetaData(const std::string tag) const
Check if Numeric meta exists for tag.
void ObjectChanged()
Objects derived from TaggedObject MUST call this method every time their internal state changes to up...
void SetNumericMetaData(std::string tag, std::vector< Number > meta_data)
Set meta data of type Number by tag.
EJournalLevel
Print Level Enum.
const StringMetaDataMapType & GetStringMetaData() const
Get map of meta data of type Number.
NumericMetaDataMapType numeric_meta_data_
DenseVectorSpace(Index dim)
Constructor, requires dimension of all vector for this VectorSpace.
This vectors space is the vector space for DenseVector.
int Index
Type of all indices of vectors, matrices etc.
void FreeInternalStorage(Number *values) const
Deallocate internal storage for the DenseVector.
const IntegerMetaDataMapType & GetIntegerMetaData() const
Get map of meta data of type Number.
bool IsHomogeneous() const
Indicates if the vector is homogeneous (i.e., all entries have the value Scalar().
~DenseVectorSpace()
Destructor.
Number * expanded_values_
Dense Number array pointer that is used for ExpandedValues.
std::map< std::string, std::vector< Index > > IntegerMetaDataMapType
Template class for Smart Pointers.
EJournalCategory
Category Selection Enum.
const DenseVectorSpace * owner_space_
Copy of the owner_space ptr as a DenseVectorSpace instead of a VectorSpace.
void SetIntegerMetaData(std::string tag, std::vector< Index > meta_data)
Set meta data of type Index by tag.
bool HasIntegerMetaData(const std::string tag) const
Check if Integer meta exists for tag.
Number scalar_
Homogeneous value of all elements if the vector is currently homogeneous.
bool initialized_
Flag for Initialization.
Class responsible for all message output.
Number * Values()
Obtain pointer to the internal Number array with vector elements with the intention to change the vec...
Number * values_allocated()
Get the internal values array, making sure that memory has been allocated.
IntegerMetaDataMapType integer_meta_data_
bool homogeneous_
Flag indicating whether the vector is currently homogeneous (that is, all elements have the same valu...
VectorSpace base class, corresponding to the Vector base class.
std::map< std::string, std::vector< std::string > > StringMetaDataMapType
Number * ExpandedValues()
This is the same as Values, but we add it here so that ExpandedValues can also be used for the non-co...
Dense Vector Implementation.
virtual Vector * MakeNew() const
Pure virtual method for creating a new Vector of the corresponding type.
Number * AllocateInternalStorage() const
Allocate internal storage for the DenseVector.
bool HasStringMetaData(const std::string tag) const
Check if string meta exists for tag.
Index Dim() const
Dimension of the Vector.
SmartPtr< DenseVector > MakeNewDenseVector() const
Create a new DenseVector from same VectorSpace.
DECLARE_STD_EXCEPTION(FATAL_ERROR_IN_LINEAR_SOLVER)
Number Scalar() const
Scalar value of all entries in a homogeneous vector.
StringMetaDataMapType string_meta_data_
Index Dim() const
Accessor function for the dimension of the vectors of this type.
void SetStringMetaData(std::string tag, std::vector< std::string > meta_data)
Set meta data of type std::string by tag.