SMTStabilizer API
Public API documentation for SMTStabilizer
Loading...
Searching...
No Matches
stabilizer::util Namespace Reference

Namespaces

namespace  hash
 

Classes

class  BitVector
 

Functions

std::ostream & operator<< (std::ostream &out, const BitVector &bv)
 
void mpz_set_ull (mpz_t rop, uint64_t op)
 
uint64_t mpz_get_ull (const mpz_t op)
 
void mpz_init_set_ull (mpz_t rop, uint64_t op)
 
mpz_class uint64_to_mpz_class (uint64_t op)
 
void mpz_init_set_sll (mpz_t rop, int64_t op)
 
size_t mpz_hash (const mpz_t op, uint64_t start)
 
void mpz_fdiv_q_2exp_ull (mpz_t q, const mpz_t n, uint64_t b)
 
void mpz_fdiv_r_2exp_ull (mpz_t r, const mpz_t n, uint64_t b)
 
void mpz_mul_2exp_ull (mpz_t rop, const mpz_t op1, uint64_t op2)
 
size_t hash_node (const node::Node &node)
 Compute a stable structural hash seed for a parser/node DAG node.
 
size_t hash_mix (size_t x)
 
void hash_combine (size_t &seed, const size_t &v)
 Mix one value into a hash seed.
 
void hash_children (size_t &seed, const std::vector< size_t > &children, const std::vector< size_t > &hash_table)
 Mix child-node hashes into a parent seed in argument order.
 
void hash_communative_children (size_t &seed, const std::vector< size_t > &children, const std::vector< size_t > &hash_table)
 Mix child-node hashes as a commutative multiset.
 
void hash_parents (size_t &seed, const std::vector< std::pair< size_t, size_t > > &parents, const std::vector< size_t > &hash_table)
 Propagate a node hash contribution to parent nodes.
 

Function Documentation

◆ hash_children()

void stabilizer::util::hash_children ( size_t &  seed,
const std::vector< size_t > &  children,
const std::vector< size_t > &  hash_table 
)

Mix child-node hashes into a parent seed in argument order.

Parameters
seedParent hash accumulator to update.
childrenChild indices.
hash_tablePer-node hash table.

Definition at line 55 of file node_helper.cpp.

References hash_combine().

Referenced by stabilizer::kernel::Kernel::propagate().

◆ hash_combine()

void stabilizer::util::hash_combine ( size_t &  seed,
const size_t &  v 
)

Mix one value into a hash seed.

Parameters
seedHash accumulator to update.
vValue to combine.

Definition at line 50 of file node_helper.cpp.

References hash_mix().

Referenced by stabilizer::kernel::Kernel::apply(), hash_children(), hash_communative_children(), hash_node(), hash_parents(), stabilizer::kernel::Kernel::Kernel(), stabilizer::kernel::Kernel::sort_propagate(), and stabilizer::kernel::Kernel::specific_propagate().

◆ hash_communative_children()

void stabilizer::util::hash_communative_children ( size_t &  seed,
const std::vector< size_t > &  children,
const std::vector< size_t > &  hash_table 
)

Mix child-node hashes as a commutative multiset.

Parameters
seedParent hash accumulator to update.
childrenChild indices.
hash_tablePer-node hash table.

Definition at line 61 of file node_helper.cpp.

References hash_combine().

Referenced by stabilizer::kernel::Kernel::propagate(), and stabilizer::kernel::Kernel::specific_propagate().

◆ hash_mix()

size_t stabilizer::util::hash_mix ( size_t  x)

Definition at line 40 of file node_helper.cpp.

Referenced by hash_combine().

◆ hash_node()

size_t stabilizer::util::hash_node ( const node::Node &  node)

Compute a stable structural hash seed for a parser/node DAG node.

The hash is used as an initial value before propagation-based refinement in the kernel stages.

Definition at line 25 of file node_helper.cpp.

References hash_combine().

Referenced by stabilizer::kernel::Kernel::Kernel().

◆ hash_parents()

void stabilizer::util::hash_parents ( size_t &  seed,
const std::vector< std::pair< size_t, size_t > > &  parents,
const std::vector< size_t > &  hash_table 
)

Propagate a node hash contribution to parent nodes.

Parameters
seedNode hash contribution to propagate.
parentsParent metadata as (parent_index, operand_position).
hash_tablePer-node hash table.

Definition at line 71 of file node_helper.cpp.

References hash_combine().

Referenced by stabilizer::kernel::Kernel::propagate().

◆ mpz_fdiv_q_2exp_ull()

◆ mpz_fdiv_r_2exp_ull()

◆ mpz_get_ull()

uint64_t stabilizer::util::mpz_get_ull ( const mpz_t  op)

64-bit version of mpz_get_ui.

mpz_get_ui returns a 32 bit or 64 bit unsigned long depending on the platform (Windows: 32 bit, Linux, macOS: 64).

Returns
The least significant bits of op that fit into 64 bit, sign bit of op is ignored.

Definition at line 35 of file gmp_utils.cpp.

Referenced by stabilizer::util::BitVector::ibvpow(), and stabilizer::util::BitVector::to_uint64().

◆ mpz_hash()

size_t stabilizer::util::mpz_hash ( const mpz_t  op,
uint64_t  start = 0 
)

Compute hash value of a GMP value.

Parameters
opGMP value to hash.
startOptional hash seed.
Returns
The hash value.

Definition at line 86 of file gmp_utils.cpp.

Referenced by stabilizer::util::BitVector::hash().

◆ mpz_init_set_sll()

void stabilizer::util::mpz_init_set_sll ( mpz_t  rop,
int64_t  op 
)

64-bit version of mpz_init_set_si.

Definition at line 72 of file gmp_utils.cpp.

Referenced by stabilizer::util::BitVector::from_si().

◆ mpz_init_set_ull()

void stabilizer::util::mpz_init_set_ull ( mpz_t  rop,
uint64_t  op 
)

64-bit version of mpz_init_set_ui.

Definition at line 50 of file gmp_utils.cpp.

Referenced by stabilizer::util::BitVector::fits_in_size(), stabilizer::util::BitVector::from_ui(), and stabilizer::util::BitVector::ibvpow().

◆ mpz_mul_2exp_ull()

◆ mpz_set_ull()

void stabilizer::util::mpz_set_ull ( mpz_t  rop,
uint64_t  op 
)

64-bit version of mpz_set_ui.

Definition at line 22 of file gmp_utils.cpp.

Referenced by stabilizer::util::BitVector::iset().

◆ operator<<()

std::ostream & stabilizer::util::operator<< ( std::ostream &  out,
const BitVector bv 
)

Definition at line 3100 of file bitvector.cpp.

References stabilizer::util::BitVector::str().

◆ uint64_to_mpz_class()

mpz_class stabilizer::util::uint64_to_mpz_class ( uint64_t  op)

Convert uint64_t to mpz_class.

Definition at line 64 of file gmp_utils.cpp.

Referenced by stabilizer::util::BitVector::to_mpz().