Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add circle evaluation #100

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

atgrosso
Copy link

@atgrosso atgrosso commented Oct 1, 2024

Depends on #99


This change is Reviewable

Copy link
Contributor

@andrewmilson andrewmilson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 9 of 10 files at r1, all commit messages.
Reviewable status: 9 of 10 files reviewed, 6 unresolved discussions (waiting on @atgrosso)


stwo_cairo_verifier/src/poly/circle.cairo line 24 at r1 (raw file):

pub impl CircleDomainImpl of CircleDomainTrait {
    /// Given a coset C + <G_n>, constructs the circle domain +-C + <G_n> (i.e.,
    /// this coset and its conjugate).

Suggestion:

    /// Given a coset `C + <G_n>`, constructs the circle domain `+-C + <G_n>` (i.e.
    /// this coset and its conjugate).

stwo_cairo_verifier/src/poly/circle.cairo line 44 at r1 (raw file):

            self.half_coset.index_at(index)
        } else {
            CIRCLE_ORDER - self.half_coset.index_at(index - self.half_coset.size())

Suggestion:

CIRCLE_ORDER.wrapping_sub(self.half_coset.index_at(index - self.half_coset.size()))

stwo_cairo_verifier/src/poly/circle.cairo line 59 at r1 (raw file):

/// An evaluation defined on a [CircleDomain].
/// The values are ordered according to the [CircleDomain] ordering.

Suggestion:

/// An evaluation defined on a [CircleDomain].
///
/// The values are ordered according to the [CircleDomain] ordering.

stwo_cairo_verifier/src/poly/circle.cairo line 61 at r1 (raw file):

/// The values are ordered according to the [CircleDomain] ordering.
#[derive(Debug, Drop, Clone, PartialEq, Eq)]
pub struct CircleEvaluation {

Mind bringing over EvalOrder please?
I think it's important documenting information.
Just add the BitReversedOrder struct given NaturalOrder isn't needed.

Code quote:

pub struct CircleEvaluation {

stwo_cairo_verifier/src/poly/circle.cairo line 121 at r1 (raw file):

#[test]
fn test_circle_domain_at_1() {

Please put all the tests in a module.

Suggestion:

#[cfg(test)]
mod tests {
    #[test]
    fn test_circle_domain_at_1() {

stwo_cairo_verifier/src/poly/circle.cairo line 188 at r1 (raw file):

    };

    assert_eq!(expected_result, result);

Suggestion:

    assert_eq!(result, SparseCircleEvaluation {
        subcircle_evals: array![
            CircleEvaluation {
                values: array![
                    qm31(667173716, 1020487722, 1791736788, 1346152946),
                    qm31(1471361534, 84922130, 1076528072, 810417939)
                ],
                domain: CircleDomain { half_coset: CosetImpl::new(16777216, 0) }
            },
            CircleEvaluation {
                values: array![
                    qm31(667173716, 1020487722, 1791736788, 1346152946),
                    qm31(1471361534, 84922130, 1076528072, 810417939)
                ],
                domain: CircleDomain { half_coset: CosetImpl::new(2030043136, 0) }
            },
            CircleEvaluation {
                values: array![
                    qm31(1480309931, 1126995925, 355746859, 801330701),
                    qm31(676122113, 2062561517, 1070955575, 1337065708)
                ],
                domain: CircleDomain { half_coset: CosetImpl::new(2097152000, 0) }
            },
        ]
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants