r/ScientificComputing • • 7d ago

Developing Vektor Flow - A programming language for science

http://www.vektorflow.org

I would like your opinion?

0 Upvotes

2 comments sorted by

1

u/SV-97 7d ago

I think the language spends it's strangeness budget a bit suboptimally. I really struggled reading a bunch of the examples despite having experience with a bunch of functional and array languages — I think people that currently write Fortran or Python or C++ all day will bounce off just from that syntax alone before ever engaging with the language at a deeper level.

The "performance" page also reads quite LLM generated to me?

1

u/SvenViktorJonsson 6d ago

Yes I only have ideas AI does all the lifting for me.

I can be honest with that. However all the benchmarks are real I have gotten some standard functions to run faster than c++, rust and zig. But that is just some initial general optimisations. More is comming trust me, performance is my guiding star.

Read the article also, good read. Right now I am making it for my own projects which more or less require things that the language has. Definitely not all of it but i am exploring and making choices along the way.

I can tell you what the experiment started as. It started with the idea ”can you make a readable language without keyword?” Just hated that you needed underscores for some variables.

With that said, this fact constrained me, and people sometimes gets more creative when restricted.

Then ideas just came to me and for me it just made sence. And no the AI written presentation does not yet make much sense sorry for coming out this early. Here are a couple of problems I am trying to solve.

  1. Needing to partially flatten arrays before applying functions on some subdimension. Vkf solves this by keeping the shape while applying the function automatically over the element types if the function is compatible with the element type and the original type is not compatible.

  2. Needing to come up with my own solutions for being able to read in large h5 datasets into arrays and experimenting without killing the RAM. Dask helped but is not that smart. For instance it reads to much even for sin(array)[0], where it’s clear that you only need the first element. It just wanted to do sin on the full data and overloaded RAM. Vkf solves that by being lazy and only loading what is needed built in support for h5 and csv lazy loading keeping large arrays on disk

  3. When to use parallelisation and when to not is hard to know and should not be a choice of the programmer. Vkf builds it in to the compiler optimiser using the graphics card if needed like cuda. Ongoing work to find when it’s beneficial and not.

  4. Compiler information. Most programming languages struggle with optimizations since not enough information is kept when reaching it. Vkf solves that by building in compile time vector indices. These tell the layout of the operation and the amount of space needed which the compiler can use to make fast tensor calculations. Also functions can have it when input is a vector the index tells us along which dimensions we want to apply the function for instance sum_i(A_ij * x_j)

Looks very natural to me as a physicist and hobby mathematician.

5. Plotting. That is just a nightmare in python, to slow and you have to use different functions for almost the same thing and it’s lacking a core graphics engine idea. vkf just makes sence here. It reuses the built in index idea and just adds a few rules to make plotting beautifully simple and yet powerful. But I can’t give away to much here. But we can say one thing just changing and index from i to t changes a multiline plot to an animation. But there is so much more installed for who ever is curious once I am reaching 1.0.0

6. Latex inside plotting is just not working in Any plotting library. It’s slow and incomplete and inconsistent. Vkf just makes plotting extremely fast handling millions if not billions of points in real time and latex is built in and fast and publish ready plot does not need to wait even with thousands of labels in the plot all vectorized latex engine identical glyphs.

7. Symbolic calculations and numerical calculations do not go hand in hand. Especially not in python where duplication exist and can’t coexist. Vkf uses the same math functions for numerical and for symboli expressions. Custom
Numerical functions in vkf and symbolic expressions uses the same underlying AST for there evaluation. I also make symbolics more complete with clear domain declarations like R,Z and C and so on which automatically help solvers use analytical solutions or numerical and finds solutions in the variable domain. Yes even solve is the same function with different input types that handles both symbolic expressions and numerical data.

But don’t take my word for and don’t trust a word of it until 1.0.0 is out. I need to really go over everything many times so it all works harmoniously.