Bertini 2 - C++ Core
Software for Numerical Algebraic Geometry
Loading...
Searching...
No Matches
bertini::Patch Class Reference

An affine chart on a product of projective spaces. More...

#include <patch.hpp>

Public Member Functions

template<typename T>
Vec< T > Eval (Vec< T > const &x) const
 Evaluate the patch at a point.
 
template<typename Derived, typename T>
void EvalInPlace (Eigen::MatrixBase< Derived > &function_values, Vec< T > const &x) const
 Evaluate the patch at a point, in place.
 
template<typename T>
Mat< T > Jacobian (Vec< T > const &x) const
 Evaluate the Jacobian matrix, in place.
 
template<typename Derived, typename T>
void JacobianInPlace (Eigen::MatrixBase< Derived > &jacobian, Vec< T > const &x) const
 Evaluate the Jacobian matrix, in place.
 
unsigned NumVariableGroups () const
 Get the number of variable groups.
 
unsigned NumVariables () const
 Get the number of variables in the patch.
 
bool operator!= (Patch const &rhs) const
 Check whether two patches are different.
 
bool operator== (Patch const &rhs) const
 Check whether two patches are the same.
 
 Patch ()
 Default constructor.
 
 Patch (Patch const &other)
 
 Patch (std::vector< unsigned > const &sizes)
 Constructor making a random complex patch on a space whose structure is described by the input argument.
 
unsigned Precision () const
 Get the current precision of the patch.
 
void Precision (unsigned new_precision) const
 Set the precision of the patch.
 
template<typename T>
Vec< T > RescalePoint (Vec< T > const &x) const
 Rescale a point so that it satisfies the patch equations herein contained.
 
template<typename T>
void RescalePointToFitInPlace (Vec< T > &x) const
 Rescale a point so that it satisfies the patch equations herein contained.
 

Static Public Member Functions

static Patch Random (std::vector< unsigned > const &sizes)
 Construct a random complex patch on a space.
 
static Patch RandomReal (std::vector< unsigned > const &sizes)
 Construct random REAL patch on a space.
 

Detailed Description

An affine chart on a product of projective spaces.

This class provides an adjustable-precision patch on a working space for solving a polynomial system using homotopy continuation.

The constant values for the patch are unity.

Example code, not using a bertini::System to generate the patch.

std::vector<unsigned> s{2,3};
Patch p(s);
Vec<mpfr_complex> v(5);
v << mpfr_complex(1), mpfr_complex(1), mpfr_complex(1), mpfr_complex(1), mpfr_complex(1);
auto v_rescaled = p.RescalePoint(v);
auto f = p.Eval(v_rescaled);
An affine chart on a product of projective spaces.
Definition patch.hpp:86

At the end of the above example, the patch evaluates to 0 in the container \(f\).

Other ways of patching

Patches can also be applied to a system, which should first be homogenized.

Constructor & Destructor Documentation

◆ Patch() [1/3]

bertini::Patch::Patch ( )
inline

Default constructor.

Makes an empty patch.

Here is the caller graph for this function:

◆ Patch() [2/3]

bertini::Patch::Patch ( Patch const & other)
inline

Custom copy constructor, ensuring the max-precision coefficients are copied in highest precision

Here is the call graph for this function:

◆ Patch() [3/3]

bertini::Patch::Patch ( std::vector< unsigned > const & sizes)
inline

Constructor making a random complex patch on a space whose structure is described by the input argument.

The sizes input give the number of total variables, including homogenizing variables, for the product of spaces forming the total space to be patched. The patch has no idea whether the underlying space is projective or affine – that is handled somewhere else, likely in a bertini::System.

The initial precision of the patch is set to current default precision, and the precision of the highest precision coefficients are set to the current default as well.

Parameters
sizesThe sizes of the variable groups, including homogenizing variables if present.
Here is the call graph for this function:

Member Function Documentation

◆ Eval()

template<typename T>
Vec< T > bertini::Patch::Eval ( Vec< T > const & x) const
inline

Evaluate the patch at a point.

Returns
The values of the patch at the point.
Parameters
xThe current space point at which to evaluate.
Here is the call graph for this function:

