r/cprogramming • • 9d ago

I built a zero dependencies complex linear algebra library from scratch on C99.

It has zero dependencies and is built entirely from C99 <complex.h> library. Anybody can use my library to write programs utilizing complex vector spaces be it Electrical Engineering, Signal Processing, Quantum Mechanics or even more.

I utilized single pointer flattened arrays for contiguous memory and cache efficiency.

I have included standalone example for every single function I have in my header file under the Examples/ folder.

I also built two pure C applications:

  1. Mesh Analysis on Bilateral Alternating Current Circuits to find mesh currents and power.
  2. von Neumann Quantum Entropy Calculator to measure entropy and uncertainty in qubit systems of pure and mixed probabilities.

Check out my https://github.com/CodeLeverEuler/c-complex-linalg

I'm a freshman and this is my first systems/math library in C. Would love feedback on my API design, memory contracts, or numerical stability edge cases!

Thank you
EDIT:
Some are suspicious that this is AI generated. I didn't know that was an issue. I thought I wouldn't make my repository public until it's done.
I can't share the image from my local file here. But if anyone is having second thoughts, I have timestamps on my private Git repository and local files

20 Upvotes

15 comments sorted by

View all comments

Show parent comment

1

u/Nonyabuizness 8d ago

I didnt use a Matrix type because I wanted user to be able to pass raw stack and static data. I took more of leave everything to the user approach.

Regarding the return 0, I wanted to make sure my library never causes the segfault. But after you explained....maybe I could have used return NaN