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

Support for matrix projections #61

Open
kboom opened this issue Aug 5, 2019 · 2 comments
Open

Support for matrix projections #61

kboom opened this issue Aug 5, 2019 · 2 comments

Comments

@kboom
Copy link

kboom commented Aug 5, 2019

Assume we have a 2D matrix A with A1xA2 dimensions.
Assume we have a 2D matrix B with B1xB2 dimensions where B1<A1 and B2<A2.
Basically B "fits in" A.

Then I don't think there is a way to add B to a sub matrix (same size) of A efficiently. This rather popular operation in certain types of algorithms (which use merging and elimination of matrices). Note that this has been implemented in other libraries by using "projections" or "views". You just select a sub matrix of A without making any copies and then use it to do normal additions. You then can just dispose of the view because the data gets updated properly - and you can use all the normal operators you'd use (although only some of them probably make sense).

Please see Breeze.

@lessthanoptimal
Copy link
Owner

Do you just need to be able to basic operations, like addition, subtraction, and other element-wise ops?

To keep things simple sub-matrices were not included in EJML by design. I could create a wrapper class, but that would have a noticeable speed hit. Having the implementation create a local copy of the inner matrix might be faster and would have full access to all operations.

@lessthanoptimal
Copy link
Owner

Would having a function call that lets you do element-wise operations in inner matrices do what you need? @kboom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants