Documentation
¶
Overview ¶
Package algebrautils provides utilities for working with algebraic structures such as monoids, groups, rings, and fields.
See README.md for details.
Index ¶
- Variables
- func Fold[S algebra.Operand[S]](first S, rest ...S) S
- func MultiScalarMul[E algebra.MonoidElement[E], S algebra.Numeric](scalars []S, points []E) E
- func Prod[M algebra.Multiplicand[M]](first M, rest ...M) M
- func RandomNonIdentity[M interface{ ... }, E algebra.MonoidElement[E]](m M, prng io.Reader) (E, error)
- func ScalarMul[E algebra.MonoidElement[E], S algebra.Numeric](base E, exponent S) E
- func Sum[S algebra.Summand[S]](first S, rest ...S) S
Constants ¶
This section is empty.
Variables ¶
var ErrArgumentIsNil = errs.New("argument is nil")
Functions ¶
func Fold ¶
Fold applies the binary operation of the given operand type to all provided elements, returning the final result.
func MultiScalarMul ¶
func MultiScalarMul[E algebra.MonoidElement[E], S algebra.Numeric]( scalars []S, points []E, ) E
MultiScalarMul performs a Pippenger-style multi-scalar multiplication:
sum_i scalars[i] * points[i]
using a fixed window size w.
It assumes S.Bytes() is big-endian. Bits are extracted in LSB-first order.
func Prod ¶
func Prod[M algebra.Multiplicand[M]](first M, rest ...M) M
Prod applies the multiplication operation of the given multiplicand type to all provided elements, returning the final result.
func RandomNonIdentity ¶
func RandomNonIdentity[M interface {
algebra.FiniteStructure[E]
algebra.Monoid[E]
}, E algebra.MonoidElement[E]](m M, prng io.Reader) (E, error)
RandomNonIdentity samples a random element from the given finite monoid that is not the identity element.
Types ¶
This section is empty.