purify
C++ Purify implementation with native circuit and BPP support
Loading...
Searching...
No Matches
purify::NativeBulletproofCircuit::PackedWithSlack Class Reference

Resettable packed circuit representation backed by one aligned owning slab. More...

#include <bulletproof.hpp>

Public Member Functions

 PackedWithSlack ()=default
 
 PackedWithSlack (const PackedWithSlack &other)
 
PackedWithSlackoperator= (const PackedWithSlack &other)
 
 PackedWithSlack (PackedWithSlack &&other) noexcept
 
PackedWithSlackoperator= (PackedWithSlack &&other) noexcept
 
std::size_t n_gates () const noexcept
 
std::size_t n_commitments () const noexcept
 
std::size_t n_bits () const noexcept
 
std::size_t constraint_count () const noexcept
 
std::size_t constraint_capacity () const noexcept
 
bool has_valid_shape () const noexcept
 
void reset () noexcept
 Restores the packed circuit to its original base row sizes and constraint count.
 
std::size_t add_constraint (const FieldElement &constant=FieldElement::zero())
 Appends a new linear constraint constant term and returns its index.
 
void add_left_term (std::size_t gate_idx, std::size_t constraint_idx, const FieldElement &scalar)
 Adds a coefficient to the left-wire matrix.
 
void add_right_term (std::size_t gate_idx, std::size_t constraint_idx, const FieldElement &scalar)
 Adds a coefficient to the right-wire matrix.
 
void add_output_term (std::size_t gate_idx, std::size_t constraint_idx, const FieldElement &scalar)
 Adds a coefficient to the output-wire matrix.
 
void add_commitment_term (std::size_t commitment_idx, std::size_t constraint_idx, const FieldElement &scalar)
 Adds a coefficient to the commitment matrix using the Bulletproof sign convention.
 
bool evaluate (const BulletproofAssignmentData &assignment) const
 Evaluates the packed circuit directly against a witness assignment.
 
Result< NativeBulletproofCircuitunpack () const
 Materializes the packed circuit back into the ergonomic row-vector representation.
 
NativeBulletproofCircuitRow::PackedWithSlack left_row (std::size_t gate_idx) const noexcept
 Returns a read-only packed left-wire row view.
 
NativeBulletproofCircuitRow::PackedWithSlack right_row (std::size_t gate_idx) const noexcept
 Returns a read-only packed right-wire row view.
 
NativeBulletproofCircuitRow::PackedWithSlack output_row (std::size_t gate_idx) const noexcept
 Returns a read-only packed output-wire row view.
 
NativeBulletproofCircuitRow::PackedWithSlack commitment_row (std::size_t commitment_idx) const noexcept
 Returns a read-only packed commitment row view.
 
std::span< const FieldElementconstants () const noexcept
 Returns the live constraint constants stored in the slab.
 

Static Public Member Functions

static Result< PackedWithSlackfrom_circuit (const NativeBulletproofCircuit &circuit, const PackedSlackPlan &slack)
 Packs a native circuit into one aligned slab with caller-supplied row and constraint slack.
 

Detailed Description

This keeps row metadata, sparse terms, and constants in one compact slab sized for the base circuit plus caller-supplied slack. It supports two cache-friendly modes: copying the object cheaply for const use, or mutating it in place and then calling reset() to return to the original packed base shape.

Definition at line 98 of file bulletproof.hpp.

Constructor & Destructor Documentation

◆ PackedWithSlack() [1/3]

purify::NativeBulletproofCircuit::PackedWithSlack::PackedWithSlack ( )
default

◆ PackedWithSlack() [2/3]

purify::NativeBulletproofCircuit::PackedWithSlack::PackedWithSlack ( const PackedWithSlack other)

Definition at line 964 of file bulletproof.cpp.

◆ PackedWithSlack() [3/3]

purify::NativeBulletproofCircuit::PackedWithSlack::PackedWithSlack ( PackedWithSlack &&  other)
noexcept

Definition at line 979 of file bulletproof.cpp.

Member Function Documentation

◆ add_commitment_term()

void purify::NativeBulletproofCircuit::PackedWithSlack::add_commitment_term ( std::size_t  commitment_idx,
std::size_t  constraint_idx,
const FieldElement scalar 
)

