elcritch

elcritch

Math/Stats library Numeric ported to Matrex

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.

Most Liked

elcritch

elcritch

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.

Last Post!

dsd

dsd

Much appreciate the response. That helps.

Where Next?

Popular in Announcing Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36654 110
New
bryanjos
Hi, I just published version 0.23.0 of Elixirscript. https://github.com/bryanjos/elixirscript/blob/master/CHANGELOG.md Most of the chan...
New
OvermindDL1
I created a new library (rather I pulled out a couple files from my big project), it manages an operating system PID file for the BEAM. ...
New
Crowdhailer
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure). 1.0-rc.1 is now available. To use it re...
New
nikokozak
Hello all, I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed succ...
New
type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
zoltanszogyenyi
Hey everyone :waving_hand: Excited to join this forum - I am one of the founders and current project maintainers of a popular and open-s...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New

We're in Beta

About us Mission Statement