elcritch

elcritch

MatrexNumerix - Numeric stats library ported to (fast) nif based matrix library Matrex for fast stats and data-science.

I ported the Numerix math and statistics library to use the Matrex library. A couple of convenience functions have been added to Matrex, primarily Matrex.from_list/1 which produces a “vector” (just 1 row matrex with function guards). These can then be properly dotted as vectors by using the Matrex.inner_dot/2 function. This enables most “vector” based numerical algorithms to be encoded without getting transposes mixed up.

On the Numerix side the port contains almost all of the features of the original library. The test framework has been switched to plain exunit.

A new feature that’s been added is a 1d fast Fourier transform (FFT) which produces results comparable to NumPy’s fft module. It supports complex numbers by using a 2xN matrix size (e.g. real and imaginary components are stored in separate rows side by side). It’d be possible to generalize it to 2d (or more) for image FFT’s, if anyone’s interested.

One last note is that a polynomial fitting function has been added to Matrex.Algorithms.fit_poly/3 which supports fitting polynomial coefficients for a given x and y vector using gradient descent. Sometimes this produces better results than least squares.

Showing Posts 1 to 3

dsd

dsd

Is Matrex the go to math and statistics library for Elixir? I could not find a way to use FFT as mentioned in this post. Any guidance on how to use FFT with Matrex?

elcritch

elcritch OP

Matrex is mostly for linear algebra and such. Numerix is probably the closest to a “math and statistics” Elixir has currently (that I know of). So I’d ported Numerix to Matrex, and added a few extras (like the FFT).

See matrex_numerix/test/fft_test.exs at master · elcritch/matrex_numerix · GitHub for how to use it. It should be back-portable to Numerix or Nx. Note it’s probably not fast.

Note, the to_freq_and_amplitude is important to put the data in a recognizable frequency power form.

MatrexNumerix currently uses a forked version of Matrex that supports vectors (aka rank 1 tensors).

The FFT in theory should be portable to Nx as well.

dsd

dsd

Much appreciate the response. That helps.

— All posts loaded —

Where Next? Top

Trending in Announcing Top

wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
handnot2
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application. This library uses Erlang esaml to provide plug enabl...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New
pferriby
Introductory paragraph I’ll be looking for a keen junior or someone that has a couple of years experience in the real world (so you’ve be...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews