Loading...
Searching...
No Matches
MinorValue Class Reference

`#include <Minor.h>`

## Public Member Functions

bool | operator== (const MinorValue &mv) const
| just to make the compiler happy
bool | operator< (const MinorValue &mv) const
| just to make the compiler happy
virtual int | getWeight () const
| A method for retrieving the weight of a given MinorValue.
int | getRetrievals () const
| A method for accessing the number of retrievals of this minor.
int | getPotentialRetrievals () const
| A method for accessing the maximum number of potential retrievals of this minor.
int | getMultiplications () const
| A method for accessing the multiplications performed while computing this minor.
int | getAccumulatedMultiplications () const
| A method for accessing the multiplications performed while computing this minor, including all nested multiplications.
int | getAdditions () const
| A method for accessing the additions performed while computing this minor.
int | getAccumulatedAdditions () const
| A method for accessing the additions performed while computing this minor, including all nested additions.
void | incrementRetrievals ()
| A method for incrementing the number of performed retrievals of this instance of MinorValue.
int | getUtility () const
| A method for obtaining a rank measure for theiven MinorValue.
virtual std::string | toString () const
| A method for providing a printable version of the represented MinorValue.
void | print () const
| A method for printing a string representation of the given MinorValue to std::cout.

## Static Public Member Functions

static void | SetRankingStrategy (const int rankingStrategy)
| A method for determining the value ranking strategy.

## Protected Member Functions

int | rankMeasure1 () const
| A method for obtaining a rank measure for the given MinorValue.
int | rankMeasure2 () const
| A method for obtaining a rank measure for the given MinorValue.
int | rankMeasure3 () const
| A method for obtaining a rank measure for the given MinorValue.
int | rankMeasure4 () const
| A method for obtaining a rank measure for the given MinorValue.
int | rankMeasure5 () const
| A method for obtaining a rank measure for the given MinorValue.

## Static Protected Member Functions

static int | GetRankingStrategy ()
| Accessor for the static private field g_rankingStrategy.

## Protected Attributes

