Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0

Operations for power and nroot propagators. More...

#include <arithmetic.hh>

Public Member Functions

 PowOps (int n)
 Initialize with exponent n.
 
bool even (void) const
 Return whether exponent is even.
 
int exp (void) const
 Return exponent.
 
void exp (int m)
 Set exponent to m.
 
template<class IntType >
IntType pow (IntType x) const
 Return $x^n$ where $n>0$.
 
int tpow (int x) const
 Return $x^n$ where $n>0$ truncated to integer limits.
 
int fnroot (int x) const
 Return $\lfloor \sqrt[n]{x}\rfloor$ where x must be non-negative and $n>0$.
 
int cnroot (int x) const
 Return $\lceil \sqrt[n]{x}\rceil$ where x must be non-negative and $n>0$.
 

Protected Member Functions

bool powgr (long long int r, int x) const
 Test whether $r^n>x$.
 
bool powle (long long int r, int x) const
 Test whether $r^n<x$.
 

Static Protected Member Functions

static bool even (int m)
 Return whether m is even.
 

Protected Attributes

int n
 The exponent and root index.
 

Detailed Description

Operations for power and nroot propagators.

Requires

Definition at line 327 of file arithmetic.hh.

Constructor & Destructor Documentation

◆ PowOps()

Gecode::Int::Arithmetic::PowOps::PowOps ( int n)
inline

Initialize with exponent n.

Definition at line 37 of file pow-ops.hpp.

Member Function Documentation

◆ even() [1/2]

bool Gecode::Int::Arithmetic::PowOps::even ( int m)
inlinestaticprotected

Return whether m is even.

Definition at line 40 of file pow-ops.hpp.

◆ powgr()

bool Gecode::Int::Arithmetic::PowOps::powgr ( long long int r,
int x ) const
inlineprotected

Test whether $r^n>x$.

Definition at line 94 of file pow-ops.hpp.

◆ powle()

bool Gecode::Int::Arithmetic::PowOps::powle ( long long int r,
int x ) const
inlineprotected

Test whether $r^n<x$.

Definition at line 132 of file pow-ops.hpp.

◆ even() [2/2]

bool Gecode::Int::Arithmetic::PowOps::even ( void ) const
inline

Return whether exponent is even.

Definition at line 45 of file pow-ops.hpp.

◆ exp() [1/2]

int Gecode::Int::Arithmetic::PowOps::exp ( void ) const
inline

Return exponent.

Definition at line 50 of file pow-ops.hpp.

◆ exp() [2/2]

void Gecode::Int::Arithmetic::PowOps::exp ( int m)
inline

Set exponent to m.

Definition at line 55 of file pow-ops.hpp.

◆ pow()

template<class IntType >
IntType Gecode::Int::Arithmetic::PowOps::pow ( IntType x) const
inline

Return $x^n$ where $n>0$.

Definition at line 61 of file pow-ops.hpp.

◆ tpow()

int Gecode::Int::Arithmetic::PowOps::tpow ( int x) const
inline

Return $x^n$ where $n>0$ truncated to integer limits.

Definition at line 75 of file pow-ops.hpp.

◆ fnroot()

int Gecode::Int::Arithmetic::PowOps::fnroot ( int x) const
inline

Return $\lfloor \sqrt[n]{x}\rfloor$ where x must be non-negative and $n>0$.

Definition at line 115 of file pow-ops.hpp.

◆ cnroot()

int Gecode::Int::Arithmetic::PowOps::cnroot ( int x) const
inline

Return $\lceil \sqrt[n]{x}\rceil$ where x must be non-negative and $n>0$.

Definition at line 153 of file pow-ops.hpp.

Member Data Documentation

◆ n

int Gecode::Int::Arithmetic::PowOps::n
protected

The exponent and root index.

Definition at line 330 of file arithmetic.hh.


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