◆ EvalInPlace()

template<typename Derived, typename T>
void bertini::Patch::EvalInPlace ( Eigen::MatrixBase< Derived > & function_values,
Vec< T > const & x ) const
inline

Evaluate the patch at a point, in place.

Parameters
function_valuesThe vector to populate. Must be at least as long as the number of variable groups.
xThe current space point at which to evaluate.
Todo
Rewrite this code to use Eigen sub-vectors, if possible. If not, take this off the todo list. See http://eigen.tuxfamily.org/dox/group__TutorialBlockOperations.html
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Jacobian()

template<typename T>
Mat< T > bertini::Patch::Jacobian ( Vec< T > const & x) const
inline

Evaluate the Jacobian matrix, in place.

Parameters
xPoint at which to evaluate. Not technically needed, because the Jacobian is simply the matrix of coefficients.
Returns
Jacobian matrix, of size (NumVariableGroups x NumVariables).
Here is the call graph for this function:

◆ JacobianInPlace()

template<typename Derived, typename T>
void bertini::Patch::JacobianInPlace ( Eigen::MatrixBase< Derived > & jacobian,
Vec< T > const & x ) const
inline

Evaluate the Jacobian matrix, in place.

Parameters
jacobianMatrix to populate with the Jacobian. Must be large enough (NumVariableGroups x NumVariables).
xPoint at which to evaluate. Not technically needed, because the Jacobian is simply the matrix of coefficients.
Todo
Rewrite this code to use Eigen sub-vectors, if possible. If not, take this off the todo list. See http://eigen.tuxfamily.org/dox/group__TutorialBlockOperations.html
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NumVariableGroups()

unsigned bertini::Patch::NumVariableGroups ( ) const
inline

Get the number of variable groups.

Returns
The number of variable groups in the problem.
Here is the caller graph for this function:

◆ NumVariables()

unsigned bertini::Patch::NumVariables ( ) const
inline

Get the number of variables in the patch.

Here is the caller graph for this function:

◆ operator!=()

bool bertini::Patch::operator!= ( Patch const & rhs) const
inline

Check whether two patches are different.

Here is the call graph for this function:

◆ operator==()

bool bertini::Patch::operator== ( Patch const & rhs) const
inline

Check whether two patches are the same.

Returns
true If have the same variable structure and coefficients. Otherwise, false.
Here is the call graph for this function:

◆ Precision() [1/2]

unsigned bertini::Patch::Precision ( ) const
inline

Get the current precision of the patch.

Returns
The current precision, in digits.
Here is the caller graph for this function:

◆ Precision() [2/2]

void bertini::Patch::Precision ( unsigned new_precision) const
inline

Set the precision of the patch.

Copies the patch coefficients into correct precision for subsequent precision.

Parameters
new_precisionThe precision to change to.
Here is the call graph for this function:

◆ Random()

static Patch bertini::Patch::Random ( std::vector< unsigned > const & sizes)
inlinestatic

Construct a random complex patch on a space.

Here is the call graph for this function:

◆ RandomReal()

static Patch bertini::Patch::RandomReal ( std::vector< unsigned > const & sizes)
inlinestatic

Construct random REAL patch on a space.

Here is the call graph for this function:

◆ RescalePoint()

template<typename T>
Vec< T > bertini::Patch::RescalePoint ( Vec< T > const & x) const
inline

Rescale a point so that it satisfies the patch equations herein contained.

Returns
Point \(x\) rescaled to fit the patch. \(x\) cannot be the zero vector – zero is a degenerate point in projective space.
Parameters
xThe point to rescale.
Template Parameters
TThe number type.
Here is the call graph for this function:

◆ RescalePointToFitInPlace()

template<typename T>
void bertini::Patch::RescalePointToFitInPlace ( Vec< T > & x) const
inline

Rescale a point so that it satisfies the patch equations herein contained.

The point must be as long as there are total variables.

This function modifies the vector in place, so ensure you have a copy stored somewhere else if you feel it necessary to still have the pre-rescaled vector around.

Parameters
xThe point to rescale
Template Parameters
TThe number type.
Here is the call graph for this function:
Here is the caller graph for this function:

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