NOX Development
Loading...
Searching...
No Matches
Public Member Functions | List of all members
NOX::Direction::Broyden::BroydenMemory Class Reference

Utility class for NOX::Direction::Broyden method to manage the information stored in "limited" memory. More...

#include <NOX_Direction_Broyden.H>

Public Member Functions

 BroydenMemory ()
 Constructor.
 
 ~BroydenMemory ()
 Destructor.
 
void reset (int m)
 Reset the memory.
 
void reset ()
 Reset the memory.
 
void push (const NOX::Abstract::Vector &d)
 Add new information to the memory.
 
bool empty () const
 Returns true if the memory is empty.
 
int size () const
 Number of items in memory.
 
BroydenMemoryUnitoperator[] (int i)
 Return the ith MemoryUnit (unchecked access)
 

Detailed Description

Utility class for NOX::Direction::Broyden method to manage the information stored in "limited" memory.

Store up to $m$ MemoryUnit objects where $m$ is passed to reset(). Every time push() is called, a new MemoryUnit is added. If there are already $m$ MemoryUnit's, the oldest is bumped off the list. The zero-th entry is always the oldest.

Note
In order to avoid allocating and deallocating memory, we reuse the BroydenMemoryUnit objects rather than destroying and re-constructing them. However, this detail should be transparent to users of this class.

Constructor & Destructor Documentation

◆ BroydenMemory()

NOX::Direction::Broyden::BroydenMemory::BroydenMemory ( )

Constructor.

Does nothing.

◆ ~BroydenMemory()

NOX::Direction::Broyden::BroydenMemory::~BroydenMemory ( )

Destructor.

Does nothing.

Member Function Documentation

◆ operator[]()

NOX::Direction::Broyden::BroydenMemoryUnit & NOX::Direction::Broyden::BroydenMemory::operator[] ( int i)

Return the ith MemoryUnit (unchecked access)

The zero entry is the oldest memory. The m-1 entry is the newest entry (where m denotes the memory size).

◆ push()

void NOX::Direction::Broyden::BroydenMemory::push ( const NOX::Abstract::Vector & d)

Add new information to the memory.

We need to calculate where the new udpate should be stored in memory and update the information in index.

Let k denote the index of where the new update should be stored. If there are current m items stored in memory and m < mMax, then we set k = m. Otherwise, we set k equal to the location of the oldest update. The oldest update is deleted to make room for the new update. In both cases, index must be updated appropriately so that the first (zero) entry points to the oldest update and the last entry points to the newest update.

References reset(), and size().

◆ reset() [1/2]

void NOX::Direction::Broyden::BroydenMemory::reset ( )

Reset the memory.

Sets the size of the index vector to be zero.

◆ reset() [2/2]

void NOX::Direction::Broyden::BroydenMemory::reset ( int m)

Reset the memory.

Sets mMax to the value of m. Sets the size of the memory vector to be at least mMax. Sets the capacity of the index vector to be at least mMax. Sets the size of the index vector to be zero.

References size().

Referenced by push().


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