ComputeFHE 1.0
General-Purpose Privacy-Preserving Computation Library for TFHE
Loading...
Searching...
No Matches
Public Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
computefhe::Efixedpoint Class Reference

Represents an encrypted fixed-point number. More...

#include <Efixedpoint.h>

Inheritance diagram for computefhe::Efixedpoint:
Inheritance graph
[legend]
Collaboration diagram for computefhe::Efixedpoint:
Collaboration graph
[legend]

Public Member Functions

 Efixedpoint ()
 Default constructor. Initializes a "zero" encrypted fixed-point value.
 
 Efixedpoint (size_t n_digits, size_t n_frac, bool is_signed)
 Constructs a "zero" Efixedpoint with specific bitsize.
 
 Efixedpoint (double d, size_t n_digits, size_t n_frac, bool is_signed)
 Constructs and encrypts a plaintext double.
 
 Efixedpoint (const FixedPoint &fp, size_t n_frac, bool is_signed)
 Wraps an existing FixedPoint bit-vector as a fixed-point number.
 
 Efixedpoint (const Efixedpoint &other)
 Copy constructor.
 
 Efixedpoint (const Einteger &other)
 Conversion constructor from an Einteger. The resulting fixed-point number will have a fractional part of 0 bits.
 
size_t getFracSize () const
 Gets the number of bits used for the fractional part.
 
void setFracSize (size_t)
 Manually adjusts the fractional size metadata.
 
virtual const Einteger operator== (const Efixedpoint &) const
 Encrypted equality comparison (ciphertext-ciphertext).
 
virtual const Einteger operator!= (const Efixedpoint &) const
 Encrypted inequality comparison (ciphertext-ciphertext).
 
virtual const Einteger operator> (const Efixedpoint &) const
 Encrypted greater-than comparison (ciphertext-ciphertext).
 
virtual const Einteger operator>= (const Efixedpoint &) const
 Encrypted greater-than-or-equal comparison (ciphertext-ciphertext).
 
virtual const Einteger operator< (const Efixedpoint &) const
 Encrypted less-than comparison (ciphertext-ciphertext).
 
virtual const Einteger operator<= (const Efixedpoint &) const
 Encrypted less-than-or-equal comparison (ciphertext-ciphertext).
 
virtual const Einteger operator== (double) const
 Encrypted equality comparison with plaintext double.
 
virtual const Einteger operator!= (double) const
 Encrypted inequality comparison with plaintext double.
 
virtual const Einteger operator> (double) const
 Encrypted greater-than comparison with plaintext double.
 
virtual const Einteger operator>= (double) const
 Encrypted greater-than-or-equal comparison with plaintext double.
 
virtual const Einteger operator< (double) const
 Encrypted less-than comparison with plaintext double.
 
virtual const Einteger operator<= (double) const
 Encrypted less-than-or-equal comparison with plaintext double.
 
virtual const Efixedpoint operator+ (const Efixedpoint &) const
 Encrypted addition (ciphertext-ciphertext).
 
virtual const Efixedpoint operator+= (const Efixedpoint &)
 Encrypted addition assignment (ciphertext-ciphertext).
 
virtual const Efixedpoint operator- (const Efixedpoint &) const
 Encrypted subtraction (ciphertext-ciphertext).
 
virtual const Efixedpoint operator-= (const Efixedpoint &)
 Encrypted subtraction assignment (ciphertext-ciphertext).
 
virtual const Efixedpoint operator* (const Efixedpoint &) const
 Encrypted multiplication (ciphertext-ciphertext). Resulting frac_size is sum of inputs.
 
virtual const Efixedpoint operator*= (const Efixedpoint &)
 Encrypted multiplication assignment (ciphertext-ciphertext).
 
virtual const Efixedpoint operator/ (const Efixedpoint &) const
 Encrypted division (ciphertext-ciphertext).
 
virtual const Efixedpoint operator/= (const Efixedpoint &)
 Encrypted division assignment (ciphertext-ciphertext).
 
virtual const Efixedpoint operator+ (double) const
 Encrypted addition with plaintext double.
 
virtual const Efixedpoint operator+= (double)
 Encrypted addition assignment with plaintext double.
 
virtual const Efixedpoint operator- (double) const
 Encrypted subtraction with plaintext double.
 
virtual const Efixedpoint operator-= (double)
 Encrypted subtraction assignment with plaintext double.
 
virtual const Efixedpoint operator* (double) const
 Encrypted multiplication with plaintext double.
 
virtual const Efixedpoint operator*= (double)
 Encrypted multiplication assignment with plaintext double.
 
virtual const Efixedpoint operator/ (double) const
 Encrypted division with plaintext double.
 
virtual const Efixedpoint operator/= (double)
 Encrypted division assignment with plaintext double.
 
const Efixedpoint operator- () const
 Encrypted unary negation.
 
const Efixedpoint operator++ ()
 Pre-increment.
 
const Efixedpoint operator++ (int)
 Post-increment.
 
const Efixedpoint operator-- ()
 Pre-decrement.
 
const Efixedpoint operator-- (int)
 Post-decrement.
 
const Efixedpoint operator<< (int) const
 Bitwise left shift.
 
const Efixedpoint operator<<= (int)
 Bitwise left shift assignment.
 
const Efixedpoint operator>> (int) const
 Bitwise right shift.
 
const Efixedpoint operator>>= (int)
 Bitwise right shift assignment.
 
Efixedpointoperator= (const Efixedpoint &)
 Assignment from another Efixedpoint.
 
Efixedpointoperator= (double)
 Assignment from a plaintext double (encrypts the value).
 
virtual operator double () const
 Explicit conversion to a decrypted double.
 
Einteger toInteger () const
 Converts fixed-point to integer by truncating the fractional part.
 
virtual const Einteger operator== (const Einteger &) const
 Encrypted equality comparison with another Einteger.
 
virtual const Einteger operator== (uint64_t) const
 Encrypted equality comparison with a plaintext uint64_t.
 
virtual const Einteger operator!= (const Einteger &) const
 Encrypted inequality comparison with another Einteger.
 
virtual const Einteger operator!= (uint64_t) const
 Encrypted inequality comparison with a plaintext uint64_t.
 
virtual const Einteger operator> (const Einteger &) const
 Encrypted greater-than comparison with another Einteger.
 
virtual const Einteger operator> (uint64_t) const
 Encrypted greater-than comparison with a plaintext uint64_t.
 
virtual const Einteger operator>= (const Einteger &) const
 Encrypted greater-than-or-equal comparison with another Einteger.
 
virtual const Einteger operator>= (uint64_t) const
 Encrypted greater-than-or-equal comparison with a plaintext uint64_t.
 
virtual const Einteger operator< (const Einteger &) const
 Encrypted less-than comparison with another Einteger.
 
virtual const Einteger operator< (uint64_t) const
 Encrypted less-than comparison with a plaintext uint64_t.
 
virtual const Einteger operator<= (const Einteger &) const
 Encrypted less-than-or-equal comparison with another Einteger.
 
virtual const Einteger operator<= (uint64_t) const
 Encrypted less-than-or-equal comparison with a plaintext uint64_t.
 
virtual const Einteger operator+ (const Einteger &) const
 Encrypted addition with another Einteger.
 
virtual const Einteger operator+ (uint64_t) const
 Encrypted addition with a plaintext uint64_t.
 
virtual const Einteger operator+= (const Einteger &)
 Encrypted addition assignment with another Einteger.
 
virtual const Einteger operator+= (uint64_t)
 Encrypted addition assignment with a plaintext uint64_t.
 
virtual const Einteger operator- (const Einteger &) const
 Encrypted subtraction with another Einteger.
 
virtual const Einteger operator- (uint64_t) const
 Encrypted subtraction with a plaintext uint64_t.
 
