Commit Graph

352 Commits

Author SHA1 Message Date
Andreas Borgen Longva eb228faa2b
Improved stack! implementation, tests (#1375)
* Add macro for concatenating matrices

* Replace DimUnify with DimEq::representative

* Add some simple cat macro output generation tests

* Fix formatting in cat macro code

* Add random prefix to cat macro output

* Add simple quote_spanned for cat macro

* Use `generic_view_mut` in cat macro

* Fix clippy lints in cat macro

* Clean up documentation for cat macro

* Remove identity literal from cat macro

* Allow references in input to cat macro

* Rename cat macro to stack

* Add more stack macro tests

* Add comment to explain reason for prefix in stack! macro

* Refactor matrix!, stack! macros into separate modules

* Take all blocks by reference in stack! macro

* Make empty stack![] invocation well-defined

* Fix stack! macro incorrect reference to data

* More extensive tests for stack! macro

* Move nalgebra-macros tests to nalgebra tests

By testing matrix!, stack! macros etc. in nalgebra, we ensure that
these macros are used in the same way that users will be using them.

* Fix stack! code generation tests

* Add back nalgebra as dev-dependency of nalgebra-macros

* Fix accidental wrong matrix! macro references in docs

* Rewrite stack! documentation for clarity

* Formatting

* Skip formatting of macro, rustfmt messes it up

* Rewrite stack! impl for improved clarity, Span behavior

This improves error messages upon dimension mismatch, among other
things. I've also tried to make the implementation easier to understand,
adding some comments to help the reader understand the individual steps.

* Use SameNumberOfRows/Columns instead of DimEq in stack! macro

This gives more accurate compiler errors if matrix dimensions
are mismatched.

* Check that stack! panics at runtime for basic dimension mismatch

* Add suggested edge cases from initial PR to tests

* stack! impl: use fixed prefix everywhere

This ensures that the expected generated code in tests
is the actual generated code when used in the wild.

* nalgebra-macros: Remove clippy pedantic, fix clippy complaints

pedantic seems to be mostly intent on wasting the programmer's time

* Add stack! sanity tests for built-ins and Complex

* Fix formatting in test

* Improve readability of format_ident! calls in stack! impl

* fix trybuild tests

* chore: run tests with a specific rust version

* More trybuild fixes

---------

Co-authored-by: Birk Tjelmeland <git@birktj.no>
Co-authored-by: Sébastien Crozet <sebcrozet@dimforge.com>
2024-06-23 11:29:28 +02:00
Sébastien Crozet c23807ac5d
feat: use GAT to remove the scalar type T from the Allocator trait (#1397) 2024-06-12 11:16:06 +02:00
Jennifer Chukwu 343eb214ef format 2024-05-05 09:39:20 +00:00
Jennifer Chukwu 914a7cf1fa add assert 2024-05-02 14:36:28 +00:00
Jennifer Chukwu e3a08c9b60 test with a fixed input 2024-05-02 10:16:45 +00:00
Jennifer Chukwu 825d078294 add tests 2024-04-30 16:25:35 +00:00
Vollkornaffe c475c4000c
Fix numerical issue on SVD with near-identity matrix (#1369)
* fix: Normalize the column once more

The column may not be normalized if the `factor` is on a scale of 1e-40.
Possibly, f32 just runs out of precision.

There is likely a better solution to the problem.

* chore: Add test that fails before fix

* chore: add comment providing details on the householder fix.

* chore: rename regression test

---------

Co-authored-by: Sébastien Crozet <sebcrozet@dimforge.com>
2024-03-28 15:26:11 +01:00
Kurt Lawrence 6dce471297
Make OPoint call `T::fmt` to respect formatting modifiers (#1336) 2023-12-20 14:42:54 -08:00
Sébastien Crozet a91e3b0d89
Merge pull request #1315 from yotamofek/owned-view-iter
Allow creating matrix iter with an owned view
2023-11-12 23:29:41 +01:00
Yotam Ofek 1195eadd1a Allow creating matrix iter with an owned view 2023-11-12 08:19:29 +00:00
Rasmus Brönnegård 03c24fb369 Add unit tests for issue 1313 2023-11-09 00:53:42 +01:00
Sébastien Crozet 2521fd9851 Add a couple of additional catastrophic cancellation variance checks 2023-04-30 14:53:16 +02:00
vasil 75405b1e24 fix bug, add test in tests folder 2023-04-25 01:25:36 +03:00
Chris Ohk fd97a82926 fix: Correct minor typos 2023-02-01 15:48:06 +09:00
Sébastien Crozet bcfc20caba Fix duplicate import 2023-01-14 16:26:26 +01:00
Sébastien Crozet 711ac67da9 Deplecate Dynamic and Dynamic::new 2023-01-14 16:22:40 +01:00
Sébastien Crozet 3508280929 Rename Slice to View in reshape tests 2023-01-14 16:22:40 +01:00
Andreas Longva afabf4bad2 ReshapableStorage for slices + tests for owned reshape
In the process of implementing ReshapbleStorage for SliceStorage(Mut),
I discovered that there appears to be no tests for the existing
reshape_generic functionality on owned matrices.
2023-01-14 16:22:40 +01:00
Sébastien Crozet 3a8c1bf81e Use rayon as the feature name instead of par-iter 2023-01-14 15:59:11 +01:00
Sébastien Crozet 1f4ded0c50 Don’t make the ColumnIter[Mut] fields pub(crate) 2023-01-14 15:30:00 +01:00
geo-ant 50e25c57f7 fmt 2023-01-14 12:08:47 +01:00
geo-ant 7b9b123301 add test, find bug, add another test 2023-01-14 12:08:47 +01:00
geo-ant 8d1f684e45 change feature name to par-iter and add doc example to par_column_iter_mut 2023-01-14 12:08:47 +01:00
geo-ant e9a5705e1a address review 2023-01-14 12:08:40 +01:00
geo-ant 701d260fa6 rayon parallel feature w/o nightly features on old compilers 2023-01-14 12:08:40 +01:00
geo-ant 85e7551c81 feature gate functionality 2023-01-14 12:08:40 +01:00
geo-ant a4e28a136e apply fmt 2023-01-14 12:08:10 +01:00
geo-ant 7ac536be07 cleanups and add tests 2023-01-14 12:08:10 +01:00
geo-ant f850ed535e add tests and start cleanup 2023-01-14 12:07:56 +01:00
Sébastien Crozet e959f2eb9c Fix CheckBytes derives + drop Complex rkyv support for now 2023-01-13 09:58:41 +01:00
Sébastien Crozet cce66c3abf Merge branch 'dev' into dev-zyanshep 2023-01-13 09:19:49 +01:00
Andreas Longva acfd37c728 Rename tests/core/matrix_slice.rs to tests/core/matrix_view.rs 2022-11-14 16:59:54 +01:00
Andreas Longva 55c3a9c764 Formatting 2022-11-14 16:43:47 +01:00
Andreas Longva 6c8947ccc0 Replace slice->view in tests and benches 2022-11-14 15:16:23 +01:00
Peng Guanwen f485806782 rustfmt 2022-10-13 12:22:45 +00:00
Peng Guanwen bc566d91bf Add test for rkyv 2022-10-13 12:22:45 +00:00
zyansheep 525bc63de2 use patch for num-complex & refactor 2022-08-15 18:47:00 -04:00
Tim Taubner 0c2d9deac7 cargo fmt 2022-07-27 11:44:42 +02:00
Tim Taubner 7aadbcf21d From_rotation_matrix: Use the larger of eps.sqrt() or eps*eps as disturbance. Add tests for eps > 1.0 2022-07-27 11:31:43 +02:00
Sébastien Crozet 18a8a30671 cargo fmt 2022-07-27 09:49:16 +02:00
Tim Taubner ac203fe4fd Add test case for issue 628 2022-07-27 09:49:16 +02:00
Tim Taubner 257d95b3d3 Add test case for issue 1078 2022-07-27 09:49:16 +02:00
Tim Taubner f9aa2d76aa Start from random rotation in from_matrix to prevent issues when calling from_matrix on rotation matrices 2022-07-27 09:49:16 +02:00
zyansheep 71379c0748 cargo fmt 2022-07-13 23:05:44 -04:00
zyansheep 9a98b0cf24 various implementations 2022-07-13 23:02:17 -04:00
zyansheep a725faaf6a fix matrix impl 2022-07-13 14:32:46 -04:00
zyansheep 67f04e39ac add rkyv tests 2022-07-13 09:22:55 -04:00
Joshua Smith 96e2d1f69e fixed cargo fmt 2022-03-29 13:42:38 -05:00
Joshua Smith baa320d7f3 added tests for complex and quaternion slerp pathing 2022-03-29 13:38:10 -05:00
YuhanLiin a27d121a7a Add regression test for #1072 2022-03-09 21:10:45 -05:00