Definition at line 1262 of file bulletproof.cpp.

References scalar.

◆ add_constraint()

std::size_t purify::NativeBulletproofCircuit::PackedWithSlack::add_constraint ( const FieldElement constant = FieldElement::zero())

Definition at line 1222 of file bulletproof.cpp.

◆ add_left_term()

void purify::NativeBulletproofCircuit::PackedWithSlack::add_left_term ( std::size_t  gate_idx,
std::size_t  constraint_idx,
const FieldElement scalar 
)

Definition at line 1247 of file bulletproof.cpp.

References scalar.

◆ add_output_term()

void purify::NativeBulletproofCircuit::PackedWithSlack::add_output_term ( std::size_t  gate_idx,
std::size_t  constraint_idx,
const FieldElement scalar 
)

Definition at line 1257 of file bulletproof.cpp.

References scalar.

◆ add_right_term()

void purify::NativeBulletproofCircuit::PackedWithSlack::add_right_term ( std::size_t  gate_idx,
std::size_t  constraint_idx,
const FieldElement scalar 
)

Definition at line 1252 of file bulletproof.cpp.

References scalar.

◆ commitment_row()

NativeBulletproofCircuitRow::PackedWithSlack purify::NativeBulletproofCircuit::PackedWithSlack::commitment_row ( std::size_t  commitment_idx) const
noexcept

Definition at line 1283 of file bulletproof.cpp.

◆ constants()

std::span< const FieldElement > purify::NativeBulletproofCircuit::PackedWithSlack::constants ( ) const
noexcept

Definition at line 1287 of file bulletproof.cpp.

◆ constraint_capacity()

std::size_t purify::NativeBulletproofCircuit::PackedWithSlack::constraint_capacity ( ) const
inlinenoexcept

Definition at line 127 of file bulletproof.hpp.

◆ constraint_count()

std::size_t purify::NativeBulletproofCircuit::PackedWithSlack::constraint_count ( ) const
inlinenoexcept

Definition at line 123 of file bulletproof.hpp.

◆ evaluate()

◆ from_circuit()

◆ has_valid_shape()

bool purify::NativeBulletproofCircuit::PackedWithSlack::has_valid_shape ( ) const
noexcept

Definition at line 1058 of file bulletproof.cpp.

Referenced by purify::verify_experimental_circuit().

◆ left_row()

NativeBulletproofCircuitRow::PackedWithSlack purify::NativeBulletproofCircuit::PackedWithSlack::left_row ( std::size_t  gate_idx) const
noexcept

Definition at line 1268 of file bulletproof.cpp.

◆ n_bits()

std::size_t purify::NativeBulletproofCircuit::PackedWithSlack::n_bits ( ) const
inlinenoexcept

Definition at line 119 of file bulletproof.hpp.

◆ n_commitments()

std::size_t purify::NativeBulletproofCircuit::PackedWithSlack::n_commitments ( ) const
inlinenoexcept

◆ n_gates()

std::size_t purify::NativeBulletproofCircuit::PackedWithSlack::n_gates ( ) const
inlinenoexcept

◆ operator=() [1/2]

NativeBulletproofCircuit::PackedWithSlack & purify::NativeBulletproofCircuit::PackedWithSlack::operator= ( const PackedWithSlack other)

Definition at line 989 of file bulletproof.cpp.

◆ operator=() [2/2]

NativeBulletproofCircuit::PackedWithSlack & purify::NativeBulletproofCircuit::PackedWithSlack::operator= ( PackedWithSlack &&  other)
noexcept

Definition at line 999 of file bulletproof.cpp.

◆ output_row()

NativeBulletproofCircuitRow::PackedWithSlack purify::NativeBulletproofCircuit::PackedWithSlack::output_row ( std::size_t  gate_idx) const
noexcept

Definition at line 1278 of file bulletproof.cpp.

◆ reset()

void purify::NativeBulletproofCircuit::PackedWithSlack::reset ( )
noexcept

◆ right_row()

NativeBulletproofCircuitRow::PackedWithSlack purify::NativeBulletproofCircuit::PackedWithSlack::right_row ( std::size_t  gate_idx) const
noexcept

Definition at line 1273 of file bulletproof.cpp.

◆ unpack()


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