SClib, a hack for straightforward embedded C functions in Python
Esteban Fuentes, Hector E. Martinez

TL;DR
SClib is a simple method that enables seamless integration of C functions into Python, significantly improving performance and flexibility for scientific computing and engineering applications.
Contribution
It introduces SClib, a straightforward approach for embedding C functions in Python, demonstrated through high-speed scientific and engineering case studies.
Findings
150x speed-up in Schrödinger equation solver
Effective integration of C code with IPython for visualization
Enhanced simulation speed and accuracy in control systems
Abstract
We present SClib, a simple hack that allows easy and straightforward evaluation of C functions within Python code, boosting flexibility for better trade-off between computation power and feature availability, such as visualization and existing computation routines in SciPy. We also present two cases were SClib has been used. In the first set of applications we use SClib to write a port to Python of a Schr\"odinger equation solver that has been extensively used the literature, the resulting script presents a speed-up of about 150x with respect to the original one. A review of the situations where the speeded-up script has been used is presented. We also describe the solution to the related problem of solving a set of coupled Schr\"odinger-like equations where SClib is used to implement the speed-critical parts of the code. We argue that when using SClib within IPython we can use NumPy…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsComputational Physics and Python Applications · Parallel Computing and Optimization Techniques · Numerical Methods and Algorithms
