-
Notifications
You must be signed in to change notification settings - Fork 13
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
Store identity matrices in KroneckerSums #62
Comments
I don't see the value of generating and storing two dense matrices? If we collect as you say, we better generate them on the fly once? Especially for in-place collecting, It does not make much sense to me to use the dense identity matrices. For other processes, an |
I may have jumped the gun with reusing the types I agree that storing the identity matrices as dense arrays is highly inefficient. Although I don't show it in my example, my idea was that if I'll admit that I'm not familiar enough with (I::UniformScaling)(n::Integer) = Diagonal(fill(I.λ, n)) to generate the identity matrices? Collecting dense products with smaller matrices would be faster than by making them sparse, so there should be some flexibility in the storage of these matrices. Should the user be responsible for selecting the storage type, or should we set some condition for choosing between types?
That is the key idea! I like this approach. |
The uniform scaling is an efficient way of using the identity matrix, as
I struggled with this question in other parts of the code as well. Some storage types will be more efficient depending on the storage type, and I found that the theoretical time complexities do not always match reality as it also depends on hardware stuff. I lean toward letting the responsibility to the user, where they have to determine which form they use. A good documentation would be key here. A fun thing to implement might be a macro
But this is kind of already done in most of the code. It might help if you give me some examples of what kind of things you want to compute (how many matrices and what sizes). My background is not physics. The main interest (in my research) I have is in forming systems with a limited number of large matrices. What do you compute with Kronecker sums? It might be, for example, be interesting to store many terms of pure Kronecker products, these would allow one to lazily add Kronecker sums and mixtures. Many linear algebra operations ( |
Should the
KroneckerSum
have extra fields for the identity matrices?Something like the following:
IA
andIB
would be used inBase.collect(K::KroneckerSum)
.Then it would make sense to "reuse" a
KroneckerSum
, when repeated collections are required.It would also complement in-place versions of
collect
withkron!
(see #61).The text was updated successfully, but these errors were encountered: