Sign in

    luna-poly

    A generic polynomial lib, a part of LunaFlow.

    polynomial
    symbolic-methods
    numerical-methods
    math
    Download zip
    Author
    Version
    0.1.1-beta-1
    License
    MIT
    Last updated
    last year
    Downloads
    144

    #luna-poly

    This is a polynomial library written using MoonBit, aiming to fill the gap in scientific computing applications in the MoonBit ecosystem.

    HomomorphismNat

    trait HomomorphismNat

    ExpVec

    type ExpVec

    ExpVec::length

    fn ExpVec::length(self : ExpVec) -> Int

    ExpVec::new

    fn ExpVec::new() -> ExpVec

    ExpVec::op_get

    fn ExpVec::op_get(self : ExpVec, i : Int) -> UInt

    ExpVec::op_set

    fn ExpVec::op_set(self : ExpVec, i : Int, val : UInt) -> Unit

    Polynomial

    type Polynomial[V]
    A dense polynomial implementation.
    impl Compare for Polynomial[V]
    impl Eq for Polynomial[V]

    Polynomial::fold

    fn[A, B] Polynomial::fold(self : Polynomial[A], f : (B, A) -> B, init~ : B) -> B
    Fold over the polynomial.

    Polynomial::leading_coefficient

    fn[A] Polynomial::leading_coefficient(self : Polynomial[A]) -> A?
    Return the leading coefficient of the polynomial.

    Polynomial::leading_term

    fn[A] Polynomial::leading_term(self : Polynomial[A]) -> (Int, A)?
    Return the leading term of the polynomial.

    Polynomial::length

    fn[A] Polynomial::length(self : Polynomial[A]) -> Int
    Return the length of the polynomial.

    Polynomial::substitute_poly

    Substitute a polynomial's variable with another polynomial.

    SparsePolynomial

    type SparsePolynomial[V]

    impl Eq for SparsePolynomial[V]

    SparsePolynomial::add

    this is inplace version of op_add

    SparsePolynomial::add_term

    SparsePolynomial::add_term_inplace

    fn[V : Eq +
    AddMonoid
    + Add +
    Zero
    ] SparsePolynomial::add_term_inplace(self : SparsePolynomial[V], exp_vec : ExpVec, coefficient : V) -> Unit

    SparsePolynomial::clear

    fn[V] SparsePolynomial::clear(self : SparsePolynomial[V]) -> Unit

    SparsePolynomial::contains

    fn[V] SparsePolynomial::contains(self : SparsePolynomial[V], exp_vec : ExpVec) -> Bool

    SparsePolynomial::each

    fn[V] SparsePolynomial::each(self : SparsePolynomial[V], f : (ExpVec, V) -> Unit) -> Unit

    SparsePolynomial::eachi

    fn[V] SparsePolynomial::eachi(self : SparsePolynomial[V], f : (Int, ExpVec, V) -> Unit) -> Unit

    SparsePolynomial::get

    fn[V] SparsePolynomial::get(self : SparsePolynomial[V], exp_vec : ExpVec) -> V?

    SparsePolynomial::is_empty

    fn[V] SparsePolynomial::is_empty(self : SparsePolynomial[V]) -> Bool

    SparsePolynomial::iter

    fn[V] SparsePolynomial::iter(self : SparsePolynomial[V]) -> Iter[(ExpVec, V)]

    SparsePolynomial::iter2

    fn[V] SparsePolynomial::iter2(self : SparsePolynomial[V]) -> Iter2[ExpVec, V]

    SparsePolynomial::keys

    fn[V] SparsePolynomial::keys(self : SparsePolynomial[V]) -> Array[ExpVec]

    SparsePolynomial::new

    SparsePolynomial::op_get

    fn[V] SparsePolynomial::op_get(self : SparsePolynomial[V], exp_vec : ExpVec) -> V?

    SparsePolynomial::op_set

    fn[V] SparsePolynomial::op_set(self : SparsePolynomial[V], exp_vec : ExpVec, coefficient : V) -> Unit

    SparsePolynomial::range

    fn[V] SparsePolynomial::range(self : SparsePolynomial[V], low : ExpVec, hight : ExpVec) -> Iter2[ExpVec, V]

    SparsePolynomial::remove

    fn[V] SparsePolynomial::remove(self : SparsePolynomial[V], exp_vec : ExpVec) -> Unit

    SparsePolynomial::size

    fn[V] SparsePolynomial::size(self : SparsePolynomial[V]) -> Int

    SparsePolynomial::to_array

    fn[V] SparsePolynomial::to_array(self : SparsePolynomial[V]) -> Array[(ExpVec, V)]

    SparsePolynomial::values

    fn[V] SparsePolynomial::values(self : SparsePolynomial[V]) -> Array[V]

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io