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

164 algebra tests #195

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

164 algebra tests #195

wants to merge 23 commits into from

Conversation

alexallmont
Copy link
Contributor

No description provided.

inakleinbottle and others added 8 commits February 12, 2025 14:54
Added a fixture for constructing free tensors with rational polynomial coefficients for running precise tests on free tensors.

(cherry picked from commit e691b0c)
- Added tests for constructors, add, sub, uminus, smul.
- Iterator test is work in progress with TODO where value needs to be checked. Need to confirm correct API here with Sam.
- Remaining tests are placeholder TEST_Fs to wrap before PR.
- tensor_fixture.h methods extended. `generic_tensor` replaced with more meaningful `make_ones_tensor`. Complementary functions `make_ns_tensor` used in new tests as LAL was only checking values where all coefficients were 1, but new tests check broader values. `make_tensor` takes a generic function for initialising each coefficient.
- `test_free_tensor` and `test_lie` updated with new fixture.

(cherry picked from commit 2f32c0e)
- For equality, the scalar must be created with the same coeff_type as the original tensor.
- Also fixed to compare number of iterations against dimension and not size. The latter reflects the size of the stored data - without null set - whereas dimension includes it.

(cherry picked from commit 08a834d)
- For brevity, consistency and locality, each inplace test is appended to the end of each corresponding non-inplace method. Otherwise we have duplicate code computing the expected value.
- Replaced make_ns_tensor with make_ones_tensor after discussing with Sam, as the former is technically testing a more nuanced case that we will pick up in other tests.

(cherry picked from commit 1aeae2f)
- Checks context, basis, dimension, size, width, depth, degree.
- Constructs custom tensor with zeros after cutoff point to confirm that size() does not count zero intermediate values.

(cherry picked from commit ce4b842)
- Rename DenseTensorFixture to TestDenseTensor.
- Use CamelCase for test names.
- Add ASSERT_TENSOR_EQ helper function that prints the values of result and expected if difference.
- Split context out of TensorFixture into TensorBuilder to allow for tests to easily instantiate types of context where needed.
- Check the return results of any inplace operations (search for inplace_copy)
- Bug found whilst adding test as method was not making any changes.
- Add unit tests for add_scal_mul with same matching and differing indeterminates, and check it throws exception if context is not valid.
@alexallmont alexallmont linked an issue Feb 13, 2025 that may be closed by this pull request
- After adding free tensor unit tests, Windows builds failed on CI with messages like `error LNK2001: unresolved external symbol __gmpq_set`, most likely because it needs dllimport/export defined.
- It should be OK to add this explicitly here as GMP will be statically linked only to this test exe. More caution is necessary with GMP in broader linkage of libs to avoid duplicate symbols.
- Also add unit test based on TestAddScalMulDiffIndeterminate
- Includes three cases for: 1) a valid rational division; 2) an invalid division by zero raises an exception; 3) attempting to divide by an indeterminate cannot be computed and also raises an exception.
- This test checking the 'is_zero' code paths in the multiplication.
- Recreates the old lib algebra lite accessor methods using the new RoughPy interface.
- Primarily will be used in multiplication tests to recreate expected values.
- Includes naive implementation of polynomial expansion by combination of split words that make up each possible polynomial in free tensor blob.
- Helper class moved out in anticipation of moving size/start methods in test_dense_tensor
- Added make_mul_tensor equivalent of make_tensor in anticipation of remaining multiplication tests.
- Duplicates of constructor tests but using operator=.
- Use is_zero to check for valid/invalid state after copy/move.
- Check mul_implace behaves same as mul as in other tests.
- Confirm that different widths multiplies raise error.
- borrow and dense data methods are implicitly checked from other tests.
- Simple case of null implementation along with checking actual value.
- Unlike scal_div, it is valid to operate on an indeterminate scalar value.
@alexallmont alexallmont self-assigned this Feb 28, 2025
@alexallmont alexallmont marked this pull request as ready for review February 28, 2025 19:06
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.

Bolster algebra C++ unit tests
2 participants