- Main Page
- Namespaces
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Ipopt::DenseVector Class Reference

Dense Vector Implementation. More...

`#include <IpDenseVector.hpp>`

Inheritance diagram for Ipopt::DenseVector:

[legend]
Collaboration diagram for Ipopt::DenseVector:

[legend]
List of all members.

## Public Member Functions
Constructors / Destructors
| DenseVector (const DenseVectorSpace *owner_space)
| Default Constructor.
virtual | ~DenseVector ()
| Destructor.
Additional public methods not in Vector base class.
SmartPtr< DenseVector > | MakeNewDenseVector () const
| Create a new DenseVector from same VectorSpace.
void | SetValues (const Number *x)
| Set elements in the vector to the Number array x.
Number * | Values ()
| Obtain pointer to the internal Number array with vector elements with the indention to change the vector data (USE WITH CARE!).
const Number * | Values () const
| Obtain pointer to the internal Number array with vector elements without the intention to change the vector data (USE WITH CARE!).
bool | IsHomogeneous () const
| Indicates if the vector is homogeneous (i.e., all entries have the value Scalar().
Number | Scalar () const
| Scalar value of all entries in a homogeneous vector.
Modifying subranges of the vector.
void | CopyToPos (Index Pos, const Vector &x)
| Copy the data in x into the subrange of this vector starting at position Pos in this vector.
void | CopyFromPos (Index Pos, Vector &x) const
| Copy the data in this vector's subrange starting at position Pos to Vector x.
## Protected Member Functions
Overloaded methods from Vector base class
virtual void | CopyImpl (const Vector &x)
| Copy the data of the vector x into this vector (DCOPY).
virtual void | ScalImpl (Number alpha)
| Scales the vector by scalar alpha (DSCAL).
virtual void | AxpyImpl (Number alpha, const Vector &x)
| Add the multiple alpha of vector x to this vector (DAXPY).
virtual Number | DotImpl (const Vector &x) const
| Computes inner product of vector x with this (DDOT).
virtual Number | Nrm2Impl () const
| Computes the 2-norm of this vector (DNRM2).
virtual Number | AsumImpl () const
| Computes the 1-norm of this vector (DASUM).
virtual Number | AmaxImpl () const
| Computes the max-norm of this vector (based on IDAMAX).
virtual void | SetImpl (Number value)
| Set each element in the vector to the scalar alpha.
virtual void | ElementWiseDivideImpl (const Vector &x)
| Element-wise division .
virtual void | ElementWiseMultiplyImpl (const Vector &x)
| Element-wise multiplication .
virtual void | ElementWiseMaxImpl (const Vector &x)
| Set entry to max of itself and the corresponding element in x.
virtual void | ElementWiseMinImpl (const Vector &x)
| Set entry to min of itself and the corresponding element in x.
virtual void | ElementWiseReciprocalImpl ()
| reciprocates the elements of the vector
virtual void | ElementWiseAbsImpl ()
| take abs of the elements of the vector
virtual void | ElementWiseSqrtImpl ()
| take square-root of the elements of the vector
virtual void | ElementWiseSgnImpl ()
| Changes each entry in the vector to its sgn value.
virtual void | AddScalarImpl (Number scalar)
| Add scalar to every component of the vector.
virtual Number | MaxImpl () const
| Max value in the vector.
virtual Number | MinImpl () const
| Min value in the vector.
virtual Number | SumImpl () const
| Computes the sum of the lements of vector.
virtual Number | SumLogsImpl () const
| Computes the sum of the logs of the elements of vector.
Implemented specialized functions
void | AddTwoVectorsImpl (Number a, const Vector &v1, Number b, const Vector &v2, Number c)
| Add two vectors (a * v1 + b * v2).
Number | FracToBoundImpl (const Vector &delta, Number tau) const
| Fraction to the boundary parameter.
void | AddVectorQuotientImpl (Number a, const Vector &z, const Vector &s, Number c)
| Add the quotient of two vectors, y = a * z/s + c * y.
Output methods
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.
## Private Member Functions
Number * | values_allocated ()
| Method of getting the internal values array, making sure that memory has been allocated.
void | set_values_from_scalar ()
| Auxilliary method for setting explicitly all elements in values_ to the current scalar value.
Default Compiler Generated Methods
(Hidden to avoid implicit creation/calling). These methods are not implemented and we do not want the compiler to implement them for us, so we declare them private and do not define them. This ensures that they will not be implicitly created/called.
| DenseVector ()
| Default Constructor.
| DenseVector (const DenseVector &)
| Copy Constructor.
void | operator= (const DenseVector &)
| Overloaded Equals Operator.
## Private Attributes
const DenseVectorSpace * | owner_space_
| Copy of the owner_space ptr as a DenseVectorSpace instead of a VectorSpace.
Number * | values_
| Dense Number array of vector values.
bool | initialized_
| Flag for Initialization.
bool | homogeneous_
| Flag indicating whether the vector is currently homogeneous (that is, all elements have the same value).
Number | scalar_
| Homogeneous value of all elements if the vector is currently homogenous.

## Detailed Description

Dense Vector Implementation.

Definition at line 23 of file IpDenseVector.hpp.

## Constructor & Destructor Documentation

Ipopt::DenseVector::DenseVector | ( | const DenseVectorSpace * | owner_space | ) |

Default Constructor.

virtual Ipopt::DenseVector::~DenseVector | ( |  | ) | `[virtual]`

Destructor.

Ipopt::DenseVector::DenseVector | ( |  | ) | `[private]`

Default Constructor.

Ipopt::DenseVector::DenseVector | ( | const DenseVector & |  | ) | `[private]`

Copy Constructor.

## Member Function Documentation

SmartPtr< DenseVector > Ipopt::DenseVector::MakeNewDenseVector | ( |  | ) | const`[inline]`

Create a new DenseVector from same VectorSpace.

Definition at line 324 of file IpDenseVector.hpp.

References Ipopt::DenseVectorSpace::MakeNewDenseVector(), and owner_space_.

void Ipopt::DenseVector::SetValues | ( | const Number * | x | ) |

Set elements in the vector to the Number array x.

Number * Ipopt::DenseVector::Values | ( |  | ) | `[inline]`

Obtain pointer to the internal Number array with vector elements with the indention to change the vector data (USE WITH CARE!).

This does not produce a copy, and lifetime is not guaranteed!

Definition at line 275 of file IpDenseVector.hpp.

References homogeneous_, initialized_, Ipopt::TaggedObject::ObjectChanged(), set_values_from_scalar(), and values_allocated().

const Number * Ipopt::DenseVector::Values | ( |  | ) | const`[inline]`

Obtain pointer to the internal Number array with vector elements without the intention to change the vector data (USE WITH CARE!).

This does not produce a copy, and lifetime is not guaranteed!

Definition at line 292 of file IpDenseVector.hpp.

References DBG_ASSERT, Ipopt::Vector::Dim(), initialized_, and values_.

bool Ipopt::DenseVector::IsHomogeneous | ( |  | ) | const`[inline]`

Indicates if the vector is homogeneous (i.e., all entries have the value Scalar().

Definition at line 62 of file IpDenseVector.hpp.

References homogeneous_.

Number Ipopt::DenseVector::Scalar | ( |  | ) | const`[inline]`

Scalar value of all entries in a homogeneous vector.

Definition at line 68 of file IpDenseVector.hpp.

References DBG_ASSERT, homogeneous_, and scalar_.

void Ipopt::DenseVector::CopyToPos | ( | Index | Pos,
|  | const Vector & | x |
| ) |  |  |

Copy the data in x into the subrange of this vector starting at position Pos in this vector.

Position count starts at 0.

void Ipopt::DenseVector::CopyFromPos | ( | Index | Pos,
|  | Vector & | x |
| ) |  |  | const

Copy the data in this vector's subrange starting at position Pos to Vector x.

Position count starts at 0.

virtual void Ipopt::DenseVector::CopyImpl | ( | const Vector & | x | ) | `[protected, virtual]`

Copy the data of the vector x into this vector (DCOPY).

Implements Ipopt::Vector.

virtual void Ipopt::DenseVector::ScalImpl | ( | Number | alpha | ) | `[protected, virtual]`

Scales the vector by scalar alpha (DSCAL).

Implements Ipopt::Vector.

virtual void Ipopt::DenseVector::AxpyImpl | ( | Number | alpha,
|  | const Vector & | x |
| ) |  |  | `[protected, virtual]`

Add the multiple alpha of vector x to this vector (DAXPY).

Implements Ipopt::Vector.

virtual Number Ipopt::DenseVector::DotImpl | ( | const Vector & | x | ) | const`[protected, virtual]`

Computes inner product of vector x with this (DDOT).

Implements Ipopt::Vector.

virtual Number Ipopt::DenseVector::Nrm2Impl | ( |  | ) | const`[protected, virtual]`

Computes the 2-norm of this vector (DNRM2).

Implements Ipopt::Vector.

virtual Number Ipopt::DenseVector::AsumImpl | ( |  | ) | const`[protected, virtual]`

Computes the 1-norm of this vector (DASUM).

Implements Ipopt::Vector.

virtual Number Ipopt::DenseVector::AmaxImpl | ( |  | ) | const`[protected, virtual]`

Computes the max-norm of this vector (based on IDAMAX).

Implements Ipopt::Vector.

virtual void Ipopt::DenseVector::SetImpl | ( | Number | value | ) | `[protected, virtual]`

Set each element in the vector to the scalar alpha.

Implements Ipopt::Vector.

virtual void Ipopt::DenseVector::ElementWiseDivideImpl | ( | const Vector & | x | ) | `[protected, virtual]`

Element-wise division .

Implements Ipopt::Vector.

virtual void Ipopt::DenseVector::ElementWiseMultiplyImpl | ( | const Vector & | x | ) | `[protected, virtual]`

Element-wise multiplication .

Implements Ipopt::Vector.

virtual void Ipopt::DenseVector::ElementWiseMaxImpl | ( | const Vector & | x | ) | `[protected, virtual]`

Set entry to max of itself and the corresponding element in x.

Implements Ipopt::Vector.

virtual void Ipopt::DenseVector::ElementWiseMinImpl | ( | const Vector & | x | ) | `[protected, virtual]`

Set entry to min of itself and the corresponding element in x.

Implements Ipopt::Vector.

virtual void Ipopt::DenseVector::ElementWiseReciprocalImpl | ( |  | ) | `[protected, virtual]`

reciprocates the elements of the vector

Implements Ipopt::Vector.

virtual void Ipopt::DenseVector::ElementWiseAbsImpl | ( |  | ) | `[protected, virtual]`

take abs of the elements of the vector

Implements Ipopt::Vector.

virtual void Ipopt::DenseVector::ElementWiseSqrtImpl | ( |  | ) | `[protected, virtual]`

take square-root of the elements of the vector

Implements Ipopt::Vector.

virtual void Ipopt::DenseVector::ElementWiseSgnImpl | ( |  | ) | `[protected, virtual]`

Changes each entry in the vector to its sgn value.

Implements Ipopt::Vector.

virtual void Ipopt::DenseVector::AddScalarImpl | ( | Number | scalar | ) | `[protected, virtual]`

Add scalar to every component of the vector.

Implements Ipopt::Vector.

virtual Number Ipopt::DenseVector::MaxImpl | ( |  | ) | const`[protected, virtual]`

Max value in the vector.

Implements Ipopt::Vector.

virtual Number Ipopt::DenseVector::MinImpl | ( |  | ) | const`[protected, virtual]`

Min value in the vector.

Implements Ipopt::Vector.

virtual Number Ipopt::DenseVector::SumImpl | ( |  | ) | const`[protected, virtual]`

Computes the sum of the lements of vector.

Implements Ipopt::Vector.

virtual Number Ipopt::DenseVector::SumLogsImpl | ( |  | ) | const`[protected, virtual]`

Computes the sum of the logs of the elements of vector.

Implements Ipopt::Vector.

void Ipopt::DenseVector::AddTwoVectorsImpl | ( | Number | a,
|  | const Vector & | v1,
|  | Number | b,
|  | const Vector & | v2,
|  | Number | c |
| ) |  |  | `[protected, virtual]`

Add two vectors (a * v1 + b * v2).

Result is stored in this vector.

Reimplemented from Ipopt::Vector.

Number Ipopt::DenseVector::FracToBoundImpl | ( | const Vector & | delta,
|  | Number | tau |
| ) |  |  | const`[protected, virtual]`

Fraction to the boundary parameter.

Reimplemented from Ipopt::Vector.

void Ipopt::DenseVector::AddVectorQuotientImpl | ( | Number | a,
|  | const Vector & | z,
|  | const Vector & | s,
|  | Number | c |
| ) |  |  | `[protected, virtual]`

Add the quotient of two vectors, y = a * z/s + c * y.

Reimplemented from Ipopt::Vector.

virtual void Ipopt::DenseVector::PrintImpl | ( | const Journalist & | jnlst,
|  | EJournalLevel | level,
|  | EJournalCategory | category,
|  | const std::string & | name,
|  | Index | indent,
|  | const std::string & | prefix |
| ) |  |  | const`[protected, virtual]`

Print the entire vector.

Implements Ipopt::Vector.

void Ipopt::DenseVector::operator= | ( | const DenseVector & |  | ) | `[private]`

Overloaded Equals Operator.

Number * Ipopt::DenseVector::values_allocated | ( |  | ) | `[inline, private]`

Method of getting the internal values array, making sure that memory has been allocated.

Definition at line 298 of file IpDenseVector.hpp.

References Ipopt::DenseVectorSpace::AllocateInternalStorage(), owner_space_, and values_.

Referenced by Values().

void Ipopt::DenseVector::set_values_from_scalar | ( |  | ) | `[private]`

Auxilliary method for setting explicitly all elements in values_ to the current scalar value.

Referenced by Values().

## Member Data Documentation

const DenseVectorSpace* Ipopt::DenseVector::owner_space_`[private]`

Copy of the owner_space ptr as a DenseVectorSpace instead of a VectorSpace.

Reimplemented from Ipopt::Vector.

Definition at line 199 of file IpDenseVector.hpp.

Referenced by MakeNewDenseVector(), and values_allocated().

Number* Ipopt::DenseVector::values_`[private]`

Dense Number array of vector values.

Definition at line 202 of file IpDenseVector.hpp.

Referenced by Values(), and values_allocated().

bool Ipopt::DenseVector::initialized_`[private]`

Flag for Initialization.

This flag is false, if the data has not yet been initialized.

Definition at line 210 of file IpDenseVector.hpp.

Referenced by Values().

bool Ipopt::DenseVector::homogeneous_`[private]`

Flag indicating whether the vector is currently homogeneous (that is, all elements have the same value).

This flag is used to determine whether the elements of the vector are stored in values_ or in scalar_

Definition at line 216 of file IpDenseVector.hpp.

Referenced by IsHomogeneous(), Scalar(), and Values().

Number Ipopt::DenseVector::scalar_`[private]`

Homogeneous value of all elements if the vector is currently homogenous.

Definition at line 220 of file IpDenseVector.hpp.

Referenced by Scalar().

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

- /home/coin/SVN-release/Ipopt-3.2.1/Ipopt/src/LinAlg/IpDenseVector.hpp