const Einteger operator- () const
 Encrypted unary negation (two's complement).
 
virtual const Einteger operator-= (const Einteger &)
 Encrypted subtraction assignment with another Einteger.
 
virtual const Einteger operator-= (uint64_t)
 Encrypted subtraction assignment with a plaintext uint64_t.
 
virtual const Einteger operator* (const Einteger &) const
 Encrypted multiplication with another Einteger.
 
virtual const Einteger operator* (uint64_t) const
 Encrypted multiplication with a plaintext uint64_t.
 
virtual const Einteger operator*= (const Einteger &)
 Encrypted multiplication assignment with another Einteger.
 
virtual const Einteger operator*= (uint64_t)
 Encrypted multiplication assignment with a plaintext uint64_t.
 
virtual const Einteger operator/ (const Einteger &) const
 Encrypted division with another Einteger.
 
virtual const Einteger operator/ (uint64_t) const
 Encrypted division with a plaintext uint64_t.
 
virtual const Einteger operator/= (const Einteger &)
 Encrypted division assignment with another Einteger.
 
virtual const Einteger operator/= (uint64_t)
 Encrypted division assignment with a plaintext uint64_t.
 
- Public Member Functions inherited from computefhe::Einteger
 Einteger ()
 Default constructor. Initializes an empty or zero-valued encrypted integer.
 
 Einteger (int64_t d)
 Constructs an Einteger from a plaintext int64_t.
 
 Einteger (size_t n_digits, bool is_signed)
 Constructs an Einteger with a specified number of bits and signedness.
 
 Einteger (int64_t d, size_t n_digits)
 Constructs an Einteger from a plaintext int64_t with a specified number of bits.
 
 Einteger (uint64_t d, size_t n_digits)
 Constructs an Einteger from a plaintext uint64_t with a specified number of bits.
 
 Einteger (const FixedPoint &fp, bool is_signed)
 Constructs an Einteger from an existing FixedPoint object.
 
 Einteger (const Einteger &other)
 Copy constructor.
 
virtual ~Einteger ()
 Destructor.
 
const FixedPointgetData () const
 Gets the underlying FixedPoint data.
 
size_t getSize () const
 Gets the number of bits used to represent the encrypted integer.
 
bool isSigned () const
 Checks if the encrypted integer is signed.
 
virtual const Einteger operator% (const Einteger &) const
 Encrypted modulo with another Einteger.
 
virtual const Einteger operator%= (const Einteger &)
 Encrypted modulo assignment with another Einteger.
 
virtual const Einteger operator% (uint64_t) const
 Encrypted modulo with a plaintext uint64_t.
 
virtual const Einteger operator%= (uint64_t)
 Encrypted modulo assignment with a plaintext uint64_t.
 
const Einteger operator- () const
 Encrypted unary negation (two's complement).
 
virtual const Einteger operator& (const Einteger &) const
 Encrypted bitwise AND with another Einteger.
 
virtual const Einteger operator&= (const Einteger &)
 Encrypted bitwise AND assignment with another Einteger.
 
virtual const Einteger operator| (const Einteger &) const
 Encrypted bitwise OR with another Einteger.
 
virtual const Einteger operator|= (const Einteger &)
 Encrypted bitwise OR assignment with another Einteger.
 
virtual const Einteger operator^ (const Einteger &) const
 Encrypted bitwise XOR with another Einteger.
 
virtual const Einteger operator^= (const Einteger &)
 Encrypted bitwise XOR assignment with another Einteger.
 
virtual const Einteger operator& (uint64_t) const
 Encrypted bitwise AND with a plaintext uint64_t.
 
virtual const Einteger operator&= (uint64_t)
 Encrypted bitwise AND assignment with a plaintext uint64_t.
 
virtual const Einteger operator| (uint64_t) const
 Encrypted bitwise OR with a plaintext uint64_t.
 
virtual const Einteger operator|= (uint64_t)
 Encrypted bitwise OR assignment with a plaintext uint64_t.
 
virtual const Einteger operator^ (uint64_t) const
 Encrypted bitwise XOR with a plaintext uint64_t.
 
virtual const Einteger operator^= (uint64_t)
 Encrypted bitwise XOR assignment with a plaintext uint64_t.
 
virtual const Einteger operator! () const
 Encrypted logical NOT.
 
virtual const Einteger operator~ () const
 Encrypted bitwise NOT (one's complement).
 
virtual const Einteger operator&& (const Einteger &) const
 Encrypted logical AND with another Einteger.
 
virtual const Einteger operator&& (uint64_t) const
 Encrypted logical AND with a plaintext uint64_t.
 
virtual const Einteger operator|| (const Einteger &) const
 Encrypted logical OR with another Einteger.
 
virtual const Einteger operator|| (uint64_t) const
 Encrypted logical OR with a plaintext uint64_t.
 
const Einteger operator++ ()
 Pre-increment operator. Increments the encrypted integer by one.
 
const Einteger operator++ (int)
 Post-increment operator. Increments the encrypted integer by one.
 
const Einteger operator-- ()
 Pre-decrement operator. Decrements the encrypted integer by one.
 
const Einteger operator-- (int)
 Post-decrement operator. Decrements the encrypted integer by one.
 
const Einteger operator<< (int) const
 Encrypted left shift.
 
const Einteger operator<<= (int)
 Encrypted left shift assignment.
 
const Einteger operator>> (int) const
 Encrypted right shift.
 
const Einteger operator>>= (int)
 Encrypted right shift assignment.
 
Eintegeroperator= (const Einteger &)
 Assignment operator from another Einteger.
 
Eintegeroperator= (uint64_t)
 Assignment operator from a plaintext uint64_t.
 
virtual operator bool () const
 Explicit conversion to decrypted boolean.
 
virtual operator int8_t () const
 Explicit conversion to decrypted int8_t.
 
virtual operator uint8_t () const
 Explicit conversion to decrypted uint8_t.
 
virtual operator int16_t () const
 Explicit conversion to decrypted int16_t.
 
virtual operator uint16_t () const
 Explicit conversion to decrypted uint16_t.
 
virtual operator int32_t () const
 Explicit conversion to decrypted int32_t.
 
virtual operator uint32_t () const
 Explicit conversion to decrypted uint32_t.
 
virtual operator int64_t () const
 Explicit conversion to decrypted int64_t.
 
virtual operator uint64_t () const
 Explicit conversion to decrypted uint64_t.
 
template<class Archive >
void save (Archive &ar, std::uint32_t const version) const
 
template<class Archive >
void load (Archive &ar, std::uint32_t const version)
 
std::string SerializedObjectName () const override
 

Static Protected Member Functions

static FixedPoint double2fp (double d, size_t n_digits, size_t n_frac)
 
static void promote (const Efixedpoint &a, const Efixedpoint &b, FixedPoint &a_out, FixedPoint &b_out, size_t &n_digits_out, size_t &n_frac_out, bool &sign_out)
 
static FixedPoint promote (const Efixedpoint &a, size_t n_digits, size_t n_frac)
 
- Static Protected Member Functions inherited from computefhe::Einteger
static int64_t sign_extend (uint64_t d, size_t n_digits)
 
static bool promote (const Einteger &a, const Einteger &b, FixedPoint &a_out, FixedPoint &b_out)
 

Protected Attributes

size_t frac_size
 
- Protected Attributes inherited from computefhe::Einteger
FixedPoint data
 
size_t size
 
bool sign
 

Friends

ostreamoperator<< (ostream &out, const Efixedpoint &obj)
 Decrypts and outputs the fixed-point value to a stream.
 
const Einteger operator== (double a, const Efixedpoint &b)
 Plaintext-ciphertext equality comparison.
 
const Einteger operator!= (double a, const Efixedpoint &b)
 Plaintext-ciphertext inequality comparison.
 
const Einteger operator> (double a, const Efixedpoint &b)
 Plaintext-ciphertext greater-than comparison.
 
const Einteger operator>= (double a, const Efixedpoint &b)
 Plaintext-ciphertext greater-than-or-equal comparison.
 
const Einteger operator< (double a, const Efixedpoint &b)
 Plaintext-ciphertext less-than comparison.
 
const Einteger operator<= (double a, const Efixedpoint &b)
 Plaintext-ciphertext less-than-or-equal comparison.
 
const Efixedpoint operator+ (double a, const Efixedpoint &b)
 Plaintext-ciphertext addition.
 
const Efixedpoint operator- (double a, const Efixedpoint &b)
 Plaintext-ciphertext subtraction.
 
const Efixedpoint operator* (double a, const Efixedpoint &b)
 Plaintext-ciphertext multiplication.
 
const Efixedpoint operator/ (double a, const Efixedpoint &b)
 Plaintext-ciphertext division.
 
const Einteger operator== (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t equality comparison with Einteger.
 
const Einteger operator!= (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t inequality comparison with Einteger.
 
const Einteger operator> (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t greater-than comparison with Einteger.
 
const Einteger operator>= (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t greater-than-or-equal comparison with Einteger.
 
const Einteger operator< (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t less-than comparison with Einteger.
 
const Einteger operator<= (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t less-than-or-equal comparison with Einteger.
 
const Einteger operator+ (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t addition with Einteger.
 
const Einteger operator- (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t subtraction with Einteger.
 
const Einteger operator* (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t multiplication with Einteger.
 
const Einteger operator/ (uint64_t a, const Einteger &b)
 Friend operator for plaintext uint64_t division with Einteger.
 

Additional Inherited Members

- Static Public Member Functions inherited from computefhe::Einteger
static FixedPoint promote (const Einteger &a, size_t s)
 Promotes or truncates an Einteger to a specific bit size.
 
static uint32_t SerializedVersion ()
 
- Protected Member Functions inherited from computefhe::Einteger
void _sync_var ()
 
void _desync_var ()
 
- Static Protected Attributes inherited from computefhe::Einteger
static FixedPoint cached_divident
 
static FixedPoint cached_divisor
 
static FixedPoint cached_quotient
 
static FixedPoint cached_remainder
 

Detailed Description

Represents an encrypted fixed-point number.

Inherits from Einteger and uses a scaling factor (2^frac_size) to represent fractional values. This class allows for high-level arithmetic and comparison on encrypted real numbers, supporting both signed and unsigned logic.

Constructor & Destructor Documentation

◆ Efixedpoint() [1/3]

computefhe::Efixedpoint::Efixedpoint ( size_t  n_digits,
size_t  n_frac,
bool  is_signed 
)

Constructs a "zero" Efixedpoint with specific bitsize.

Parameters
n_digitsTotal number of bits (integer + fractional).
n_fracNumber of bits reserved for the fractional part.
is_signedWhether to treat the value as a signed two's complement number.

◆ Efixedpoint() [2/3]

computefhe::Efixedpoint::Efixedpoint ( double  d,
size_t  n_digits,
size_t  n_frac,
bool  is_signed 
)

Constructs and encrypts a plaintext double.

Parameters
dThe plaintext value to encrypt.
n_digitsTotal bit width.
n_fracFractional bit width.
is_signedSignedness of the encrypted representation.

◆ Efixedpoint() [3/3]

computefhe::Efixedpoint::Efixedpoint ( const FixedPoint fp,
size_t  n_frac,
bool  is_signed 
)

Wraps an existing FixedPoint bit-vector as a fixed-point number.

Parameters
fpThe underlying encrypted bit-vector.
n_fracFractional bit width.
is_signedSignedness.

Member Function Documentation

◆ getFracSize()

size_t computefhe::Efixedpoint::getFracSize ( ) const

Gets the number of bits used for the fractional part.

Returns
fractional bit count.

◆ operator double()

virtual computefhe::Efixedpoint::operator double ( ) const
explicitvirtual

Explicit conversion to a decrypted double.

Reimplemented from computefhe::Einteger.

◆ operator!=() [1/2]

Encrypted inequality comparison with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result (1 if not equal, 0 if equal).

Reimplemented from computefhe::Einteger.

◆ operator!=() [2/2]

Encrypted inequality comparison with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

Reimplemented from computefhe::Einteger.

◆ operator*() [1/2]

virtual const Einteger computefhe::Einteger::operator* ( const Einteger ) const
virtual

Encrypted multiplication with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A new Einteger representing the product.

Reimplemented from computefhe::Einteger.

◆ operator*() [2/2]

virtual const Einteger computefhe::Einteger::operator* ( uint64_t  ) const
virtual

Encrypted multiplication with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A new Einteger representing the product.

Reimplemented from computefhe::Einteger.

◆ operator*=() [1/2]

virtual const Einteger computefhe::Einteger::operator*= ( const Einteger )
virtual

Encrypted multiplication assignment with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A reference to this Einteger after multiplication.

Reimplemented from computefhe::Einteger.

◆ operator*=() [2/2]

virtual const Einteger computefhe::Einteger::operator*= ( uint64_t  )
virtual

Encrypted multiplication assignment with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A reference to this Einteger after multiplication.

Reimplemented from computefhe::Einteger.

◆ operator+() [1/2]

virtual const Einteger computefhe::Einteger::operator+ ( const Einteger ) const
virtual

Encrypted addition with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A new Einteger representing the sum.

Reimplemented from computefhe::Einteger.

◆ operator+() [2/2]

virtual const Einteger computefhe::Einteger::operator+ ( uint64_t  ) const
virtual

Encrypted addition with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A new Einteger representing the sum.

Reimplemented from computefhe::Einteger.

◆ operator+=() [1/2]

virtual const Einteger computefhe::Einteger::operator+= ( const Einteger )
virtual

Encrypted addition assignment with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A reference to this Einteger after addition.

Reimplemented from computefhe::Einteger.

◆ operator+=() [2/2]

virtual const Einteger computefhe::Einteger::operator+= ( uint64_t  )
virtual

Encrypted addition assignment with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A reference to this Einteger after addition.

Reimplemented from computefhe::Einteger.

◆ operator-() [1/3]

const Einteger computefhe::Einteger::operator- ( ) const

Encrypted unary negation (two's complement).

Returns
A new Einteger representing the negated value.

◆ operator-() [2/3]

virtual const Einteger computefhe::Einteger::operator- ( const Einteger ) const
virtual

Encrypted subtraction with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A new Einteger representing the difference.

Reimplemented from computefhe::Einteger.

◆ operator-() [3/3]

virtual const Einteger computefhe::Einteger::operator- ( uint64_t  ) const
virtual

Encrypted subtraction with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A new Einteger representing the difference.

Reimplemented from computefhe::Einteger.

◆ operator-=() [1/2]

virtual const Einteger computefhe::Einteger::operator-= ( const Einteger )
virtual

Encrypted subtraction assignment with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
A reference to this Einteger after subtraction.

Reimplemented from computefhe::Einteger.

◆ operator-=() [2/2]

virtual const Einteger computefhe::Einteger::operator-= ( uint64_t  )
virtual

Encrypted subtraction assignment with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
A reference to this Einteger after subtraction.

Reimplemented from computefhe::Einteger.

◆ operator/() [1/2]

virtual const Einteger computefhe::Einteger::operator/ ( const Einteger ) const
virtual

Encrypted division with another Einteger.

Parameters
otherThe other encrypted integer (divisor).
Returns
A new Einteger representing the quotient.

Reimplemented from computefhe::Einteger.

◆ operator/() [2/2]

virtual const Einteger computefhe::Einteger::operator/ ( uint64_t  ) const
virtual

Encrypted division with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer (divisor).
Returns
A new Einteger representing the quotient.

Reimplemented from computefhe::Einteger.

◆ operator/=() [1/2]

virtual const Einteger computefhe::Einteger::operator/= ( const Einteger )
virtual

Encrypted division assignment with another Einteger.

Parameters
otherThe other encrypted integer (divisor).
Returns
A reference to this Einteger after division.

Reimplemented from computefhe::Einteger.

◆ operator/=() [2/2]

virtual const Einteger computefhe::Einteger::operator/= ( uint64_t  )
virtual

Encrypted division assignment with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer (divisor).
Returns
A reference to this Einteger after division.

Reimplemented from computefhe::Einteger.

◆ operator<() [1/2]

virtual const Einteger computefhe::Einteger::operator< ( const Einteger ) const
virtual

Encrypted less-than comparison with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result (1 if less, 0 otherwise).

Reimplemented from computefhe::Einteger.

◆ operator<() [2/2]

virtual const Einteger computefhe::Einteger::operator< ( uint64_t  ) const
virtual

Encrypted less-than comparison with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

Reimplemented from computefhe::Einteger.

◆ operator<=() [1/2]

virtual const Einteger computefhe::Einteger::operator<= ( const Einteger ) const
virtual

Encrypted less-than-or-equal comparison with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result (1 if less or equal, 0 otherwise).

Reimplemented from computefhe::Einteger.

◆ operator<=() [2/2]

virtual const Einteger computefhe::Einteger::operator<= ( uint64_t  ) const
virtual

Encrypted less-than-or-equal comparison with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

Reimplemented from computefhe::Einteger.

◆ operator==() [1/2]

virtual const Einteger computefhe::Einteger::operator== ( const Einteger ) const
virtual

Encrypted equality comparison with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result (1 if equal, 0 if not).

Reimplemented from computefhe::Einteger.

◆ operator==() [2/2]

virtual const Einteger computefhe::Einteger::operator== ( uint64_t  ) const
virtual

Encrypted equality comparison with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

Reimplemented from computefhe::Einteger.

◆ operator>() [1/2]

virtual const Einteger computefhe::Einteger::operator> ( const Einteger ) const
virtual

Encrypted greater-than comparison with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result (1 if greater, 0 otherwise).

Reimplemented from computefhe::Einteger.

◆ operator>() [2/2]

virtual const Einteger computefhe::Einteger::operator> ( uint64_t  ) const
virtual

Encrypted greater-than comparison with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

Reimplemented from computefhe::Einteger.

◆ operator>=() [1/2]

virtual const Einteger computefhe::Einteger::operator>= ( const Einteger ) const
virtual

Encrypted greater-than-or-equal comparison with another Einteger.

Parameters
otherThe other encrypted integer.
Returns
An Einteger representing the encrypted boolean result (1 if greater or equal, 0 otherwise).

Reimplemented from computefhe::Einteger.

◆ operator>=() [2/2]

virtual const Einteger computefhe::Einteger::operator>= ( uint64_t  ) const
virtual

Encrypted greater-than-or-equal comparison with a plaintext uint64_t.

Parameters
valThe plaintext unsigned integer.
Returns
An Einteger representing the encrypted boolean result.

Reimplemented from computefhe::Einteger.

◆ setFracSize()

void computefhe::Efixedpoint::setFracSize ( size_t  )

Manually adjusts the fractional size metadata.

Note
This does not perform bit-shifting; use operator<< or operator>> for scaling.
Parameters
nNew fractional bit count.

Friends And Related Symbol Documentation

◆ operator!= [1/2]

const Einteger operator!= ( double  a,
const Efixedpoint b 
)
friend

Plaintext-ciphertext inequality comparison.

Parameters
aThe plaintext double value.
bThe encrypted fixed-point value.
Returns
An Einteger representing the encrypted boolean result (1 if not equal).

◆ operator!= [2/2]

const Einteger operator!= ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t inequality comparison with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator* [1/2]

const Efixedpoint operator* ( double  a,
const Efixedpoint b 
)
friend

Plaintext-ciphertext multiplication.

Parameters
aThe plaintext double value.
bThe encrypted fixed-point value.
Returns
A new Efixedpoint representing the encrypted product (a * b).

◆ operator* [2/2]

const Einteger operator* ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t multiplication with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
A new Einteger representing the product.

◆ operator+ [1/2]

const Efixedpoint operator+ ( double  a,
const Efixedpoint b 
)
friend

Plaintext-ciphertext addition.

Parameters
aThe plaintext double value.
bThe encrypted fixed-point value.
Returns
A new Efixedpoint representing the encrypted sum (a + b).

◆ operator+ [2/2]

const Einteger operator+ ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t addition with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
A new Einteger representing the sum.

◆ operator- [1/2]

const Efixedpoint operator- ( double  a,
const Efixedpoint b 
)
friend

Plaintext-ciphertext subtraction.

Parameters
aThe plaintext double value.
bThe encrypted fixed-point value.
Returns
A new Efixedpoint representing the encrypted difference (a - b).

◆ operator- [2/2]

const Einteger operator- ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t subtraction with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
A new Einteger representing the difference.

◆ operator/ [1/2]

const Efixedpoint operator/ ( double  a,
const Efixedpoint b 
)
friend

Plaintext-ciphertext division.

Parameters
aThe plaintext double value.
bThe encrypted fixed-point value (divisor).
Returns
A new Efixedpoint representing the encrypted quotient (a / b).

◆ operator/ [2/2]

const Einteger operator/ ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t division with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
A new Einteger representing the quotient.

◆ operator< [1/2]

const Einteger operator< ( double  a,
const Efixedpoint b 
)
friend

Plaintext-ciphertext less-than comparison.

Parameters
aThe plaintext double value.
bThe encrypted fixed-point value.
Returns
An Einteger representing the encrypted boolean result (1 if a < b).

◆ operator< [2/2]

const Einteger operator< ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t less-than comparison with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator<<

ostream & operator<< ( ostream out,
const Efixedpoint obj 
)
friend

Decrypts and outputs the fixed-point value to a stream.

Parameters
outThe output stream.
objThe Efixedpoint object to decrypt and print.
Returns
A reference to the output stream.

◆ operator<= [1/2]

const Einteger operator<= ( double  a,
const Efixedpoint b 
)
friend

Plaintext-ciphertext less-than-or-equal comparison.

Parameters
aThe plaintext double value.
bThe encrypted fixed-point value.
Returns
An Einteger representing the encrypted boolean result (1 if a <= b).

◆ operator<= [2/2]

const Einteger operator<= ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t less-than-or-equal comparison with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator== [1/2]

const Einteger operator== ( double  a,
const Efixedpoint b 
)
friend

Plaintext-ciphertext equality comparison.

Parameters
aThe plaintext double value.
bThe encrypted fixed-point value.
Returns
An Einteger representing the encrypted boolean result (1 if equal).

◆ operator== [2/2]

const Einteger operator== ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t equality comparison with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator> [1/2]

const Einteger operator> ( double  a,
const Efixedpoint b 
)
friend

Plaintext-ciphertext greater-than comparison.

Parameters
aThe plaintext double value.
bThe encrypted fixed-point value.
Returns
An Einteger representing the encrypted boolean result (1 if a

‍b).

◆ operator> [2/2]

const Einteger operator> ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t greater-than comparison with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

◆ operator>= [1/2]

const Einteger operator>= ( double  a,
const Efixedpoint b 
)
friend

Plaintext-ciphertext greater-than-or-equal comparison.

Parameters
aThe plaintext double value.
bThe encrypted fixed-point value.
Returns
An Einteger representing the encrypted boolean result (1 if a >= b).

◆ operator>= [2/2]

const Einteger operator>= ( uint64_t  a,
const Einteger b 
)
friend

Friend operator for plaintext uint64_t greater-than-or-equal comparison with Einteger.

Parameters
aThe plaintext unsigned integer.
bThe encrypted integer.
Returns
An Einteger representing the encrypted boolean result.

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