Skip to content

Document and test linear-algebra shape predicates through maximasrc - #1881

Merged
sangwinc merged 4 commits into
devfrom
iss1880
Oct 14, 2026
Merged

sangwinc merged 4 commits into
devfrom
iss1880

Conversation

@adamant-pwn

@adamant-pwn adamant-pwn commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

The five shape predicates are missing from the generated CAS reference. Move col_vecp, row_vecp, vectorp, squarep, and diagp into maximasrc/linearalgebra/predicates, preserving their implementations and attribution. Document vector notation, empty and rectangular shapes, and simplification behaviour; retain links from the existing topic reference. The diagp documentation now includes Luke's SVD motivation.

Migrate 23 existing cases and add 29, each run with both simplification modes. Runtime code, tests, and documentation are generated with the official compiler.

Validation: 256/256 generated CAS executions pass on Maxima 5.45.1/ECL. The original migration also passed 140/140 before/after comparisons and six vector-input tests (34 assertions). Its legacy core runner had the same 15 unrelated failures before and after; no fully passing legacy suite is claimed. CI is rerunning for the documentation update.

Closes #1880.

@sangwinc

Copy link
Copy Markdown
Member

@LukeLongworth would you be willing to review and comment on this please? If you don't have time, just let me know and I'll take a look myself. Thanks @adamant-pwn much appreciated.

@LukeLongworth

Copy link
Copy Markdown
Collaborator

Kia ora @sangwinc and @adamant-pwn, this is all very sensible. I'll freely admit that I'm not very familiar with software engineering, so I'll trust that all the files are in the right place and are working correctly in their new homes. The descriptions provided in the documentation are clear and correct to my memory, and they accurately describe the purpose of these functions. I can provide more examples of their applications if desired. Notably, squarep() was created to immediately filter out any problematic cases for eigenvector-eigenvalue problems without needing to check diagonalisability as well as to check for orthogonality. diagp() is just generally useful, but the reason it accepts rectangular matrices is so that it can work with SVD problems.

I acknowledge that this is intended to be a pilot programme, but I would support the inclusion of triup and trilp here in future (they currently live in matrix.mac). Possibly some of the other predicates in that file could be moved there too, such as REFp or orth_matrixp, though these are really algebraic properties of matrices rather than shape.

Sorry for the delay on this review Chris, I try to keep an eye on these but the notifications come through to my personal email rather than my work email so they sometimes get missed. A direct prompt from you is a good idea if something is important!

@adamant-pwn

Copy link
Copy Markdown
Collaborator Author

Thanks Luke! I've added the SVD motivation to diagp's documentation here, and implemented triup/trilp in #1906 with their existing tests plus boundary cases.

The follow-up is stacked on this PR so the changes can be reviewed incrementally. @sangwinc, would you prefer to keep it separate or fold it into this PR? The implementation is ready either way.

@adamant-pwn
adamant-pwn added this pull request to stack #1907 October 14, 2026 00:24
@sangwinc
sangwinc merged commit bb2a399 into dev Oct 14, 2026
10 checks passed
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.

3 participants