AIToolbox
A library that offers tools for AI problem solving.
AIToolbox::Factored::FactoredMatrix2D Struct Reference

This class represents a factored 2D matrix. More...

#include <AIToolbox/Factored/Utils/FactoredMatrix.hpp>

Public Member Functions

double getValue (const Factors &space, const Factors &actions, const Factors &value, const Factors &action) const
 This function returns the value of the FactoredMatrix2D at the specified point. More...
 
double getValue (const Factors &space, const Factors &actions, const Factors &value, const Factors &action, const Vector &weights) const
 This function returns the value of the FactoredMatrix2D multiplied by the input weights. More...
 
FactoredMatrix2Doperator*= (const Vector &w)
 This function multiplies each basis function with a weight. More...
 
FactoredMatrix2Doperator*= (const double v)
 This function multiplies all bases with a scalar. More...
 

Public Attributes

std::vector< BasisMatrixbases
 

Detailed Description

This class represents a factored 2D matrix.

Note that we can't use a multi_array since each FactoredMatrix2D may have a different number of BasisMatrices.

Member Function Documentation

◆ getValue() [1/2]

double AIToolbox::Factored::FactoredMatrix2D::getValue ( const Factors space,
const Factors actions,
const Factors value,
const Factors action 
) const

This function returns the value of the FactoredMatrix2D at the specified point.

Parameters
spaceThe factor space to use.
actionsThe action space to use.
valueThe factor to compute the value for.
actionThe action to compute the value for.
Returns
The value of the FactoredMatrix2D at the specified point.

◆ getValue() [2/2]

double AIToolbox::Factored::FactoredMatrix2D::getValue ( const Factors space,
const Factors actions,
const Factors value,
const Factors action,
const Vector weights 
) const

This function returns the value of the FactoredMatrix2D multiplied by the input weights.

Note that if the weights contain an additional element, it will be added to the value as a constant basis.

Parameters
spaceThe factor space to use.
actionsThe action space to use.
valueThe factor to compute the value for.
actionThe action to compute the value for.
weightsThe weights to multiply the bases with, with an optional constant basis.
Returns
The value of the FactoredMatrix2D at the specified point.

◆ operator*=() [1/2]

FactoredMatrix2D& AIToolbox::Factored::FactoredMatrix2D::operator*= ( const double  v)

This function multiplies all bases with a scalar.

Parameters
vThe scalar to multiply with.
Returns
A reference to this FactoredMatrix2D.

◆ operator*=() [2/2]

FactoredMatrix2D& AIToolbox::Factored::FactoredMatrix2D::operator*= ( const Vector w)

This function multiplies each basis function with a weight.

The input Vector must have the same number of elements as the number of bases in this FactoredVector, or one optional more.

Each basis is multiplied by its respective scalar. If an additional weight is present in the input, it is divided by the number of bases and added to each of them. Note that if the FactoredMatrix2D contains duplicate tags this is probably not what you want!!

Parameters
wThe weights to multiply with.
Returns
A reference to this FactoredMatrix2D.

Member Data Documentation

◆ bases

std::vector<BasisMatrix> AIToolbox::Factored::FactoredMatrix2D::bases

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