#include <QuadraticProgram.h>

Classes | |
| struct | tCacheEntry |
Public Member Functions | |
| CachedMatrix (QPMatrix *base, unsigned int cachesize=0x4000000) | |
| Constructor. | |
| ~CachedMatrix () | |
| Destructor. | |
| float * | Row (unsigned int k, unsigned int begin, unsigned int end, bool temp=false) |
| Return a subset of a matrix row. | |
| float | Entry (unsigned int i, unsigned int j) |
| overriden virtual function | |
| void | FlipColumnsAndRows (unsigned int i, unsigned int j) |
| Exchange the rows i and j and the columns i and j. | |
| unsigned int | getMaxCacheSize () const |
| unsigned int | getCacheSize () const |
| unsigned int | getCacheRowSize (unsigned int k) |
| void | Clear () |
| void | CacheRowResize (unsigned int k, unsigned int newsize) |
| void | CacheRowRelease (unsigned int k) |
Protected Member Functions | |
| void | cacheAppend (int var) |
| append the entry to the ordered list | |
| void | cacheRemove (int var) |
| remove the entry from the ordered list | |
| void | cacheAdd (int var, unsigned int length) |
| add an entry to the cache and append it to the ordered list | |
| void | cacheDelete (int var) |
| remove an entry from the cache and the ordered list | |
| void | cacheResize (int var, unsigned int newlength) |
| resize a cache entry | |
| void | cacheClear () |
| completely clear the cache | |
Protected Attributes | |
| QPMatrix * | baseMatrix |
| matrix to be cached | |
| unsigned int | cacheSize |
| unsigned int | cacheMaxSize |
| std::vector< tCacheEntry > | cacheEntry |
| std::vector< float > | cacheTemp |
| int | cacheNewest |
| int | cacheOldest |
Definition at line 289 of file QuadraticProgram.h.
| CachedMatrix::CachedMatrix | ( | QPMatrix * | base, | |
| unsigned int | cachesize = 0x4000000 | |||
| ) |
Constructor.
| base | Matrix to cache | |
| cachesize | Main memory to use as a kernel cache, in floats. Default is 256MB |
Definition at line 242 of file QuadraticProgram.cpp.
References baseMatrix, cacheEntry, cacheMaxSize, cacheNewest, cacheOldest, cacheSize, i, and QPMatrix::matrixsize.
| CachedMatrix::~CachedMatrix | ( | ) |
| void CachedMatrix::cacheAdd | ( | int | var, | |
| unsigned int | length | |||
| ) | [protected] |
add an entry to the cache and append it to the ordered list
Definition at line 425 of file QuadraticProgram.cpp.
References cacheAppend(), cacheEntry, and cacheSize.
Referenced by CacheRowResize(), and Row().
| void CachedMatrix::cacheAppend | ( | int | var | ) | [protected] |
append the entry to the ordered list
Definition at line 391 of file QuadraticProgram.cpp.
References cacheEntry, cacheNewest, and cacheOldest.
Referenced by cacheAdd(), and Row().
| void CachedMatrix::cacheClear | ( | ) | [protected] |
completely clear the cache
Definition at line 456 of file QuadraticProgram.cpp.
References cacheEntry, cacheNewest, cacheOldest, and cacheSize.
Referenced by Clear(), and ~CachedMatrix().
| void CachedMatrix::cacheDelete | ( | int | var | ) | [protected] |
remove an entry from the cache and the ordered list
Definition at line 435 of file QuadraticProgram.cpp.
References cacheEntry, cacheRemove(), and cacheSize.
Referenced by CacheRowRelease(), and Row().
| void CachedMatrix::cacheRemove | ( | int | var | ) | [protected] |
remove the entry from the ordered list
Definition at line 409 of file QuadraticProgram.cpp.
References cacheEntry, cacheNewest, and cacheOldest.
Referenced by cacheDelete(), and Row().
| void CachedMatrix::cacheResize | ( | int | var, | |
| unsigned int | newlength | |||
| ) | [protected] |
resize a cache entry
Definition at line 446 of file QuadraticProgram.cpp.
References cacheEntry, and cacheSize.
Referenced by CacheRowResize(), and Row().
| void CachedMatrix::CacheRowRelease | ( | unsigned int | k | ) |
Definition at line 386 of file QuadraticProgram.cpp.
References cacheDelete(), and cacheEntry.
Referenced by QpCrammerSingerDecomp::DeactivateExample(), QpBoxAllInOneDecomp::DeactivateExample(), QpBoxDecomp::Shrink(), and QpSvmDecomp::Shrink().
| void CachedMatrix::CacheRowResize | ( | unsigned int | k, | |
| unsigned int | newsize | |||
| ) |
Definition at line 380 of file QuadraticProgram.cpp.
References cacheAdd(), cacheEntry, and cacheResize().
Referenced by QpCrammerSingerDecomp::Shrink(), QpBoxAllInOneDecomp::Shrink(), QpBoxDecomp::Shrink(), and QpSvmDecomp::Shrink().
| void CachedMatrix::Clear | ( | ) | [inline] |
| float CachedMatrix::Entry | ( | unsigned int | i, | |
| unsigned int | j | |||
| ) | [virtual] |
overriden virtual function
Implements QPMatrix.
Definition at line 329 of file QuadraticProgram.cpp.
References baseMatrix, and QPMatrix::Entry().
Referenced by QpSvmDecomp::ComputeInnerProduct(), QpBoxDecomp::QpBoxDecomp(), QpCrammerSingerDecomp::QpCrammerSingerDecomp(), QpSvmDecomp::QpSvmDecomp(), and QpBoxAllInOneDecomp::Solve().
| void CachedMatrix::FlipColumnsAndRows | ( | unsigned int | i, | |
| unsigned int | j | |||
| ) | [virtual] |
Exchange the rows i and j and the columns i and j.
. It may be advantageous for caching to reorganize the column order. In order to keep symmetric matrices symmetric the rows are swapped, too.| i | first row/column index | |
| j | second row/column index |
Implements QPMatrix.
Definition at line 334 of file QuadraticProgram.cpp.
References baseMatrix, cacheEntry, cacheNewest, cacheOldest, QPMatrix::Entry(), QPMatrix::FlipColumnsAndRows(), QPMatrix::matrixsize, and XCHG_V.
Referenced by QpCrammerSingerDecomp::DeactivateExample(), QpBoxAllInOneDecomp::DeactivateExample(), QpBoxDecomp::FlipCoordinates(), and QpSvmDecomp::FlipCoordinates().
| unsigned int CachedMatrix::getCacheRowSize | ( | unsigned int | k | ) | [inline] |
Definition at line 340 of file QuadraticProgram.h.
References cacheEntry.
Referenced by QpSvmDecomp::ComputeInnerProduct(), QpCrammerSingerDecomp::Shrink(), QpBoxAllInOneDecomp::Shrink(), QpBoxDecomp::Shrink(), and QpSvmDecomp::Shrink().
| unsigned int CachedMatrix::getCacheSize | ( | ) | const [inline] |
| unsigned int CachedMatrix::getMaxCacheSize | ( | ) | const [inline] |
Definition at line 330 of file QuadraticProgram.h.
References cacheMaxSize.
Referenced by QpSvmDecomp::SelectWSS().
| float * CachedMatrix::Row | ( | unsigned int | k, | |
| unsigned int | begin, | |||
| unsigned int | end, | |||
| bool | temp = false | |||
| ) |
Return a subset of a matrix row.
| k | matrix row | |
| begin | first column to be filled in | |
| end | last column to be filled in +1 | |
| temp | are the return values temporary or should they be cached? |
Definition at line 271 of file QuadraticProgram.cpp.
References baseMatrix, cacheAdd(), cacheAppend(), cacheDelete(), cacheEntry, cacheMaxSize, cacheNewest, cacheOldest, cacheRemove(), cacheResize(), cacheSize, cacheTemp, and QPMatrix::Entry().
Referenced by QpSvmDecomp::ComputeInnerProduct(), QpBoxAllInOneDecomp::Continue(), QpSvmDecomp::HMG(), QpSvmDecomp::Libsvm28(), QpBoxDecomp::SMO(), QpCrammerSingerDecomp::Solve(), QpBoxAllInOneDecomp::Solve(), QpBoxDecomp::Solve(), QpSvmDecomp::Solve(), QpCrammerSingerDecomp::Unshrink(), QpBoxAllInOneDecomp::Unshrink(), QpBoxDecomp::Unshrink(), and QpSvmDecomp::Unshrink().
QPMatrix* CachedMatrix::baseMatrix [protected] |
matrix to be cached
Definition at line 353 of file QuadraticProgram.h.
Referenced by CachedMatrix(), Entry(), FlipColumnsAndRows(), and Row().
std::vector<tCacheEntry> CachedMatrix::cacheEntry [protected] |
Definition at line 365 of file QuadraticProgram.h.
Referenced by cacheAdd(), cacheAppend(), cacheClear(), cacheDelete(), CachedMatrix(), cacheRemove(), cacheResize(), CacheRowRelease(), CacheRowResize(), FlipColumnsAndRows(), getCacheRowSize(), and Row().
unsigned int CachedMatrix::cacheMaxSize [protected] |
Definition at line 357 of file QuadraticProgram.h.
Referenced by CachedMatrix(), getMaxCacheSize(), and Row().
int CachedMatrix::cacheNewest [protected] |
Definition at line 367 of file QuadraticProgram.h.
Referenced by cacheAppend(), cacheClear(), CachedMatrix(), cacheRemove(), FlipColumnsAndRows(), and Row().
int CachedMatrix::cacheOldest [protected] |
Definition at line 368 of file QuadraticProgram.h.
Referenced by cacheAppend(), cacheClear(), CachedMatrix(), cacheRemove(), FlipColumnsAndRows(), and Row().
unsigned int CachedMatrix::cacheSize [protected] |
Definition at line 356 of file QuadraticProgram.h.
Referenced by cacheAdd(), cacheClear(), cacheDelete(), CachedMatrix(), cacheResize(), getCacheSize(), and Row().
std::vector<float> CachedMatrix::cacheTemp [protected] |