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

chore: use rust documentation style for tooling support #54

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions chips/src/assert_sorted/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,19 @@ pub mod trace;
pub struct AssertSortedAir {
#[getset(get = "pub")]
is_less_than_tuple_air: IsLessThanTupleAir,
// The keys to check for sortedness
/// The keys to check for sortedness
#[getset(get = "pub")]
keys: Vec<Vec<u32>>,
}

/**
* This chip constrains that consecutive rows are sorted lexicographically.
*
* Each row consists of a key decomposed into limbs. Each limb has its own max number of
* bits, given by the limb_bits array. The chip assumes that each limb is within its
* given max limb_bits.
*
* The AssertSortedChip uses the IsLessThanTupleChip as a subchip to check that the rows
* are sorted lexicographically.
*/
/// This chip constrains that consecutive rows are sorted lexicographically.
///
/// Each row consists of a key decomposed into limbs. Each limb has its own max number of
/// bits, given by the limb_bits array. The chip assumes that each limb is within its
/// given max limb_bits.
///
/// The AssertSortedChip uses the IsLessThanTupleChip as a subchip to check that the rows
/// are sorted lexicographically.
#[derive(Default)]
pub struct AssertSortedChip {
air: AssertSortedAir,
Expand Down
2 changes: 1 addition & 1 deletion chips/src/assert_sorted/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use assert_sorted::AssertSortedChip;
use p3_baby_bear::BabyBear;
use p3_matrix::dense::DenseMatrix;

/**
/*
* Testing strategy for the assert sorted chip:
* partition on limb_bits:
* limb_bits < 20
Expand Down
18 changes: 8 additions & 10 deletions chips/src/is_less_than/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ pub mod trace;
#[derive(Default, Clone, CopyGetters)]
#[getset(get_copy = "pub")]
pub struct IsLessThanAir {
// The bus index for sends to range chip
/// The bus index for sends to range chip
bus_index: usize,
// The maximum range for the range checker
/// The maximum range for the range checker
range_max: u32,
// The maximum number of bits for the numbers to compare
/// The maximum number of bits for the numbers to compare
limb_bits: usize,
// The number of bits to decompose each number into, for less than checking
/// The number of bits to decompose each number into, for less than checking
decomp: usize,
// num_limbs is the number of limbs we decompose each input into, not including the last shifted limb
#[getset(get_copy)]
Expand All @@ -39,12 +39,10 @@ impl IsLessThanAir {
}
}

/**
* This chip checks whether one number is less than another. The two numbers have a max number of bits,
* given by limb_bits. The chip assumes that the two numbers are within limb_bits bits. The chip compares
* the numbers by decomposing them into limbs of size decomp bits, and interacts with a RangeCheckerGateChip
* to range check the decompositions.
*/
/// This chip checks whether one number is less than another. The two numbers have a max number of bits,
/// given by limb_bits. The chip assumes that the two numbers are within limb_bits bits. The chip compares
/// the numbers by decomposing them into limbs of size decomp bits, and interacts with a RangeCheckerGateChip
/// to range check the decompositions.
#[derive(Default, Getters)]
pub struct IsLessThanChip {
pub air: IsLessThanAir,
Expand Down
22 changes: 10 additions & 12 deletions chips/src/is_less_than_tuple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ pub mod trace;
#[derive(Default, CopyGetters)]
#[getset(get_copy = "pub")]
pub struct IsLessThanTupleAir {
// The bus index for sends to range chip
/// The bus index for sends to range chip
bus_index: usize,
// The maximum range for the range checker
/// The maximum range for the range checker
range_max: u32,
// The number of bits to decompose each number into, for less than checking
/// The number of bits to decompose each number into, for less than checking
decomp: usize,
// IsLessThanAirs for each tuple element
/// IsLessThanAirs for each tuple element
#[getset(skip)]
is_less_than_airs: Vec<IsLessThanAir>,
}
Expand Down Expand Up @@ -53,14 +53,12 @@ impl IsLessThanTupleAir {
}
}

/**
* This chip computes whether one tuple is lexicographically less than another. Each element of the
* tuple has its own max number of bits, given by the limb_bits array. The chip assumes that each limb
* is within its given max limb_bits.
*
* The IsLessThanTupleChip uses the IsLessThanChip as a subchip to check whether individual tuple elements
* are less than each other.
*/
/// This chip computes whether one tuple is lexicographically less than another. Each element of the
/// tuple has its own max number of bits, given by the limb_bits array. The chip assumes that each limb
/// is within its given max limb_bits.
///
/// The IsLessThanTupleChip uses the IsLessThanChip as a subchip to check whether individual tuple elements
/// are less than each other.
#[derive(Default)]
pub struct IsLessThanTupleChip {
pub air: IsLessThanTupleAir,
Expand Down
Loading