Reference Manual: DLS sysCoordinates

From DSL

Jump to: navigation, search


This class provides easy navigation through the elements of a DSL_Dmatrix object. To be properly used, it must be first linked to a matrix using any of its constructors or the LinkTo methods. Within this description, we will use "the matrix" to mean the matrix we are linked to.


This class contains a DSL_intArray with as many elements as dimensions of the matrix. We can fill in the desired value of each coordinate and access the specified element of the matrix through it. It also contains a "flat" index to the element of the matrix. The odometer and the flat value can get unsynchronized if you modify any of them directly. Functions for synchronizing them back are provided: GoTo makes the odometer synchronize with the content of the flat index and GoToCurrentPosition makes the flat index synchronize with the contents of the odometer. See the implementation details of conditional probability distribution for more information on this class and the tutorials for examples on how to use it.


Methods

  • void LinkTo(DSL_Dmatrix &theLink)

Links ourselves with the matrix specified in theLink. The size of currentPosition will be automatically adjusted to hold a value for each of the coordinates of the matrix.


  • void LinkTo(DSL_nodeDefinition &theLink)

If the definition we are passing as a parameter contains a DSL_Dmatrix, we will get linked to it. For example, if we pass a DSL_cpt we will link ourselves to the matrix that contains the probability distribution of the node. If the definition doesn't have a matrix, we will not get linked to anything.


  • void LinkTo(DSL_nodeValue &theLink)

If the value we are passing as a parameter contains a DSL_Dmatrix, we will get linked to it. For example, if we pass a DSL_beliefVector we will link ourselves to the matrix that contains the belief state of the node. If the value doesn't have a matrix, we will not get linked to anything.


  • int &operator[](int index)

Allows changing the value of individual coordinates of the odometer. You should call GoToCurrentPosition once you are done with these changes to make currentIntPosition contain the correct flat index to the matrix.


  • void GoFirst(void)

Make us point to the first element of the matrix. currentIntPosition is set to 0 and currentPosition is filled with zeroes. Ignores locked coordinates.


  • void GoLast(void)

Make us point to the last element of the matrix. currentIntPosition is set to the size of the matrix (minus 1) and currentPosition is filled with the maximum value for each coordinate. Ignores locked coordinates.


  • int GoTo(int theIndex)

Makes us point to the element whose flat index is theIndex. It sets currentIntPosition to theIndex and fills currentPosition with the corresponding values.

Error return values: DSL_OUT_OF_RANGE (theIndex is not a valid index for the matrix).


  • int Next(void)

Goes to the next element of the matrix. Increments currentIntPosition and currentPosition.

Error return values: DSL_OUT_OF_RANGE (already at the last element).


  • int Previous(void)

Goes to the previous element of the matrix. Decrements currentIntPosition and currentPosition.

Error return values: DSL_OUT_OF_RANGE (already at the first element).


  • int GoToCurrentPosition(void)

Updates the value of currentIntPosition according to the contents of currentPosition. Use this method after changing the contents of currentPosition using the [] operator.

Error return values: DSL_OUT_OF_RANGE (the coordinates specified in currentPosition are not valid for the matrix).


  • double &UncheckedValue(void)

Provides access to the element of the matrix pointed by currentIntPosition. This method is just a shortcut for (*link)[currentIntPosition].


  • double &CheckedValue(void)

Provides access to the element of the matrix pointed by currentIntPosition. This method is just a shortcut for link->Subscript(currentIntPosition).


  • int LockCoordinate(int thisOne)

Locks the coordinate specified in thisOne. A locked coordinate will not change its value when using the functions Next and Previous.


  • int UnlockCoordinate(int thisOne)

Unlocks the coordinate specified in thisOne.


  • int UnlockAll(void)

Unlocks all coordinates.

Personal tools