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 support for intermediate variables (scalars, vectors, matrices) #61

Closed
3 tasks done
Tracked by #77 ...
tohrnii opened this issue Nov 3, 2022 · 1 comment
Closed
3 tasks done
Tracked by #77 ...

Comments

@tohrnii
Copy link
Contributor

tohrnii commented Nov 3, 2022

We should add support for variables. The syntax was defined by @bobbinth in the original Constraints Description Language discussion here. Taken from @bobbinth's original post:

A variable is defined using a let keyword. For e.g., let a = b * c

Variables could be of the following three types:

  • scalars
  • vectors
  • matrices

Declaring variables could be done like so:

trace_columns:
  main: [a, b, c]
transition_constraints:
  let x = a + 123 // a scalar variable
  let y = [a + 1, b + 2, c + 3] // a vector variable
  let z = [
    [a + 1, b + 2, c + 3],
    [a + 4, b + 5, c + 6],
  ] // a matrix variable

Referring to vector variables inside expressions could be done with index notation:

let a = [m, n]
let x = a[0] + 1

We could build variables from column references as well:

trace_columns:
  main: [a, b]

let x = [a, b]   // x is a vector with current values from a and b
let y = [a', b'] // y is a vector with next values from a and b

Variables should only be defined in boundary_constraints and transition_constraints sections.

This task involves making changes to the parser, IR and codegen.

  • parser
  • IR
  • codegen
@tohrnii
Copy link
Contributor Author

tohrnii commented Dec 22, 2022

Variable support is remaining for boundary constraints. The issue has been moved to #106.

Closed by #100.

@tohrnii tohrnii closed this as completed Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant