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

JMatrix should infer size from context #134

Open
mattsignorelli opened this issue Apr 5, 2024 · 1 comment
Open

JMatrix should infer size from context #134

mattsignorelli opened this issue Apr 5, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@mattsignorelli
Copy link

mattsignorelli commented Apr 5, 2024

I would like to have a "J" matrix that works similar to uniform scaling. So if I have a matrix A=rand(4,4) for example, I can just write A*JMatrix for example, instead of having to explicitly define the JMatrix(4) size.

I can see two ways of doing this: one way is to just define a new empty type, say SymplecticS, define const S = SymplecticS() (I choose S because in accelerator physics we reserve J for the invariant action and call this matrix S) and then for all operations have it check the size of the other matrix, create the JMatrix and run the current JMatrix operation. This option is least invasive and easy, but redundant.

The other option is to rewrite JMatrix to instead have it not have size n as a field, and infer the size at time of an operation from the other matrix. This option is more invasive, and with my limited knowledge of this package may not be doable/preferred for certain reasons.

Would any of the above options be considered for a PR?

@stevengj
Copy link
Member

stevengj commented Apr 6, 2024

That would be a bit different from the JMatrix type defined here, so in principle it would be a breaking change. (Though I'm not sure how widely used the skew-Cholesky factorization is in practice; probably not very much.)

(And if it is analogous to UniformScaling, it would also include a scale factor.)

@stevengj stevengj added the enhancement New feature or request label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants