Comments (10)
I think there are maybe two questions here:
- implicit output:
einsum('ab', x)
- i.e. the output is not given but automatically computed, this is handled already - interleaved format:
einsum(array_0, indices_0, array_1, indices_1, ...[, output_indices])
, this is not supported yet, but is just a matter of parsing that could be lifted from e.g.opt_einsum
.
Note that einsum('ab->ab, v1, v2)
is not actually valid! There should only be one term, and that last call should probably error, as it does with numpy
...
from sparse.
Actually, since #579 your case is working and the interleaved format is supported. However, you need to update sparse to the last development version from github.
from sparse.
By the way, you could use opt_einsum.contract as a drop in here and it should work with sparse, handle the input and also perform contraction order (for 3+ terms) optimization.
from sparse.
from sparse.
I believe it isn't possible, as of now. Is it required for your use-case?
from sparse.
@hameerabbasi
Yes, I'm trying to use it for the sparse factor product in MRF, and most convenient way is to provide only operands and indices, here is the example in numpy
:
https://github.com/pgmpy/pgmpy/blob/d1131144af2a2a4b3ef341613170538c808194aa/pgmpy/factors/discrete/DiscreteFactor.py#L704
I trying to implement the same, but with sparse matrices.
from sparse.
Yeah, it seems that convert_interleaved_input function from opt_einsum
may help to solve the problem.
@jcmgray @hameerabbasi big thanks to you guys for a quick response!
from sparse.
@HadrienNU thanks for a reply, already manage to do it with parsing from opt_einsum, but using it from the lib will be more convenient.
from sparse.
Actually, since #579 your case is working and the interleaved format is supported. However, you need to update sparse to the last development version from github.
Ah sorry I missed this PR, thanks for adding the additional parsing!
from sparse.
Since the question has been answered and the required feature is in master
, I'm going to close this issue.
from sparse.
Related Issues (20)
- Unable to install shap on python 3.11 doubt to numba cannot install on Python version 3.11.2 HOT 1
- `einsum` doesn't handle `dtype` and `optimize` kwargs HOT 2
- Proper usage of sparse 3D array: initialization, assignment of values and use in calculations HOT 2
- np.diff equivalent HOT 2
- DeprecationWarning: coords should be an ndarray. This will raise a ValueError in the future. HOT 1
- Test failures in test_tensordot HOT 14
- Correct type hint for sparse COO matrix? HOT 1
- numpy ufuncs can change the compression of a gcxs array HOT 12
- Support `arr.size >= 2 ** 64` as long as each dimension is `< 2 ** 64` HOT 1
- Constructing GCXS from non-canonical `scipy.sparse.csr_matrix` results in wrong results HOT 5
- Support for Fortran order in COO.flatten() HOT 1
- Consider MatRepr for `__repr__` and `_repr_html_` HOT 9
- `GCXS` matmul => slice leads to incorrect results HOT 4
- `TypeError` when accessing `.real` and `.imag` attribute on sparse array of string type
- Installing directly from GitHub fails on Python 3.12 HOT 5
- Some functions seem missing from the top level import HOT 2
- [conda] Sparse version string is not recognized by pip list/check HOT 1
- Segmentation fault on arm64 HOT 11
- Remove runtime dependency on SciPy HOT 1
- Xarray/Numpy/Dask Indexing using a Sparse Array HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sparse.