int | _retrievals
| -1 iff cache is not used, otherwise the number of retrievals so far of the current minor
int | _potentialRetrievals
| -1 iff cache is not used, otherwise the maximum number of potential retrievals of this minor (e.g.
int | _multiplications
| a store for the actual number of multiplications to compute the current minor
int | _additions
| a store for the actual number of additions to compute the current minor
int | _accumulatedMult
| a store for the accumulated number of multiplications to compute the current minor; This also includes all multiplications nested in sub-minors which may be retrieved from a cache.
int | _accumulatedSum
| a store for the accumulated number of additions to compute the current minor; This also includes all additions nested in sub-minors which may be retrieved from a cache.
STATIC_VAR int | g_rankingStrategy = -1
| private store for the current value ranking strategy; This member can be set using MinorValue::SetRankingStrategy (const int).

## Detailed Description

Definition at line 407 of file Minor.h.

## Member Function Documentation

## getAccumulatedAdditions()

int MinorValue::getAccumulatedAdditions | ( |  | ) | const

A method for accessing the additions performed while computing this minor, including all nested additions.

Contrary to MinorValue::getAdditions () const, this method will also count additions needed to compute all cached sub-minors (, although they need not be performed again in order to compute the given instance of MinorValue).

Returns
  the number of additions performed, including nested additions

See also
  MinorValue::getAdditions () const

Definition at line 898 of file Minor.cc.

{
return _accumulatedSum;
}
MinorValue::_accumulatedSum
int _accumulatedSum
a store for the accumulated number of additions to compute the current minor; This also includes all ...
Definition Minor.h:450

## getAccumulatedMultiplications()

int MinorValue::getAccumulatedMultiplications | ( |  | ) | const

A method for accessing the multiplications performed while computing this minor, including all nested multiplications.

Contrary to MinorValue::getMultiplications () const, this method will also count multiplications needed to compute all cached sub-minors (, although they need not be performed again in order to compute the given instance of MinorValue).

Returns
  the number of multiplications performed, including nested multiplications

See also
  MinorValue::getMultiplications () const

Definition at line 893 of file Minor.cc.

{
return _accumulatedMult;
}
MinorValue::_accumulatedMult
int _accumulatedMult
a store for the accumulated number of multiplications to compute the current minor; This also include...
Definition Minor.h:441

## getAdditions()

int MinorValue::getAdditions | ( |  | ) | const

A method for accessing the additions performed while computing this minor.

Additions that were needed to compute cached sub-minors will not be counted, as the value of those sub-minors can be directly retrieved from the cache.

Returns
  the number of additions performed

See also
  MinorValue::getAccumulatedAdditions () const

Definition at line 888 of file Minor.cc.

{
return _additions;
}
MinorValue::_additions
int _additions
a store for the actual number of additions to compute the current minor
Definition Minor.h:432

## getMultiplications()

int MinorValue::getMultiplications | ( |  | ) | const

A method for accessing the multiplications performed while computing this minor.

Due to multiplication with zero entries of the underlying matrix, some sub-minors may be irrelevant. In this case, the multiplications needed to compute these sub-minors will not be counted (, as they need not be performed). Moreover, multiplications that were needed to compute cached sub-minors will not be counted either, as the value of those sub-minors can be directly retrieved from the cache.

Returns
  the number of multiplications performed

See also
  MinorValue::getAccumulatedMultiplications () const

Definition at line 883 of file Minor.cc.

{
return _multiplications;
}
MinorValue::_multiplications
int _multiplications
a store for the actual number of multiplications to compute the current minor
Definition Minor.h:427

## getPotentialRetrievals()

int MinorValue::getPotentialRetrievals | ( |  | ) | const

A method for accessing the maximum number of potential retrievals of this minor.

Multiple retrievals will occur when computing large minors by means of cached sub-minors. (Then, the latter ones may be retrieved multiple times.)

Returns
  the maximum number of potential retrievals of this minor

See also
  MinorValue::getRetrievals () const

Definition at line 878 of file Minor.cc.

{
return _potentialRetrievals;
}
MinorValue::_potentialRetrievals
int _potentialRetrievals
-1 iff cache is not used, otherwise the maximum number of potential retrievals of this minor (e....
Definition Minor.h:421

## GetRankingStrategy()

int MinorValue::GetRankingStrategy | ( |  | ) |

static protected

Accessor for the static private field g_rankingStrategy.

Definition at line 919 of file Minor.cc.

{
return g_rankingStrategy;
}
MinorValue::g_rankingStrategy
STATIC_VAR int g_rankingStrategy
private store for the current value ranking strategy; This member can be set using MinorValue::SetRan...
Definition Minor.h:541

## getRetrievals()

int MinorValue::getRetrievals | ( |  | ) | const

A method for accessing the number of retrievals of this minor.

Multiple retrievals will occur when computing large minors by means of cached sub-minors. (Then, the latter ones may be retrieved multiple times.)

Returns
  the number of retrievals of this minor

See also
  MinorValue::getPotentialRetrievals () const

Definition at line 868 of file Minor.cc.

{
return _retrievals;
}
MinorValue::_retrievals
int _retrievals
-1 iff cache is not used, otherwise the number of retrievals so far of the current minor
Definition Minor.h:414

## getUtility()

int MinorValue::getUtility | ( |  | ) | const

A method for obtaining a rank measure for theiven MinorValue.

Rank measures are used to compare any two instances of MinorValue. The induced ordering on MinorValues has an impact on the caching behaviour of the underlying cache: Greater MinorValues will be cached longer than lower ones.
More explicitly, this means: Make the return value of this method greater, and the given MinorValue will be cached longer.
Internally, this method will call one of several implementations, depending on the pre-defined caching strategy; see MinorProcessor::SetCacheStrategy (const int).

Returns
  an integer rank measure of `this`

See also
  MinorValue::operator< (const MinorValue& mv)
  MinorProcessor::SetCacheStrategy (const int)

Definition at line 926 of file Minor.cc.

{
switch (this->GetRankingStrategy())
{
case 1: return this->rankMeasure1();
case 2: return this->rankMeasure2();
case 3: return this->rankMeasure3();
case 4: return this->rankMeasure4();
case 5: return this->rankMeasure5();
default: return this->rankMeasure1();
}
}
MinorValue::rankMeasure4
int rankMeasure4() const
A method for obtaining a rank measure for the given MinorValue.
Definition Minor.cc:963
MinorValue::rankMeasure2
int rankMeasure2() const
A method for obtaining a rank measure for the given MinorValue.
Definition Minor.cc:946
MinorValue::rankMeasure5
int rankMeasure5() const
A method for obtaining a rank measure for the given MinorValue.
Definition Minor.cc:972
MinorValue::rankMeasure3
int rankMeasure3() const
A method for obtaining a rank measure for the given MinorValue.
Definition Minor.cc:953
MinorValue::rankMeasure1
int rankMeasure1() const
A method for obtaining a rank measure for the given MinorValue.
Definition Minor.cc:940
MinorValue::GetRankingStrategy
static int GetRankingStrategy()
Accessor for the static private field g_rankingStrategy.
Definition Minor.cc:919

## getWeight()

int MinorValue::getWeight | ( |  | ) | const

virtual

A method for retrieving the weight of a given MinorValue.

The implementation of Cache uses this function to determine the total weight of an entire cache. As the user can instantiate Cache by determining its maximum total weight (see Cache::Cache(const int, const int)), the definition of weight of a MinorValue may have an impact on the behaviour of the cache.

Returns
  the weight of a given instance of MinorValue

See also
  Cache::getWeight () const

Reimplemented in IntMinorValue, and PolyMinorValue.

Definition at line 840 of file Minor.cc.

{
assume(false); /* must be overridden in derived classes */
return 0;
}
assume
#define assume(x)
Definition mod2.h:389

## incrementRetrievals()

void MinorValue::incrementRetrievals | ( |  | ) |

A method for incrementing the number of performed retrievals of this instance of MinorValue.

Note that, when calling MinorValue::incrementRetrievals () for some instance mv of MinorValue which has been cached in a Cache under MinorKey mk, the user should be careful: After incrementing the number of retrievals for mv, the user should always put the value again into cache, i.e. should perform Cache::put (const KeyClass&, const ValueClass&) with mk and the modified mv as arguments. This is due to the fact that changing the number of performed retrievals of a MinorValue may have an impact on its ranking in Cache. Only by calling Cache::put (const KeyClass&, const ValueClass&) can the user ensure that the pair (mk --> mv) will be correctly re-positioned within the Cache.

Definition at line 873 of file Minor.cc.

{
_retrievals++;
}

## operator<()

bool MinorValue::operator< | ( | const MinorValue & | mv | ) | const

just to make the compiler happy

Definition at line 862 of file Minor.cc.

{
assume(false);
return (this < &mv); /* compare addresses of both objects */
}

## operator==()

bool MinorValue::operator== | ( | const MinorValue & | mv | ) | const

just to make the compiler happy

Definition at line 848 of file Minor.cc.

{
assume(false);
return (this == &mv); /* compare addresses of both objects */
}

## print()

void MinorValue::print | ( |  | ) | const

A method for printing a string representation of the given MinorValue to std::cout.

Definition at line 903 of file Minor.cc.

{
PrintS(this->toString().c_str());
}
MinorValue::toString
virtual std::string toString() const
A method for providing a printable version of the represented MinorValue.
Definition Minor.cc:854
PrintS
void PrintS(const char *s)
Definition reporter.cc:288

## rankMeasure1()

int MinorValue::rankMeasure1 | ( |  | ) | const

protected

A method for obtaining a rank measure for the given MinorValue.

Rank measures are used to compare any two instances of MinorValue. The induced ordering on MinorValues has an impact on the caching behaviour in a given cache: Greater MinorValues will be cached longer than lower ones.
More explicitly, this means: Make the return value of this method greater, and the given MinorValue will be cached longer when caching strategy 1 is deployed.
Rank measure 1 is equal to the number of actually performed multiplications to compute mv.

Returns
  an integer rank measure of `this`

See also
  MinorValue::operator< (const MinorValue& mv)

Definition at line 940 of file Minor.cc.

{
/* number of actually performed multiplications */
return this->getMultiplications();
}
MinorValue::getMultiplications
int getMultiplications() const
A method for accessing the multiplications performed while computing this minor.
Definition Minor.cc:883

## rankMeasure2()

int MinorValue::rankMeasure2 | ( |  | ) | const

protected

A method for obtaining a rank measure for the given MinorValue.

Rank measures are used to compare any two instances of MinorValue. The induced ordering on MinorValues has an impact on the caching behaviour in a given cache: Greater MinorValues will be cached longer than lower ones.
More explicitly, this means: Make the return value of this method greater, and the given MinorValue will be cached longer when caching strategy 1 is deployed.
Rank measure 2 is equal to the number of accumulated multiplications to compute the given MinorValue. This also includes all nested multiplications which were performed to compute all sub-minors which could be reused from cache.

Returns
  an integer rank measure of `this`

See also
  MinorValue::operator< (const MinorValue& mv)

Definition at line 946 of file Minor.cc.

{
/* accumulated number of performed multiplications, i.e. all including
nested multiplications */
return this->getAccumulatedMultiplications();
}
MinorValue::getAccumulatedMultiplications
int getAccumulatedMultiplications() const
A method for accessing the multiplications performed while computing this minor, including all nested...
Definition Minor.cc:893

## rankMeasure3()

int MinorValue::rankMeasure3 | ( |  | ) | const

protected

A method for obtaining a rank measure for the given MinorValue.

Rank measures are used to compare any two instances of MinorValue. The induced ordering on MinorValues has an impact on the caching behaviour in a given cache: Greater MinorValues will be cached longer than lower ones.
More explicitly, this means: Make the return value of this method greater, and the given MinorValue will be cached longer when caching strategy 1 is deployed.
Rank measure 3 is equal to the number of actually performed multiplications, weighted with the ratio of not yet performed retrievals over the maximum number of retrievals.

Returns
  an integer rank measure of `this`

See also
  MinorValue::operator< (const MinorValue& mv)

Definition at line 953 of file Minor.cc.

{
/* number of performed multiplications, weighted with the ratio of
not yet performed retrievals over the maximal number of retrievals */
return this->getMultiplications()
* (this->getPotentialRetrievals()
- this->getRetrievals())
/ this->getPotentialRetrievals();
}
MinorValue::getPotentialRetrievals
int getPotentialRetrievals() const
A method for accessing the maximum number of potential retrievals of this minor.
Definition Minor.cc:878
MinorValue::getRetrievals
int getRetrievals() const
A method for accessing the number of retrievals of this minor.
Definition Minor.cc:868

## rankMeasure4()

int MinorValue::rankMeasure4 | ( |  | ) | const

protected

A method for obtaining a rank measure for the given MinorValue.

Rank measures are used to compare any two instances of MinorValue. The induced ordering on MinorValues has an impact on the caching behaviour in a given cache: Greater MinorValues will be cached longer than lower ones.
More explicitly, this means: Make the return value of this method greater, and the given MinorValue will be cached longer when caching strategy 1 is deployed.
Rank measure 4 is equal to the number of actually performed multiplications, multiplied with the number of not yet performed retrievals.

Returns
  an integer rank measure of `this`

See also
  MinorValue::operator< (const MinorValue& mv)

Definition at line 963 of file Minor.cc.

{
/* number of performed multiplications,
multiplied with the number of not yet performed retrievals */
return this->getMultiplications()
* (this->getPotentialRetrievals()
- this->getRetrievals());
}

## rankMeasure5()

int MinorValue::rankMeasure5 | ( |  | ) | const

protected

A method for obtaining a rank measure for the given MinorValue.

Rank measures are used to compare any two instances of MinorValue. The induced ordering on MinorValues has an impact on the caching behaviour in a given cache: Greater MinorValues will be cached longer than lower ones.
More explicitly, this means: Make the return value of this method greater, and the given MinorValue will be cached longer when caching strategy 1 is deployed.
Rank measure 5 is equal to the number of not yet performed retrievals. This strategy tends to cache MinorValues longer which have a high maximum number of potential retrievals.

Returns
  an integer rank measure of `this`

See also
  MinorValue::operator< (const MinorValue& mv)

Definition at line 972 of file Minor.cc.

{
/* number of not yet performed retrievals;
tends to cache entries longer when they are going to be retrieved more
often in the future */
return this->getPotentialRetrievals() - this->getRetrievals();
}

## SetRankingStrategy()

void MinorValue::SetRankingStrategy | ( | const int | rankingStrategy | ) |

static

A method for determining the value ranking strategy.

This setting has a direct effect on how long the given MinorValue will be cached in any cache that uses MinorValue to represent its cached values.

Parameters

  rankingStrategy | an int, so far one of 1, 2, ..., 5

Definition at line 909 of file Minor.cc.

{
g_rankingStrategy = rankingStrategy;
//if (g_rankingStrategy == 6) : rand() is never used
//{
// /* initialize the random generator with system time */
// srand ( time(NULL) );
//}
}

## toString()

string MinorValue::toString | ( |  | ) | const

virtual

A method for providing a printable version of the represented MinorValue.

Returns
  a printable version of the given instance as instance of class string

Reimplemented in IntMinorValue, and PolyMinorValue.

Definition at line 854 of file Minor.cc.

{
assume(false); /* must be overridden in derived classes */
return "";
}

## Field Documentation

## _accumulatedMult

int MinorValue::_accumulatedMult

protected

a store for the accumulated number of multiplications to compute the current minor; This also includes all multiplications nested in sub-minors which may be retrieved from a cache.

(Thus, these nested operations do not need to be performed again.)

Definition at line 441 of file Minor.h.

## _accumulatedSum

int MinorValue::_accumulatedSum

protected

a store for the accumulated number of additions to compute the current minor; This also includes all additions nested in sub-minors which may be retrieved from a cache.

(Thus, these nested operations do not need to be performed again.)

Definition at line 450 of file Minor.h.

## _additions

int MinorValue::_additions

protected

a store for the actual number of additions to compute the current minor

Definition at line 432 of file Minor.h.

## _multiplications

int MinorValue::_multiplications

protected

a store for the actual number of multiplications to compute the current minor

Definition at line 427 of file Minor.h.

## _potentialRetrievals

int MinorValue::_potentialRetrievals

protected

-1 iff cache is not used, otherwise the maximum number of potential retrievals of this minor (e.g.

when the minor would be kept in cache forever)

Definition at line 421 of file Minor.h.

## _retrievals

int MinorValue::_retrievals

protected

-1 iff cache is not used, otherwise the number of retrievals so far of the current minor

Definition at line 414 of file Minor.h.

## g_rankingStrategy

THREAD_VAR int MinorValue::g_rankingStrategy = -1

protected

private store for the current value ranking strategy; This member can be set using MinorValue::SetRankingStrategy (const int).

Definition at line 541 of file Minor.h.

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

- kernel/linear_algebra/Minor.h
- kernel/linear_algebra/Minor.cc