question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Linear algebra support

See original GitHub issue

Share we support linear algebra? Thank you for your hardworking, I’m so happy that we do not need to rember the damned “axis number” in normal situations. But sometime we should still use the functions of linear algebra like LUdepart or determinant.
Follow is the codes to explain some personal idea of new functions API. #code

>>>Adata = np.random.randn(4,4,7)
>>>A = DataArray(Adata, dims=('x','y','z')) 
>>>L, U = LUdepart(A, dims1='x',  dims2='y',newdims='a') 

#result

>>> L
DataArray(x:4, z:7, a: 4)
...
>>> U
DataArray(y:4, z:7, a: 4)
... 
>>>L@U == A
True

I think other essential linear algebra function in numpy can be wraped by this way so that we will can use their named axis version. Do you have any suggestions? Finally, thankyou again for your work.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
OriolAbrilcommented, Jan 24, 2022

I have created a library for easier linear algebra (plus others) with xarray: https://xarray-einstats.readthedocs.io/en/latest/.

It currently has:

  • wrappers for many numpy.linalg functions
  • wrappers for scipy.stats distributions plus a few functions
  • wrappers for einops functions
  • a numba.guvectorize-decorated version of numpy.histogram for dataarrays

I have mostly added wrappers for things I personally use, also trying to not overlap with xr-scipy nor xarray-extras, so it might not make much sense as a group, but the modules are completely independent between them and could be reorganized into independent packages or merged into existing ones.

Feedback very welcome!

2reactions
OriolAbrilcommented, Apr 19, 2021

Great, thanks for the offer 😄 I think I’ll start with a minimal repo back at ArviZ and see how much of that can be used more generally. I probably should have named the example above arviz_dot instead. I definitely want to be able to do arviz_dot(a, b) and have it work automatically because in most ArviZ cases we do have all the information we need for this to be possible. We’ll therefore definitely need a higher ArviZ layer, but I think an xarray-linalg would be a great base on which to build and we can keep both in different files/modules so it can be split easily.

I also commented here as I thought it was the most related issue, many of the functions I have in mind are related to linalg, but we’ll probably have some other functions too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support (mathematics) - Wikipedia
Support (mathematics) · 1 Formulation · 2 Closed support · 3 Compact support · 4 Essential support · 5 Generalization · 6 In...
Read more >
Support of a vector - linear algebra - Math Stack Exchange
Let v be an n-dimensional sign vector, i.e., a vector in {+,−,0}n. The following is a natural partition of [n] induced by v....
Read more >
What does support mean in mathematics, as in [math ... - Quora
The support is the closure of the set of points for which the function is not zero. Otherwise said, all points for which...
Read more >
Linear Algebra - Khan Academy
Learn linear algebra for free—vectors, matrices, transformations, and more.
Read more >
Linear algebra support modules for approximation and other ...
This paper describes a suite of modules which has been used extensively in practice for this purpose and which forms the core of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found