Skip to content

Subtraction in linear combination #66

@mmaker

Description

@mmaker

Currently we can set subtraction in a LinearCombination in the following way:

    let mut linear_relation = LinearRelation::<G>::new();
    let x_var = linear_relation.allocate_scalar();
    let B_var = linear_relation.allocate_element();
    let X_var = linear_relation.allocate_eq((x_var + (-G::Scalar::from_u128(1u128))) * B_var);
    linear_relation.set_element(B_var, B);
    linear_relation.set_element(X_var, X);

as in https://github.com/mmaker/sigma-rs/blob/main/src/tests/test_relations.rs#L280-L286.

It would be ideal to write more simply.

(x_var - G::Scalar::from_u128(1u128)) * B_var

and even more simply

(x_var - 1) * B_var

This issue is to keep track of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions