Comments (1)
hi @cdhainaut
The way you provided the flattened arrays to underlying_function_3D to compute y_3d does not match how the interpolant function creates the grid.
This should work for your 3D example:
import numpy as np
from casadi import interpolant
x1 = np.linspace(0, 100, 2)
x2 = np.linspace(0, 5, 3)
x3 = np.linspace(0, 9, 4)
X1, X2, X3 = np.meshgrid(x1, x2, x3, indexing="ij")
y_3d = X1**2 + (X2 + 1) ** 2 + X3**2
y_3d_flat = y_3d.ravel(order='F')
X_3d = np.stack((X1.ravel("F"), X2.ravel("F"), X3.ravel("F")))
f_3d = interpolant(f"three_d", "linear", [x1, x2, x3], y_3d_flat)
y_i_3d = f_3d(X_3d)
np.testing.assert_allclose(y_3d_flat, np.array(y_i_3d)[0])
from casadi.
Related Issues (20)
- Refactor handling of event dynamics in DaeBuilder
- Mapping with openmp segmentation faults sometimes
- Run-time warnings
- Linear system of equations with Casadi: A\b HOT 1
- Event support in integrator class
- Building Casadi with ipopt HOT 2
- Run `autoconf` HOT 1
- using Casadi HOT 1
- Can I use the casadi::MX type in a logical conditions in an if-else statement?
- octave segfaults, at least 3.6.0
- finish daqp
- fix test_jit_serialize on mac
- libcasadi_interpolant_linear.dll not found HOT 1
- Difference between work vector size in generated header and c files HOT 1
- Set `MACOSX_DEPLOYMENT_TARGET` to 11.0 for CasADi v3.6.5 on arm64 macOS – `libcasadi.3.7.dylib` requires 11.1 and breaks linkage HOT 1
- Using casadi+integrator in a different thread
- compact dense sparsity patterns HOT 3
- Symmetric jacobian with MX
- pseudo MX optimizations
- Add inlining MX call to SXFunction HOT 1
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 casadi.