Documentation ¶
Index ¶
- Constants
- Variables
- type BElem
- func (a BElem) Add(b interface{}) RElem
- func (a BElem) AssertTypeFor(n RElem) RElem
- func (a BElem) Copy() RElem
- func (a BElem) Float64(fracBits int) float64
- func (a BElem) FromBigInt(n *big.Int) RElem
- func (a BElem) FromBytes(buf []byte) RElem
- func (a BElem) FromFloat64(n float64, fracBits int) RElem
- func (a BElem) FromInt(n int) RElem
- func (a BElem) FromUint64(n uint64) RElem
- func (a BElem) GetBit(posFromLSB int) uint
- func (a BElem) Inv() RElem
- func (a BElem) ModBitLength() int
- func (a BElem) Modulus() *big.Int
- func (a BElem) Mul(b interface{}) RElem
- func (a BElem) Neg() RElem
- func (a BElem) NumBytes() uint32
- func (a BElem) One() RElem
- func (a BElem) Rand(prg *frand.RNG) RElem
- func (a BElem) RandBits(prg *frand.RNG, nbits int) RElem
- func (a BElem) Sub(b interface{}) RElem
- func (a BElem) ToBytes(buf []byte)
- func (a BElem) Trunc(nBits int) RElem
- func (a BElem) TypeID() uint8
- func (a BElem) Uint64() uint64
- func (a BElem) Zero() RElem
- type LElem128
- func (a LElem128) Add(b interface{}) RElem
- func (a LElem128) AssertTypeFor(n RElem) RElem
- func (a LElem128) Copy() RElem
- func (a LElem128) ExitMForm() RElem
- func (a LElem128) Float64(fracBits int) float64
- func (a LElem128) FromBigFloat(n *big.Float, fracBits int) RElem
- func (a LElem128) FromBigInt(n *big.Int) RElem
- func (a LElem128) FromBytes(buf []byte) RElem
- func (a LElem128) FromFloat64(n float64, fracBits int) RElem
- func (a LElem128) FromInt(n int) RElem
- func (a LElem128) FromUint64(n uint64) RElem
- func (a LElem128) GetBit(posFromLSB int) uint
- func (a LElem128) Inv() RElem
- func (a LElem128) MForm() RElem
- func (a LElem128) ModBitLength() int
- func (a LElem128) Modulus() *big.Int
- func (a LElem128) Mul(b interface{}) RElem
- func (a LElem128) MulMForm(b interface{}) RElem
- func (a LElem128) Neg() RElem
- func (a LElem128) NumBytes() uint32
- func (a LElem128) One() RElem
- func (a LElem128) REDC(hi, lo Uint128) RElem
- func (a LElem128) Rand(prg *frand.RNG) RElem
- func (a LElem128) RandBits(prg *frand.RNG, nbits int) RElem
- func (a LElem128) Sub(b interface{}) RElem
- func (a LElem128) ToBigFloat(fracBits int) *big.Float
- func (a LElem128) ToBigInt() *big.Int
- func (a LElem128) ToBytes(buf []byte)
- func (a LElem128) ToSignedBigFloat(fracBits int) *big.Float
- func (a LElem128) ToSignedBigInt() *big.Int
- func (a LElem128) Trunc(nBits int) RElem
- func (a LElem128) TypeID() uint8
- func (a LElem128) Uint64() uint64
- func (a LElem128) Zero() RElem
- type LElem256
- func (a LElem256) Add(b interface{}) RElem
- func (a LElem256) AssertTypeFor(n RElem) RElem
- func (a LElem256) Copy() RElem
- func (a LElem256) Float64(fracBits int) float64
- func (a LElem256) FromBigFloat(n *big.Float, fracBits int) RElem
- func (a LElem256) FromBigInt(n *big.Int) RElem
- func (a LElem256) FromBytes(buf []byte) RElem
- func (a LElem256) FromFloat64(n float64, fracBits int) RElem
- func (a LElem256) FromInt(n int) RElem
- func (a LElem256) FromUint64(n uint64) RElem
- func (a LElem256) GetBit(posFromLSB int) uint
- func (a LElem256) Inv() RElem
- func (a LElem256) ModBitLength() int
- func (a LElem256) Modulus() *big.Int
- func (a LElem256) Mul(b interface{}) RElem
- func (a LElem256) Neg() RElem
- func (a LElem256) NumBytes() uint32
- func (a LElem256) One() RElem
- func (a LElem256) Rand(prg *frand.RNG) RElem
- func (a LElem256) RandBits(prg *frand.RNG, nbits int) RElem
- func (a LElem256) Sub(b interface{}) RElem
- func (a LElem256) ToBigFloat(fracBits int) *big.Float
- func (a LElem256) ToBigInt() *big.Int
- func (a LElem256) ToBytes(buf []byte)
- func (a LElem256) ToSignedBigFloat(fracBits int) *big.Float
- func (a LElem256) ToSignedBigInt() *big.Int
- func (a LElem256) Trunc(nBits int) RElem
- func (a LElem256) TypeID() uint8
- func (a LElem256) Uint64() uint64
- func (a LElem256) Zero() RElem
- type LElem2N
- func (a LElem2N) Add(b interface{}) RElem
- func (a LElem2N) AssertTypeFor(n RElem) RElem
- func (a LElem2N) Copy() RElem
- func (a LElem2N) Float64(fracBits int) float64
- func (a LElem2N) FromBigInt(n *big.Int) RElem
- func (a LElem2N) FromBytes(buf []byte) RElem
- func (a LElem2N) FromFloat64(n float64, fracBits int) RElem
- func (a LElem2N) FromInt(n int) RElem
- func (a LElem2N) FromUint64(n uint64) RElem
- func (a LElem2N) GetBit(posFromLSB int) uint
- func (a LElem2N) Inv() RElem
- func (a LElem2N) ModBitLength() int
- func (a LElem2N) Modulus() *big.Int
- func (a LElem2N) Mul(b interface{}) RElem
- func (a LElem2N) Neg() RElem
- func (a LElem2N) NumBytes() uint32
- func (a LElem2N) One() RElem
- func (a LElem2N) Rand(prg *frand.RNG) RElem
- func (a LElem2N) RandBits(prg *frand.RNG, nbits int) RElem
- func (a LElem2N) Sub(b interface{}) RElem
- func (a LElem2N) ToBytes(buf []byte)
- func (a LElem2N) Trunc(nBits int) RElem
- func (a LElem2N) TypeID() uint8
- func (a LElem2N) Uint64() uint64
- func (a LElem2N) Zero() RElem
- type LElem2NBigInt
- func (a LElem2NBigInt) Add(b interface{}) RElem
- func (a LElem2NBigInt) AssertTypeFor(n RElem) RElem
- func (a LElem2NBigInt) Copy() RElem
- func (a LElem2NBigInt) Float64(fracBits int) float64
- func (a LElem2NBigInt) FromBigFloat(n *big.Float, fracBits int) RElem
- func (a LElem2NBigInt) FromBigInt(n *big.Int) RElem
- func (a LElem2NBigInt) FromBytes(buf []byte) RElem
- func (a LElem2NBigInt) FromFloat64(n float64, fracBits int) RElem
- func (a LElem2NBigInt) FromInt(n int) RElem
- func (a LElem2NBigInt) FromUint64(n uint64) RElem
- func (a LElem2NBigInt) GetBit(posFromLSB int) uint
- func (a LElem2NBigInt) Inv() RElem
- func (a LElem2NBigInt) ModBitLength() int
- func (a LElem2NBigInt) Modulus() *big.Int
- func (a LElem2NBigInt) Mul(b interface{}) RElem
- func (a LElem2NBigInt) Neg() RElem
- func (a LElem2NBigInt) NumBytes() uint32
- func (a LElem2NBigInt) One() RElem
- func (a LElem2NBigInt) Rand(prg *frand.RNG) RElem
- func (a LElem2NBigInt) RandBits(prg *frand.RNG, nbits int) RElem
- func (a LElem2NBigInt) SetModulusPowerOf2(k uint)
- func (a LElem2NBigInt) Sub(b interface{}) RElem
- func (a LElem2NBigInt) ToBigFloat(fracBits int) *big.Float
- func (a LElem2NBigInt) ToBigInt() *big.Int
- func (a LElem2NBigInt) ToBytes(buf []byte)
- func (a LElem2NBigInt) ToSignedBigFloat(fracBits int) *big.Float
- func (a LElem2NBigInt) ToSignedBigInt() *big.Int
- func (a LElem2NBigInt) Trunc(nBits int) RElem
- func (a LElem2NBigInt) TypeID() uint8
- func (a LElem2NBigInt) Uint64() uint64
- func (a LElem2NBigInt) Zero() RElem
- type LElemP
- func (a LElemP) Add(b interface{}) RElem
- func (a LElemP) AssertTypeFor(n RElem) RElem
- func (a LElemP) Copy() RElem
- func (a LElemP) Float64(fracBits int) float64
- func (a LElemP) FromBigInt(n *big.Int) RElem
- func (a LElemP) FromBytes(buf []byte) RElem
- func (a LElemP) FromFloat64(n float64, fracBits int) RElem
- func (a LElemP) FromInt(n int) RElem
- func (a LElemP) FromUint64(n uint64) RElem
- func (a LElemP) GetBit(posFromLSB int) uint
- func (a LElemP) Inv() RElem
- func (a LElemP) ModBitLength() int
- func (a LElemP) Modulus() *big.Int
- func (a LElemP) Mul(b interface{}) RElem
- func (a LElemP) Neg() RElem
- func (a LElemP) NumBytes() uint32
- func (a LElemP) One() RElem
- func (a LElemP) Rand(prg *frand.RNG) RElem
- func (a LElemP) RandBits(prg *frand.RNG, nbits int) RElem
- func (a LElemP) Sub(b interface{}) RElem
- func (a LElemP) ToBytes(buf []byte)
- func (a LElemP) Trunc(nBits int) RElem
- func (a LElemP) TypeID() uint8
- func (a LElemP) Uint64() uint64
- func (a LElemP) Zero() RElem
- type RElem
- type RMat
- func (a RMat) Add(b RMat)
- func (a RMat) AddScalar(b RElem)
- func (a RMat) Clear()
- func (a RMat) Copy() RMat
- func (a RMat) Dims() (int, int)
- func (a RMat) MarshalBinary() ([]byte, error)
- func (a RMat) MulElem(b RMat)
- func (a RMat) MulScalar(b RElem)
- func (a RMat) NumBytes() uint32
- func (a RMat) Sub(b RMat)
- func (a RMat) Sum(axis int) RVec
- func (a RMat) ToFloat(fracBits int) [][]float64
- func (a RMat) ToInt() [][]int
- func (a RMat) Transpose() RMat
- func (a RMat) Trunc(nBits int)
- func (a RMat) Type() RElem
- func (a *RMat) UnmarshalBinary(data []byte) error
- type RVec
- func (a RVec) Add(b RVec)
- func (a RVec) AddScalar(b RElem)
- func (a RVec) Clear()
- func (a RVec) Copy() RVec
- func (a RVec) Filter(filt []bool) RVec
- func (a RVec) MarshalBinary() ([]byte, error)
- func (a RVec) MulElem(b RVec)
- func (a RVec) MulScalar(b RElem)
- func (a RVec) NumBytes() uint32
- func (a RVec) Sub(b interface{})
- func (a RVec) ToFloat(fracBits int) []float64
- func (a RVec) ToInt() []int
- func (a RVec) Trunc(nBits int)
- func (a RVec) Type() RElem
- func (a *RVec) UnmarshalBinary(data []byte) error
- type SElemC
- func (a SElemC) Add(b interface{}) RElem
- func (a SElemC) AssertTypeFor(n RElem) RElem
- func (a SElemC) Copy() RElem
- func (a SElemC) Float64(fracBits int) float64
- func (a SElemC) FromBigInt(n *big.Int) RElem
- func (a SElemC) FromBytes(buf []byte) RElem
- func (a SElemC) FromFloat64(n float64, fracBits int) RElem
- func (a SElemC) FromInt(n int) RElem
- func (a SElemC) FromUint64(n uint64) RElem
- func (a SElemC) GetBit(posFromLSB int) uint
- func (a SElemC) Inv() RElem
- func (a SElemC) ModBitLength() int
- func (a SElemC) Modulus() *big.Int
- func (a SElemC) Mul(b interface{}) RElem
- func (a SElemC) Neg() RElem
- func (a SElemC) NumBytes() uint32
- func (a SElemC) One() RElem
- func (a SElemC) Rand(prg *frand.RNG) RElem
- func (a SElemC) RandBits(prg *frand.RNG, nbits int) RElem
- func (a SElemC) Sub(b interface{}) RElem
- func (a SElemC) ToBytes(buf []byte)
- func (a SElemC) Trunc(nBits int) RElem
- func (a SElemC) TypeID() uint8
- func (a SElemC) Uint64() uint64
- func (a SElemC) Zero() RElem
- type SElemDS
- func (a SElemDS) Add(b interface{}) RElem
- func (a SElemDS) AssertTypeFor(n RElem) RElem
- func (a SElemDS) Copy() RElem
- func (a SElemDS) Float64(fracBits int) float64
- func (a SElemDS) FromBigInt(n *big.Int) RElem
- func (a SElemDS) FromBytes(buf []byte) RElem
- func (a SElemDS) FromFloat64(n float64, fracBits int) RElem
- func (a SElemDS) FromInt(n int) RElem
- func (a SElemDS) FromUint64(n uint64) RElem
- func (a SElemDS) GetBit(posFromLSB int) uint
- func (a SElemDS) Inv() RElem
- func (a SElemDS) ModBitLength() int
- func (a SElemDS) Modulus() *big.Int
- func (a SElemDS) Mul(b interface{}) RElem
- func (a SElemDS) Neg() RElem
- func (a SElemDS) NumBytes() uint32
- func (a SElemDS) One() RElem
- func (a SElemDS) Rand(prg *frand.RNG) RElem
- func (a SElemDS) RandBits(prg *frand.RNG, nbits int) RElem
- func (a SElemDS) Sub(b interface{}) RElem
- func (a SElemDS) ToBytes(buf []byte)
- func (a SElemDS) Trunc(nBits int) RElem
- func (a SElemDS) TypeID() uint8
- func (a SElemDS) Uint64() uint64
- func (a SElemDS) Zero() RElem
- type Uint128
Constants ¶
View Source
const BElemUniqueID uint8 = 6
View Source
const LElem128Bytes uint32 = 16
View Source
const LElem128UniqueID uint8 = 4
View Source
const LElem256Bytes uint32 = 32 // Extra byte for sign bit for ease of marshalling
View Source
const LElem256UniqueID uint8 = 5
View Source
const LElem2NBigIntUniqueID uint8 = 7
View Source
const LElem2NUniqueID uint8 = 0
View Source
const LElemPMod64 uint64 = uint64(LElemPMod)
View Source
const LElemPUniqueID uint8 = 1
View Source
const SElemCMod16 uint16 = uint16(SElemCMod)
View Source
const SElemCUniqueID uint8 = 3
View Source
const SElemDSMod16 uint16 = uint16(SElemDSMod)
View Source
const SElemDSUniqueID uint8 = 2
Variables ¶
View Source
var BElemBits int = int(8 * BElemBytes)
View Source
var LElem128MFormNInv = LElem128Zero.FromBigInt(new(big.Int).Sub(new(big.Int).Lsh(big.NewInt(1), 128), new(big.Int).ModInverse(LElem128ModBig, new(big.Int).Lsh(big.NewInt(1), 128))))
View Source
var LElem128MFormR2 = LElem128Zero.FromBigInt(new(big.Int).Mod(new(big.Int).Lsh(big.NewInt(1), 2*128), LElem128ModBig))
View Source
var LElem128ModBig *big.Int = big.NewInt(0).Sub(big.NewInt(0).Exp(big.NewInt(2), big.NewInt(127), nil), big.NewInt(1))
View Source
var LElem128ModBitLen int = bits.Len64(LElem128Mod.Hi) + 64
View Source
var LElem128ModHalfBig *big.Int = big.NewInt(0).Exp(big.NewInt(2), big.NewInt(126), nil)
View Source
var LElem256Mod = LElem256{new(big.Int).Sub(big.NewInt(0).Lsh(big.NewInt(1), 256), big.NewInt(189))} // 2^256 - 189
View Source
var LElem256ModBitLen int = (LElem256Mod).Val.BitLen()
View Source
var LElem256ModHalf = LElem256{new(big.Int).Sub(big.NewInt(0).Lsh(big.NewInt(1), 255), big.NewInt(94))} // 2^255 - 94
View Source
var LElem2NBigIntModBitLen int // Variable set on the fly
View Source
var LElem2NModBig *big.Int = big.NewInt(0).Add(big.NewInt(0).SetUint64(^uint64(0)), big.NewInt(1))
View Source
var LElem2NModBitLen int = 65
View Source
var SElemDSModBig *big.Int = big.NewInt(0).SetUint64(uint64(SElemDSMod))
View Source
var SElemDSModBitLen int = bits.Len64(uint64(SElemDSMod))
Functions ¶
This section is empty.
Types ¶
type BElem ¶
type BElem uint64
Bitwise sharing
func (BElem) AssertTypeFor ¶
func (BElem) FromUint64 ¶
func (BElem) ModBitLength ¶
type LElem128 ¶
type LElem128 Uint128
var LElem128RandBnd LElem128 = initLElem128RandBnd()
func (LElem128) AssertTypeFor ¶
func (LElem128) FromUint64 ¶
func (LElem128) ModBitLength ¶
func (LElem128) ToSignedBigInt ¶
type LElem256 ¶
func (LElem256) AssertTypeFor ¶
func (LElem256) FromUint64 ¶
func (LElem256) ModBitLength ¶
func (LElem256) ToSignedBigInt ¶
type LElem2N ¶
type LElem2N uint64
Large ring with power of two modulus
func (LElem2N) AssertTypeFor ¶
func (LElem2N) FromUint64 ¶
func (LElem2N) ModBitLength ¶
type LElem2NBigInt ¶
var LElem2NBigIntMod LElem2NBigInt // Variable set on the fly
var LElem2NBigIntModHalf LElem2NBigInt // Variable set on the fly
var LElem2NBigIntZero LElem2NBigInt = LElem2NBigInt{big.NewInt(0)}
func (LElem2NBigInt) Add ¶
func (a LElem2NBigInt) Add(b interface{}) RElem
func (LElem2NBigInt) AssertTypeFor ¶
func (a LElem2NBigInt) AssertTypeFor(n RElem) RElem
func (LElem2NBigInt) Copy ¶
func (a LElem2NBigInt) Copy() RElem
func (LElem2NBigInt) Float64 ¶
func (a LElem2NBigInt) Float64(fracBits int) float64
func (LElem2NBigInt) FromBigFloat ¶
func (a LElem2NBigInt) FromBigFloat(n *big.Float, fracBits int) RElem
func (LElem2NBigInt) FromBigInt ¶
func (a LElem2NBigInt) FromBigInt(n *big.Int) RElem
func (LElem2NBigInt) FromBytes ¶
func (a LElem2NBigInt) FromBytes(buf []byte) RElem
func (LElem2NBigInt) FromFloat64 ¶
func (a LElem2NBigInt) FromFloat64(n float64, fracBits int) RElem
func (LElem2NBigInt) FromInt ¶
func (a LElem2NBigInt) FromInt(n int) RElem
func (LElem2NBigInt) FromUint64 ¶
func (a LElem2NBigInt) FromUint64(n uint64) RElem
func (LElem2NBigInt) GetBit ¶
func (a LElem2NBigInt) GetBit(posFromLSB int) uint
func (LElem2NBigInt) Inv ¶
func (a LElem2NBigInt) Inv() RElem
func (LElem2NBigInt) ModBitLength ¶
func (a LElem2NBigInt) ModBitLength() int
func (LElem2NBigInt) Modulus ¶
func (a LElem2NBigInt) Modulus() *big.Int
func (LElem2NBigInt) Mul ¶
func (a LElem2NBigInt) Mul(b interface{}) RElem
func (LElem2NBigInt) Neg ¶
func (a LElem2NBigInt) Neg() RElem
func (LElem2NBigInt) NumBytes ¶
func (a LElem2NBigInt) NumBytes() uint32
func (LElem2NBigInt) One ¶
func (a LElem2NBigInt) One() RElem
func (LElem2NBigInt) SetModulusPowerOf2 ¶
func (a LElem2NBigInt) SetModulusPowerOf2(k uint)
func (LElem2NBigInt) Sub ¶
func (a LElem2NBigInt) Sub(b interface{}) RElem
func (LElem2NBigInt) ToBigFloat ¶
func (a LElem2NBigInt) ToBigFloat(fracBits int) *big.Float
func (LElem2NBigInt) ToBigInt ¶
func (a LElem2NBigInt) ToBigInt() *big.Int
func (LElem2NBigInt) ToBytes ¶
func (a LElem2NBigInt) ToBytes(buf []byte)
func (LElem2NBigInt) ToSignedBigFloat ¶
func (a LElem2NBigInt) ToSignedBigFloat(fracBits int) *big.Float
func (LElem2NBigInt) ToSignedBigInt ¶
func (a LElem2NBigInt) ToSignedBigInt() *big.Int
func (LElem2NBigInt) Trunc ¶
func (a LElem2NBigInt) Trunc(nBits int) RElem
func (LElem2NBigInt) TypeID ¶
func (a LElem2NBigInt) TypeID() uint8
func (LElem2NBigInt) Uint64 ¶
func (a LElem2NBigInt) Uint64() uint64
func (LElem2NBigInt) Zero ¶
func (a LElem2NBigInt) Zero() RElem
type LElemP ¶
type LElemP uint64
Large ring with prime modulus
const LElemPMod LElemP = 2305843009213693951 // 2^61 - 1
const LElemPModHalf LElemP = 1152921504606846976 // 2^60
func (LElemP) AssertTypeFor ¶
func (LElemP) FromUint64 ¶
func (LElemP) ModBitLength ¶
type RElem ¶
type RElem interface { Mul(interface{}) RElem Add(interface{}) RElem Sub(interface{}) RElem Neg() RElem Inv() RElem Zero() RElem One() RElem Modulus() *big.Int Uint64() uint64 Float64(int) float64 FromInt(int) RElem FromBigInt(*big.Int) RElem FromUint64(uint64) RElem FromFloat64(float64, int) RElem FromBytes([]byte) RElem ToBytes([]byte) AssertTypeFor(RElem) RElem NumBytes() uint32 Rand(*frand.RNG) RElem RandBits(*frand.RNG, int) RElem TypeID() uint8 ModBitLength() int GetBit(int) uint Trunc(int) RElem Copy() RElem }
type RMat ¶
type RMat []RVec
func RMultConstMat ¶
MultConstMat multiplies c with each element in m (and performs appr modulus)
func RMultElemMat ¶
func (RMat) MarshalBinary ¶
func (*RMat) UnmarshalBinary ¶
type RVec ¶
type RVec []RElem
func RMultConstVec ¶
MultConstVec multiplies c with each element in v (and performs appr modulus)
func RMultMatVec ¶
func (RVec) MarshalBinary ¶
func (*RVec) UnmarshalBinary ¶
type SElemC ¶
type SElemC uint8
Small ring used for comparison
const SElemCMod SElemC = 199
func (SElemC) AssertTypeFor ¶
func (SElemC) FromUint64 ¶
func (SElemC) ModBitLength ¶
type SElemDS ¶
type SElemDS uint8
Small ring used for division and square root
const SElemDSMod SElemDS = 199
const SElemDSRandBnd SElemDS = ^SElemDS(0) - ((^SElemDS(0)) % SElemDSMod)
func (SElemDS) AssertTypeFor ¶
func (SElemDS) FromUint64 ¶
func (SElemDS) ModBitLength ¶
Click to show internal directories.
Click to hide internal directories.