The vectorized submodule is not fully supported throughout the package
See original GitHub issueDescribe the bug
The vectorized
functionality does not seem to be universally applied.
Minimal Reproducible Example
import chemicals as chem
import numpy as np
from chemicals import vectorized
props = chem.heat_capacity.TRC_gas_data.loc['7732-18-5'] # for water
coeffs = {}
for val in props.index:
if val.startswith('a'):
coeffs[val] = props[val]
Cp = chem.heat_capacity.TRCCp(T=np.array([333, 444]), **coeffs)
Additional context The error message is:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
This is occurring because of the line:
if T <= a7:
For this to work in a vectorized way, this needs to be if np.all(T < a7)
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Why does git fail to fetch specific valid submodule for a given ...
Running this command after cloning (and receiving the error) solved my problem: git submodule update --force --recursive --init --remote.
Read more >Git - Submodules - Git SCM
Although DbConnector is a subdirectory in your working directory, Git sees it as a submodule and doesn't track its contents when you're not...
Read more >Sparse matrices (scipy.sparse) — SciPy v1.9.3 Manual
This package is switching to an array interface, compatible with NumPy arrays, from the older matrix interface. We recommend that you use the...
Read more >Using Git submodules with GitLab CI/CD
Use Git submodules to keep a Git repository as a subdirectory of another Git repository. You can clone another repository into your project...
Read more >gnuradio/volk: The Vector Optimized Library of Kernels - GitHub
Since each SIMD architecture can be very different and no compiler has yet come along to handle vectorization properly or highly efficiently, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ummm, I just happened to discover that they only work with positional arguments. I think that’ll get me going now…but positional arguments scare me, guess I’ll just have to live with it.
Thanks again!
Interesting. Our problems are usually limited by the matrix routines, so a few microseconds don’t matter much.
Anyway, new issue: I am getting an ‘invalid number of arguments’ error from all the numba_vectorized functions. Any thoughts?
Sorry to be a pain, but we’re integrating chemicals into openpnm for phase property estimation, so we need to apply the functions to millions of values, hence my interest in the speed-ups.