Comments (4)
The previous way to address the problem is possible and not bad.
But now the strategy has changed.
To do the concatenation for each vector in 4-vector one by one, and not do it converted to np.ndarray
then all-in-one and convert back.
"Added" since e.g. p1. px, p1.py, p1.pz, and p1.e is directly a numpy array.
Thus no conversion is needed
The latest solution for this is something like this
def concatenate_data(
data1: tuple[MomentumNumpy4D, ...],
data2: tuple[MomentumNumpy4D, ...],
) -> tuple[MomentumNumpy4D, ...]:
return tuple(concatenate_vectors((pi1, pj2)) for pi1, pj2 in zip(data1, data2))
def concatenate_vectors(vectors: tuple[MomentumNumpy4D]) -> MomentumNumpy4D:
return vector.array(
{
"px": np.concatenate([p.px for p in vectors]),
"py": np.concatenate([p.py for p in vectors]),
"pz": np.concatenate([p.pz for p in vectors]),
"E": np.concatenate([p.e for p in vectors]),
}
)
from compwa.github.io.
Thus no conversion is needed
Behind the scenes, concatenate_vectors()
is still converting between numpy and the vector
package, so performance-wise this is not a good solution. But for the notebook, this is fine, the implementation in that function can be replaced by a cleaner, more efficient solution later.
from compwa.github.io.
Done!
from compwa.github.io.
Thus no conversion is needed
Behind the scenes,
concatenate_vectors()
is still converting between numpy and thevector
package, so performance-wise this is not a good solution. But for the notebook, this is fine, the implementation in that function can be replaced by a cleaner, more efficient solution later.
Agree.
Conversion is still there at the end.
from compwa.github.io.
Related Issues (20)
- Investigate effect of symbolic trigonometric simplification on numeric performance
- Improve developer instructions at compwa-org.rtfd.io
- Speed up documentation build on RTD by freezing TR-019
- Plotly plots of Riemann sheets are not showing on ComPWA webpage HOT 3
- Remove `sphinx-needs` plugin
- Add page about symbolic computations
- Technical Reports overview is not a data table anymore
- Use `scipy.integrate.quad_vec()` in symbolic integral lambdification
- Implement per-page changelog with `sphinx-git`
- Remove compwa.github.io pre-commit hooks from ComPWA/policy
- Create installable `src` folder and move pre-commit definitions there
- Investigate cut rotation by rotating meshgrid definitions themselves
- System 12 3D drawing of θ₁ HOT 1
- cos θ should be flat, dN/dθ ~ sin θ HOT 3
- Set Ruff E402 as default for notebooks
- Dependency issue HOT 2
- Pin all dependencies in the technical reports
- Improve and freeze P-vector reports
- Change license of active repositories to Apache
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 compwa.github.io.