NOX
Development
|
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. More... | |
~BroydenMemory () | |
Destructor. More... | |
void | reset (int m) |
Reset the memory. More... | |
void | reset () |
Reset the memory. More... | |
void | push (const NOX::Abstract::Vector &d) |
Add new information to the memory. More... | |
bool | empty () const |
Returns true if the memory is empty. | |
int | size () const |
Number of items in memory. | |
BroydenMemoryUnit & | operator[] (int i) |
Return the ith MemoryUnit (unchecked access) More... | |
Utility class for NOX::Direction::Broyden method to manage the information stored in "limited" memory.
Store up to MemoryUnit objects where is passed to reset(). Every time push() is called, a new MemoryUnit is added. If there are already MemoryUnit's, the oldest is bumped off the list. The zero-th entry is always the oldest.
NOX::Direction::Broyden::BroydenMemory::BroydenMemory | ( | ) |
Constructor.
Does nothing.
NOX::Direction::Broyden::BroydenMemory::~BroydenMemory | ( | ) |
Destructor.
Does nothing.
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).
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().
void NOX::Direction::Broyden::BroydenMemory::reset | ( | int | m | ) |
void NOX::Direction::Broyden::BroydenMemory::reset | ( | ) |
Reset the memory.
Sets the size of the #index vector to be zero.