“I Don’t Like NumPy”, ‘Dynomight’ (https://dynomight.net/numpy/).
New article on my site: HyAB k-means for color quantization
In which I try to improve color clustering with a different distance function. It's a simple technique in the end but it's pretty hard to evaluate if it's an improvement or not!
https://30fps.net/pages/hyab-kmeans/
https://github.com/pekkavaa/HyAB-kmeans/ with #numpy code
And btw, can I get units for variables already? Annoyed that I can't say that this variable is in inches, or in bytes. Want to be able to tag data that says this is xyY, or XYZ space so that my function can convert if necessary or not.
Great news for OpenMP on Python!
NumPy 2.3 includes early OpenMP support, making sorting operations like np.sort and np.argsort faster by using multiple processor cores — a big step for performance!
This new feature is off by default but can be turned on during installation with -Denable_openmp=true
This marks the beginning of more parallel computing support in NumPy!
If you're writing python libraries, DON'T REQUIRE fileno ON FILE OBJECTS!
Dealing w/ the bullshit that numpy.fromfile wants the fileno attribute on a file object. Yes, it's slightly faster, but it also makes it harder to mock when doing testing.
Now I'm going to have to deal w/ creating a temporary directory, writing the file, and cleaning up afterward. Things that unittest.TestCase should have an option to do, but doesn't. Luckily I've dealt w/ this BS before, so I'll just copy the code from another project.
Since I couldn't figure out how to use numpy.take, and LLMs couldn't figure out how to do what I needed to do, I read the numpy slicing chapter, and I came up with the following:
indexes = np.arange(W * H)
rgb[0, i].flat = c[0].flat[np.array(reps[i].flat) * (W * H) + indexes]
EDIT: it was broken, needed to add in the position index and simplification.
Back to the #numpy & #flocking experiment based on Nicolas Rougier's example in "From Python to Numpy". Code at: https://github.com/villares/sketch-a-day/tree/main/2025/sketch_2025_06_26
More sketch-a-day: https://abav.lugaralgum.com/sketch-a-day
If you like this, support my work:
https://www.paypal.com/donate/?hosted_button_id=5B4MZ78C9J724
https://liberapay.com/Villares
https://wise.com/pay/me/alexandrev562 #Processing #Python #py5 #CreativeCoding
Not very good WIP... I always struggle to make #trimesh 3D meshes from scratch with #numpy Code at: https://github.com/villares/sketch-a-day/tree/main/2025/sketch_2025_06_22
More sketch-a-day: https://abav.lugaralgum.com/sketch-a-day
If you like this, support my work:
https://www.paypal.com/donate/?hosted_button_id=5B4MZ78C9J724
https://liberapay.com/Villares
https://wise.com/pay/me/alexandrev562 #Processing #Python #py5 #CreativeCoding
I have finally decided to use #Typescript, #Deno, and #Assemblyscript to do my #SLM project. Typescript has strong typing. Assemblyscript will be compiled into #Webassembly wasm which is much faster. I don't need #pytorch or #numpy for manipulating matrices. NNUE modeling of language allows me to use arrays for #computing #GradientDescents.
While Javascript is a messy language, the other related script languages are clean and strict. #WebGPU allows me to use the #GPU via a browser too. #AI
https://dynomight.net/dumpy/
DumPy: NumPy except it's OK if you're dum
Interesting. A good part of teaching/learning #numpy is being aware of the many syntax/shape gotchas. This looks like it can get rid of it.
I don’t like NumPy
「 NumPy is all about applying operations to arrays. When the arrays have 2 or fewer dimensions, everything is fine. But if you’re doing something even mildly complicated, you inevitably find yourself with some operation you want to apply to some dimensions of array A, some other dimensions of array B, and some other dimensions of array C. And NumPy has no theory for how to express that 」
Is it possible to do gradient descent in python without using numpy. Numpy array is a very strange animal that can result in unexpected results if you try to do some manipulation that other libraries, such as Matplotlib, don't like. On the other hand, python is a bad language for people who want to do simple affine transformation with arrays. Python list is not array and does not allow you to do addition or multiplication. And #python list and #Numpy ndarray are incompatible animals. #AI
Do you maintain or contribute to a #Python package that includes a C extension? Would you like to run a fuzzer against it?
If so, let me know and I will run it, or help you to get it running.
The fuzzer is #fusil, which generates random code calling into your functions and methods. It's useful to check for crashes on invalid inputs or unexpected call patterns.
It has found about 50 crashes in #CPython, 20 in #PyPy, 6 in #Numpy etc.
#fuzzing #fuzzer #testing
See here:
https://github.com/devdanzin/fusil/issues/37
Connaissez-vous l'histoire du mec qui ne sait pas programmer mais que décide dans un moment de passion qu'il va implémenter un truc avec des vraies mathématiques (genre il y a des divisions et tout) en #python ?
Le même gars qui après une demi journée de rage et larmes pose une question tellement spécifique au moteur de recherche qu'il tombe sur l'implémentation déjà existante fournie par #numpy.
C'est à emporter, c'est pour un ami, moi je suis végétarien.
Do dreams transform the world?
A colorful abstract pattern with "reflected noise based tiles" I made for another set of book covers :)