html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/issues/3322#issuecomment-1101533629,https://api.github.com/repos/pydata/xarray/issues/3322,1101533629,IC_kwDOAMm_X85BqBG9,2448579,2022-04-18T16:14:03Z,2022-04-18T16:14:03Z,MEMBER,Closing in favour of xarray-einstats,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,495799492 https://github.com/pydata/xarray/issues/3322#issuecomment-1019753466,https://api.github.com/repos/pydata/xarray/issues/3322,1019753466,IC_kwDOAMm_X848yDP6,23738400,2022-01-24T06:10:27Z,2022-01-24T06:10:44Z,CONTRIBUTOR,"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! ","{""total_count"": 2, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 1, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,495799492 https://github.com/pydata/xarray/issues/3322#issuecomment-822464839,https://api.github.com/repos/pydata/xarray/issues/3322,822464839,MDEyOklzc3VlQ29tbWVudDgyMjQ2NDgzOQ==,23738400,2021-04-19T13:25:49Z,2021-04-19T13:25:49Z,CONTRIBUTOR,"Great, thanks for the offer :smile: 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. ","{""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,495799492 https://github.com/pydata/xarray/issues/3322#issuecomment-822124811,https://api.github.com/repos/pydata/xarray/issues/3322,822124811,MDEyOklzc3VlQ29tbWVudDgyMjEyNDgxMQ==,2448579,2021-04-19T02:28:41Z,2021-04-19T02:28:41Z,MEMBER,"> ""xarray linalg library""? Thanks @OriolAbril . This sounds like a nice xarray-contrib repo if it's general enough. Note that we do have `xarray.dot` https://xarray.pydata.org/en/stable/generated/xarray.dot.html","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,495799492 https://github.com/pydata/xarray/issues/3322#issuecomment-821744766,https://api.github.com/repos/pydata/xarray/issues/3322,821744766,MDEyOklzc3VlQ29tbWVudDgyMTc0NDc2Ng==,23738400,2021-04-17T01:30:34Z,2021-04-17T01:36:41Z,CONTRIBUTOR,"Would there be any interest in an ""xarray linalg library""? Some kind of library of that sort would be really useful to ArviZ and our users, I'll probably write some very basic functions myself on a minimal library or add them to ArviZ directly, but if there are other people interested we can try to find synergies and get something more general. In our case, 99% of the time we want to ""batch"" over the `chain` and `draw` dimensions. So things as simple as: ``` def xarray_dot(a, b, dim=None): if dim is None: a_dims = set(a.dims) b_dims = set(b.dims) dim_set = a_dims.intersection(b_dims) - {""chain"", ""draw""} if len(dim_set) == 1: dim = dim_set.pop() else: ValueError if not isinstance(dim, str): raise ValueError return xr.apply_ufunc( np.einsum, ""...i,...i"", a, b, input_core_dims=[[], [dim], [dim]] ) ``` are already extremely useful. Being able to invert, cholesky... without using `apply_ufunc` would be convenient, even more so if we define some conventions. i.e. I generally use `dim` and `dim bis` for covariance matrices so they have shape `chain, draw, ..., dim, dim bis`, so I can invert those independently of their number and order of dimensions without even needing to say which are the ""matrix"" dimensions. In our case, being able to `ds.transpose(""dim1"", ""dim2"")` and have it ignore `chain, draw` would also be convenient, which is probably a very ArviZ specific situation, but maybe there are other libraries/people that commonly have some batch dimensions, even if they use different names for them or if the user chooses those names freely.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,495799492 https://github.com/pydata/xarray/issues/3322#issuecomment-533765137,https://api.github.com/repos/pydata/xarray/issues/3322,533765137,MDEyOklzc3VlQ29tbWVudDUzMzc2NTEzNw==,1217238,2019-09-21T03:59:26Z,2019-09-21T03:59:33Z,MEMBER,"I think the way to write something like an LU decomposition would be to use xarray's `apply_ufunc`, which in theory could wrap `scipy.linalg.lu_factor` in one line. I don't know if this could/should live in xarray proper. We tend to have pretty high standards, which slows development.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,495799492 https://github.com/pydata/xarray/issues/3322#issuecomment-533563714,https://api.github.com/repos/pydata/xarray/issues/3322,533563714,MDEyOklzc3VlQ29tbWVudDUzMzU2MzcxNA==,38346144,2019-09-20T13:54:40Z,2019-09-20T14:02:46Z,NONE,"> Hi @weipeng1999 , > could you link the reference implementation in numpy/scipy? > > I think this would be niche-ish. I would personally try to keep xarray free of functionality that only a tiny fraction of the users actually use - particularly when such functionality can be implemented with a trivial wrapper by the users themselves. > e.g. at the moment we have exactly one scipy function being wrapped, and that's linear interpolation which is useful to a lot of people. > > I think this falls into a more general discussion on how niche a function must be in order to be excluded from the library - @shoyer what's your opinion? > > Regardless, I would like to point you to https://xarray-extras.readthedocs.io which is a module that I created exactly for this kind of cases (PRs are welcome). I realize that I am a totally green finger here are my trial implement I think I have long way to make it commitable [qr.txt](https://github.com/pydata/xarray/files/3636256/qr.txt) ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,495799492 https://github.com/pydata/xarray/issues/3322#issuecomment-533248639,https://api.github.com/repos/pydata/xarray/issues/3322,533248639,MDEyOklzc3VlQ29tbWVudDUzMzI0ODYzOQ==,5635139,2019-09-19T18:16:04Z,2019-09-19T18:16:04Z,MEMBER,Somewhat related: https://github.com/pydata/xarray/pull/2766,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,495799492 https://github.com/pydata/xarray/issues/3322#issuecomment-533228830,https://api.github.com/repos/pydata/xarray/issues/3322,533228830,MDEyOklzc3VlQ29tbWVudDUzMzIyODgzMA==,6213168,2019-09-19T17:23:10Z,2019-09-19T17:23:10Z,MEMBER,"Hi @weipeng1999 , could you link the reference implementation in numpy/scipy? I think this would be niche-ish. I would personally try to keep xarray free of functionality that only a tiny fraction of the users actually use - particularly when such functionality can be implemented with a trivial wrapper by the users themselves. e.g. at the moment we have exactly one scipy function being wrapped, and that's linear interpolation which is useful to a lot of people. I think this falls into a more general discussion on how niche a function must be in order to be excluded from the library - @shoyer what's your opinion? Regardless, I would like to point you to which is a module that I created exactly for this kind of cases (PRs are welcome).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,495799492