Regina 7.3 Calculation Engine
|
Stores an adjusted matrix of homogeneous linear matching equations based on a given triangulation, in sparse form. More...
#include <enumerate/treelp.h>
Public Member Functions | |
LPInitialTableaux (const Triangulation< 3 > &tri, NormalEncoding enc, bool enumeration=true) | |
Construts this adjusted sparse matrix of matching equations. More... | |
LPInitialTableaux (const LPInitialTableaux &src) | |
Creates a new copy of the given matrix. More... | |
LPInitialTableaux (LPInitialTableaux &&src) noexcept | |
Moves the contents of the given matrix into this new matrix. More... | |
~LPInitialTableaux () | |
Destroys this matrix. More... | |
LPInitialTableaux & | operator= (const LPInitialTableaux &src) |
Sets this to be a copy of the given matrix. More... | |
LPInitialTableaux & | operator= (LPInitialTableaux &&src) noexcept |
Moves the contents of the given matrix into this matrix. More... | |
void | swap (LPInitialTableaux &other) noexcept |
Swaps the contents of this and the given matrix. More... | |
const Triangulation< 3 > & | tri () const |
Returns the underlying 3-manifold triangulation from which the matching equations were derived. More... | |
LPSystem | system () const |
Returns the broad class of vector encodings that this tableaux works with. More... | |
size_t | rank () const |
Returns the rank of this matrix. More... | |
size_t | columns () const |
Returns the number of columns in this matrix. More... | |
size_t | coordinateColumns () const |
Returns the number of columns that correspond to normal coordinates or angle structure coordinates. More... | |
const size_t * | columnPerm () const |
Returns the permutation that describes how the columns of the matching equation matrix were reordered. More... | |
template<typename IntType > | |
IntType | multColByRow (const LPMatrix< IntType > &m, size_t mRow, size_t thisCol) const |
Computes the inner product of (i) the given row of the given matrix with (ii) the given column of this matrix. More... | |
template<typename IntType > | |
IntType | multColByRowOct (const LPMatrix< IntType > &m, size_t mRow, size_t thisCol) const |
A variant of multColByRow() that takes into account any adjustments to the tableaux that are required when this is a quadrilateral column being used to represent an octagon type. More... | |
template<typename IntType > | |
void | fillInitialTableaux (LPMatrix< IntType > &m) const |
Fills the given matrix with the contents of this matrix. More... | |
void | writeTextShort (std::ostream &out) const |
Writes a short text representation of this object to the given output stream. More... | |
void | writeTextLong (std::ostream &out) const |
Writes a detailed text representation of this object to the given output stream. More... | |
std::string | str () const |
Returns a short text representation of this object. More... | |
std::string | utf8 () const |
Returns a short text representation of this object using unicode characters. More... | |
std::string | detail () const |
Returns a detailed text representation of this object. More... | |
Stores an adjusted matrix of homogeneous linear matching equations based on a given triangulation, in sparse form.
Typically these will be the normal surface matching equations in some coordinate system, or the angle structure equations.
This class forms part of the tree traversal algorithms for enumerating and locating normal surfaces, as described in "A tree traversal algorithm for decision problems in knot theory and 3-manifold topology", Burton and Ozlen, Algorithmica 65:4 (2013), pp. 772-801, and "A fast branching algorithm for unknot recognition with experimental polynomial-time behaviour", Burton and Ozlen, arXiv:1211.1079. It is also used for locating a single strict angle structure, and for enumerating all taut angle structures.
The adjustments (which are all carried out in the LPInitialTableaux class constructor) are as follows:
There is also optional support for adding extra linear constraints (such as a constraint on Euler characteristic for normal surfaces). These extra constraints are supplied by the template parameter LPConstraint, and will generate LPConstraint::nConstraints additional rows and columns (used by the additional variables that evaluate the corresponding linear functions). If there are no additional constraints, simply use the template parameter LPConstraintNone.
For some LPConstraint template arguments, Regina may discover at runtime that it is impossible to add the corresponding extra linear constraints (e.g., the constraints might require some preconditions on the underlying triangulation that are not met). In this case, the LPInitialTableaux class constructor will throw an exception, as noted in the constructor documentation below.
This class is optimised for working with columns of the matrix (in particular, multiplying columns of this matrix by rows of some other matrix).
This class works with a broad class of vector encodings for normal surfaces or angle structures, as described by the LPSystem class, and within that broad class it does not know which particular encoding or underlying coordinate system is being used. In particular, the matching equations it uses will always be one of the standard tri-quad normal matching equations (if LPSystem::standard() is true
), the quad normal matching equations (if LPSystem::quad() is true
), or the homogeneous angle equations (if LPSystem::angles() is true). If you need to add extra matching equations beyond these, use the LPConstraint template argument as outlined above. If you need to support more exotic vector encodings (e.g., for octagonal almost normal surfaces), you will need to find a way to represent it using one of these three broad classes; see the LPData class notes for how this is done with octagons.
This class implements C++ move semantics and adheres to the C++ Swappable requirement. It is designed to avoid deep copies wherever possible, even when passing or returning objects by value.
LPInitialTableaux_NonSpun
. You are encouraged to look through the Regina namespace to see which constraint classes are supported under Python.regina::LPInitialTableaux< LPConstraint >::LPInitialTableaux | ( | const Triangulation< 3 > & | tri, |
NormalEncoding | enc, | ||
bool | enumeration = true |
||
) |
Construts this adjusted sparse matrix of matching equations.
Note that LPInitialTableaux does not copy the given triangulation; it merely keeps a reference to it. The triangulation should not change during the lifespan of this object.
InvalidArgument | It was not possible to add the extra constraints from the LPConstraint template argument, due to an error which should have been preventable with the right checks in advance. Such exceptions are generated by the LPConstraint class, and so you should consult the class documentation for your chosen LPConstraint template argument to see if this is a possibility. |
InvalidArgument | It was not possible to add the extra constraints from the LPConstraint template argument, due to an error that was "genuinely" unforseeable. Again, such exceptions are generated by your chosen LPConstraint class, and you should consult its documentation to see if this is a possibility. |
tri | the underlying 3-manifold triangulation. |
enc | the normal surface vector encoding that we are using for our enumeration task. This may be any valid NormalEncoding object, including the special angle structure encoding. |
enumeration | true if we should optimise the tableaux for a full enumeration of vertex surfaces or taut angle structures, or false if we should optimise the tableaux for an existence test (such as searching for a non-trivial normal disc or sphere, or a strict angle structure). |
|
inline |
Creates a new copy of the given matrix.
src | the matrix to copy. |
|
inlinenoexcept |
Moves the contents of the given matrix into this new matrix.
This is a fast (constant time) operation.
The matrix that is passed (src) will no longer be usable.
src | the matrix to move. |
|
inline |
Destroys this matrix.
|
inline |
Returns the permutation that describes how the columns of the matching equation matrix were reordered.
This permutation maps column numbers in this adjusted matching equation matrix to column numbers in the original (unmodified) matching equation matrix that was originally derived from the triangulation.
The permutation is returned as an array of columns() integers, such that column i of this adjusted matrix corresponds to column columnPerm()[i]
of the original matrix.
If you are imposing additional constraints through the template parameter LPConstraint, then the corresponding extra variables will be included in the permutation; however, these are never moved and will always remain the rightmost variables in this system (i.e., the columns of highest index).
As well as the requirement that this is a genuine permutation of 0,...,columns()-1, this array will also adhere to the following constraints. In the following discussion, n refers to the number of tetrahedra in the underlying triangulation.
|
inline |
Returns the number of columns in this matrix.
Note that, if we are imposing extra constraints through the template parameter LPConstraint, then there will be extra variables to enforce these, and so the number of columns will be larger than in the original matching equation matrix.
|
inline |
Returns the number of columns that correspond to normal coordinates or angle structure coordinates.
This is precisely the number of columns in the original matrix of matching equations.
|
inherited |
Returns a detailed text representation of this object.
This text may span many lines, and should provide the user with all the information they could want. It should be human-readable, should not contain extremely long lines (which cause problems for users reading the output in a terminal), and should end with a final newline. There are no restrictions on the underlying character set.
|
inline |
Fills the given matrix with the contents of this matrix.
This effectively copies this sparse but highly specialised matrix representation into a dense but more flexible matrix representation.
m | the matrix to fill. |
|
inline |
Computes the inner product of (i) the given row of the given matrix with (ii) the given column of this matrix.
This routine is optimised to use the sparse representation of columns in this matrix.
m | the matrix whose row we will use in the inner product. |
mRow | the row of the matrix m to use in the inner product. |
thisCol | the column of this matrix to use in the inner product. |
|
inline |
A variant of multColByRow() that takes into account any adjustments to the tableaux that are required when this is a quadrilateral column being used to represent an octagon type.
The LPData class offers support for octagonal almost normal surfaces, in which exactly one tetrahedron is allowed to have exactly one octagon type. We represent such an octagon as a pair of incompatible quadrilaterals within the same tetrahedron. See the LPData class notes for details on how this works.
In some settings where we are using additional constraints through the template parameter LPConstraint, these extra constraints behave differently in the presence of octagons (i.e., the coefficient of the octagon type is not just the sum of coefficients of the two constituent quadrilateral types). This routine effectively allows us to adjust the tableaux accordingly.
Specifically: this routine computes the inner product of (i) the given row of the given matrix with (ii) the given column of this matrix. We assume that the given column of this matrix describes one of the two quadrilateral coordinates in some tetrahedron that together form an octagon type, and (via the information given by LPConstraint::octAdjustment) we implicitly adjust the coefficients of our extra constraints accordingly.
This routine is optimised to use the sparse representation of columns in this matrix.
This routine is not used with angle structure coordinates.
m | the matrix whose row we will use in the adjusted inner product. |
mRow | the row of the matrix m to use in the adjusted inner product. |
thisCol | the column of this matrix to use in the adjusted inner product. |
|
inline |
Sets this to be a copy of the given matrix.
It does not matter if this and the given matrix have different sizes and/or work with different vector encodings; if so then these properties will be copied across also.
src | the matrix to copy. |
|
inlinenoexcept |
Moves the contents of the given matrix into this matrix.
This is a fast (constant time) operation.
It does not matter if this and the given matrix have different sizes and/or work with different vector encodings; if so then these properties will be moved across also.
The matrix that is passed (src) will no longer be usable.
src | the matrix to move. |
|
inline |
Returns the rank of this matrix.
Note that, if we are imposing extra constraints through the template parameter LPConstraint, then there will be extra variables to enforce these, and so the rank will be larger than the rank of the original matching equation matrix.
|
inherited |
Returns a short text representation of this object.
This text should be human-readable, should use plain ASCII characters where possible, and should not contain any newlines.
Within these limits, this short text ouptut should be as information-rich as possible, since in most cases this forms the basis for the Python __str__()
and __repr__()
functions.
__str__()
will use precisely this function, and for most classes the Python __repr__()
function will incorporate this into its output.
|
inlinenoexcept |
Swaps the contents of this and the given matrix.
It does not matter if the two matrices have different sizes, and/or work with different vector encodings; if so then these properties will be swapped also.
other | the matrix whose contents should be swapped with this. |
|
inline |
Returns the broad class of vector encodings that this tableaux works with.
This broad class is deduced from the vector encoding that was passed to the class constructor, and it completely determines which matching equations were generated as a result.
See the LPInitialTableaux class notes for more information on these three broad classes and how they affect the tableaux.
|
inline |
Returns the underlying 3-manifold triangulation from which the matching equations were derived.
|
inherited |
Returns a short text representation of this object using unicode characters.
Like str(), this text should be human-readable, should not contain any newlines, and (within these constraints) should be as information-rich as is reasonable.
Unlike str(), this function may use unicode characters to make the output more pleasant to read. The string that is returned will be encoded in UTF-8.
void regina::LPInitialTableaux< LPConstraint >::writeTextLong | ( | std::ostream & | out | ) | const |
Writes a detailed text representation of this object to the given output stream.
out | the output stream to which to write. |
void regina::LPInitialTableaux< LPConstraint >::writeTextShort | ( | std::ostream & | out | ) | const |
Writes a short text representation of this object to the given output stream.
out | the output stream to which to write. |