Numpy and Common Lisp?

Shubhamkar Ayare shubhamayare at yahoo.co.in
Thu Apr 13 03:43:55 UTC 2023


    On 11 Apr 2023, at 14:57, Robert Goldman wrote:
    
        On 11 Apr 2023, at 7:23, Manfred Bergmann wrote:
        
            Am 11.04.2023 um 14:17 schrieb paul tarvydas <paultarvydas at gmail.com>:
            
            "If you specifically want numpy, it may be possible to have Common Lisp talking to python."
            
            CL can run python
            
            (uiop:run-program "python3 ~/quicklisp/local-projects/clvpy/hello.py" :output t)
            
            This isn't 1950 anymore. 1950s biases about what "efficiency" means no longer apply.
            
            (Lisp used to be concerned with "development time efficiency" and can be again)
            
            pt
                
            
        In that regard, there is py4cl2: https://github.com/digikar99/py4cl2
        Not sure if you know.
            
            
    FWIW, py4cl2 in my experience is in very rough shape, and not fit for use. Stick to py4cl instead of the fork. It's simpler and doesn't do a lot of things py4cl2 wants to, but it's more solid.

Even more recently, there is py4cl2-cffi that provides support for passing CL arrays by reference: https://github.com/digikar99/py4cl2-cffi
The support is one-directional, in that arrays returned by numpy whose data was not allocated by CL still need to be copied over.
It is possible to write a wrapper around numpy arrays, so arrays can become completely owned by numpy, so this copying over becomes unnecessary.

And while I have been trying to use it as my daily driver, I'd definitely say that it is in an ever rougher shape than py4cl2,
and will require time and risk-takers to make it suitable for production.

On the other hand there is mgl-mat: https://github.com/melisgl/mgl-mat and 
And magicl (backed by quil-lang?): https://github.com/quil-lang/magicl
And numericals: https://github.com/digikar99/numericals
And as someone already mentioned, lisp-stat: https://github.com/Lisp-Stat/lisp-stat and https://lisp-stat.dev/docs/

digikar



More information about the pro mailing list