7 #ifndef __IPDENSEVECTOR_HPP__ 8 #define __IPDENSEVECTOR_HPP__ 18 class DenseVectorSpace;
84 inline const Number* Values()
const;
90 const Number* ExpandedValues()
const;
141 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 ElementWiseSelectImpl(
181 virtual void ElementWiseMaxImpl(
185 virtual void ElementWiseMinImpl(
189 virtual void ElementWiseReciprocalImpl();
191 virtual void ElementWiseAbsImpl();
193 virtual void ElementWiseSqrtImpl();
195 virtual void ElementWiseSgnImpl();
197 virtual void AddScalarImpl(
201 virtual Number MaxImpl()
const;
203 virtual Number MinImpl()
const;
205 virtual Number SumImpl()
const;
207 virtual Number SumLogsImpl()
const;
216 void AddTwoVectorsImpl(
231 void AddVectorQuotientImpl(
240 virtual void PrintImpl(
245 const std::string& name,
247 const std::string& prefix
250 PrintImplOffset(jnlst, level, category, name, indent, prefix, 1);
254 void PrintImplOffset(
255 const Journalist& jnlst,
258 const std::string& name,
260 const std::string& prefix,
265 friend class ParVector;
300 inline Number* values_allocated();
322 void set_values_from_scalar();
358 return MakeNewDenseVector();
368 inline Number* AllocateInternalStorage()
const;
371 inline void FreeInternalStorage(
381 bool HasStringMetaData(
382 const std::string& tag
387 bool HasIntegerMetaData(
388 const std::string& tag
393 bool HasNumericMetaData(
394 const std::string& tag
398 inline const std::vector<std::string>& GetStringMetaData(
399 const std::string& tag
403 inline const std::vector<Index>& GetIntegerMetaData(
404 const std::string& tag
408 inline const std::vector<Number>& GetNumericMetaData(
409 const std::string& tag
413 inline void SetStringMetaData(
414 const std::string& tag,
415 const std::vector<std::string>& meta_data
419 inline void SetIntegerMetaData(
420 const std::string& tag,
421 const std::vector<Index>& meta_data
425 inline void SetNumericMetaData(
426 const std::string& tag,
427 const std::vector<Number>& meta_data
510 const std::string& tag
513 StringMetaDataMapType::const_iterator iter;
526 const std::string& tag
529 IntegerMetaDataMapType::const_iterator iter;
542 const std::string& tag
545 NumericMetaDataMapType::const_iterator iter;
557 const std::string& tag
561 StringMetaDataMapType::const_iterator iter;
567 const std::string& tag
571 IntegerMetaDataMapType::const_iterator iter;
577 const std::string& tag
581 NumericMetaDataMapType::const_iterator iter;
587 const std::string& tag,
588 const std::vector<std::string>& meta_data
595 const std::string& tag,
596 const std::vector<Index>& meta_data
603 const std::string& tag,
604 const std::vector<Number>& meta_data
bool initialized_
Flag for Initialization.
std::map< std::string, std::vector< Number > > NumericMetaDataMapType
bool HasIntegerMetaData(const std::string &tag) const
Check if Integer meta exists for tag.
void set_values_from_scalar()
Auxiliary method for setting explicitly all elements in values_ to the current scalar value...
void SetIntegerMetaData(const std::string &tag, const std::vector< Index > &meta_data)
Set meta data of type Index by tag.
Number Scalar() const
Scalar value of all entries in a homogeneous vector.
DECLARE_STD_EXCEPTION(FATAL_ERROR_IN_LINEAR_SOLVER)
void ObjectChanged()
Objects derived from TaggedObject MUST call this method every time their internal state changes to up...
std::map< std::string, std::vector< Index > > IntegerMetaDataMapType
bool HasNumericMetaData(const std::string &tag) const
Check if Numeric meta exists for tag.
Dense Vector Implementation.
bool HasStringMetaData(const std::string &tag) const
Check if string meta exists for tag.
EJournalLevel
Print Level Enum.
void SetStringMetaData(const std::string &tag, const std::vector< std::string > &meta_data)
Set meta data of type std::string by tag.
bool homogeneous_
Flag indicating whether the vector is currently homogeneous (that is, all elements have the same valu...
This vectors space is the vector space for DenseVector.
StringMetaDataMapType string_meta_data_
ipindex Index
Type of all indices of vectors, matrices etc.
bool IsHomogeneous() const
Indicates if the vector is homogeneous (i.e., all entries have the value Scalar().
This file contains a base class for all exceptions and a set of macros to help with exceptions...
~DenseVectorSpace()
Destructor.
void SetNumericMetaData(const std::string &tag, const std::vector< Number > &meta_data)
Set meta data of type Number by tag.
Template class for Smart Pointers.
Number * values_
Dense Number array of vector values.
VectorSpace base class, corresponding to the Vector base class.
NumericMetaDataMapType numeric_meta_data_
SmartPtr< DenseVector > MakeNewDenseVector() const
Create a new DenseVector from same VectorSpace.
DenseVectorSpace(Index dim)
Constructor, requires dimension of all vector for this VectorSpace.
void FreeInternalStorage(Number *values) const
Deallocate internal storage for the DenseVector.
ipnumber Number
Type of all numbers.
const DenseVectorSpace * owner_space_
Copy of the owner_space ptr as a DenseVectorSpace instead of a VectorSpace.
Number * values_allocated()
Get the internal values array, making sure that memory has been allocated.
Index Dim() const
Dimension of the Vector.
Number * ExpandedValues()
This is the same as Values, but we add it here so that ExpandedValues can also be used for the non-co...
Class responsible for all message output.
const NumericMetaDataMapType & GetNumericMetaData() const
Get map of meta data of type Number.
virtual Vector * MakeNew() const
Pure virtual method for creating a new Vector of the corresponding type.
DenseVector * MakeNewDenseVector() const
Method for creating a new vector of this specific type.
Number * AllocateInternalStorage() const
Allocate internal storage for the DenseVector.
Index Dim() const
Accessor function for the dimension of the vectors of this type.
Number scalar_
Homogeneous value of all elements if the vector is currently homogeneous.
Number * expanded_values_
Dense Number array pointer that is used for ExpandedValues.
EJournalCategory
Category Selection Enum.
IntegerMetaDataMapType integer_meta_data_
std::map< std::string, std::vector< std::string > > StringMetaDataMapType
Number * Values()
Obtain pointer to the internal Number array with vector elements with the intention to change the vec...
const StringMetaDataMapType & GetStringMetaData() const
Get map of meta data of type Number.
const IntegerMetaDataMapType & GetIntegerMetaData() const
Get map of meta data of type Number.