Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

Support for n-dimensional matrices #400

Closed
j6k4m8 opened this issue Oct 22, 2016 · 5 comments
Closed

Support for n-dimensional matrices #400

j6k4m8 opened this issue Oct 22, 2016 · 5 comments

Comments

@j6k4m8
Copy link

j6k4m8 commented Oct 22, 2016

Hi all — want to start this off by saying that this is a very impressive codebase...and caveating the following with the fact that I'm both new(ish) to Go and very new to gonum/matrix, so I apologize if this has been addressed previously.

I'm curious if there was a conscious design-decision to only support 2D matrices, and if there has been any work toward n-dimensional matrices. It looks like this package was quite intentionally designed around a 2D structure, and I'm curious if this is because few gophers are working in higher-dimensional data, or if there is a clever workaround I'm not understanding.

@kortschak
Copy link
Member

We have had various private discussions about the addition of a tensor package; it is something that I would like to see for some work I want to do, though its priority is low.

Having said that, the design discussion that will be needed before we could start this is not trivial; efficient tensor calculation is complicated - the underlying representation of tensors maximising efficiency is highly dependent on the work that is being done, and the API for an n-dimensional layout is more complicated than that for 2-D (it may be more obvious after an n-dimensional slice proposal/change has been added to the language).

If you would like to start discussion on this (particularly if you have domain knowledge that would bring experience to the discussion), please start a thread at gonum-dev.

@j6k4m8
Copy link
Author

j6k4m8 commented Oct 23, 2016

Very interesting — glad to hear there was a lot of thought behind this decision, and I'm looking forward to seeing (and hopefully being part of) where the package heads next. I'm closing this issue for now, and I'll do some more research on implementation before heading over to gonum-dev.

Thanks!

@j6k4m8 j6k4m8 closed this as completed Oct 23, 2016
@btracey
Copy link
Member

btracey commented Oct 23, 2016

One issue to consider is supporting an particular sized structure for n >2, or a single structure that can support for any n. They are both useful, but it's generally more efficient to have a specially designed structure if the dimension is known ahead of time. gonum/matrix is that for the n = 2 case.

@kortschak
Copy link
Member

There is worthwhile discussion in this document (C++ template library implementation of tensors) and the associated PDF dealing with efficiency.

The problem of API design is possibly more complicated, particularly since it needs to fit in with the general design principles that already exist in gonum/matrix. Although it is reasonable to treat these two problems as orthogonal, with the implementation having some opinions about what to do in various cases. The glue between the API and those choices though is what is really complicated.

@j6k4m8
Copy link
Author

j6k4m8 commented Oct 24, 2016

I may have closed this prematurely — would love to be part of this discussion if we're planning on re-opening..?

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

No branches or pull requests

3 participants