Skip to content

Wrong documentation about Cartesian product constraint #345

@AlexanderKeijzer

Description

@AlexanderKeijzer

The indexing of cartesian products is off by one. In the Python documentation and Rust docs the index starts at 0.
However, the code asserts that the index ends at the length of the vector (and therefore starts at 1):

assert!(x.len() == self.dimension(), "x has wrong size");

And then loops until index-1 (and therefore my final index should be N not N-1):

This should probably be changed in the docs as changing the code will break all implementations. However, starting the index at 1 is quite unintuitive when used in Rust and should be documented well.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions