Matrices in Julia
alexhwoods.com
alexhwoods.com
That is true, but if you post a question to their forum, you will get swift answers, often from the core language team:
https://groups.google.com/forum/#!forum/julia-users
Unfortunately these posts don't always show up at the top of a google search, so it's sometimes better to search the user group directly.
Very friendly core language team, by the way :)
fib(n) = ((BigInt [1 1; 1 0])^n)[2,1]
Which defines a fast, exact, Fibonacci function. It's so far the easiest and only way I've managed to calculate the 10^9th Fibonacci number.
Fibonacci sequence = 0, 1, 1, 2, 3, 5, 8...
if M = [1 1; 1 0], then
M^1 = [1 1;
1 0]
M^2 = [2 1;
1 1]
M^3 = [3 2;
2 1]
M^4 = [5 3;
3 2]
M^5 = [8 5;
5 3][F(n+1); F(n)] = [1 1; 1 0]^n * [F(n); F(n-1)]
or
[F(n+1); F(n)] = [1 1; 1 0]^n * [1; 0] if we define F(0) = 0 and F(1) = 1.
However, we can diagonalize [1 1; 1 0] using its eigenvalues and eigenvectors (see here: http://www.wolframalpha.com/input/?i=eigenvectors+of+%7B%7B1...).
For any diagonalizable matrix A = PDP^-1 where P is the matrix of eigenvectors and D is the matrix of eigenvalues on the diagonal, A^n = PD^nP^-1. Try to expand the A^n if you don't believe it. Using this trick, you have simplified the power of a matrix to a power of two floats, namely the eigenvalues.
Julia have been trending for a couple years, and now a lot of researchers publish both R and Julia packages, it seems that in the future most research will be done in Julia.
TL;DR: If you just need basic statistics, interval estimation and alike, then you can use whatever you want, but if you want to use state-of-the-art algorithms. R/Julia are the tools.
The statistical community is still 100% on R and likely will be for some time.
Of course there is both pypy and numba trying to improve the performance on the python side of things.
(I mean, not everything is perfect, but are there side-by-side vector computations, which are nice in Julia, but not ugly in Python?)
A\X'
over the more verbose np.linalg.solve(A,np.transpose(X))For what it's worth I still stick with Python for computer vision applications. I mostly use Julia for timeseries models (e.g. Semi Markov CRFs) where it's harder to vectorize everything.
If I were restart again I'm not sure if I would suggest going the Julia route. I know there are alternatives like Numba that enable you write efficient code with minimal effort. Overall I like Julia as a language but there are a lot of little issues due to it being a new language.
2. (Almost) painless concurrency.
3. Symbolic programming right in the language (think of SymPy built in the language).
4. Closeness to Matlab (which makes it easy to translate existing code).
In general, people tend to port to Julia algorithms that were originally written in Matlab or C++ (with the conciseness of first and speed of the second). For example, I made several attempts to translate Matlab/C++ code of active appearance models to NumPy, but succeeded only with Julia [1]. Another example - Mocha.jl [2] - is a port of Caffe deep learning framework (written in C++ with a wrapper in Python) into a pure Julia, which it easy both to use and modify.
So if you just use existing libraries, there's probably no big difference what to use. But if you actively write new libraries, at least give Julia a try.
I don't like Python that much, but some libraries like Theano or PyMC are really really well done.
There is this for HMC, NUTS gibbs etc : https://github.com/JuliaStats/Lora.jl
But its not ready to use yet it think.
There was a talk about Sigma at JuliaCon this year, but I don't think the video is posted yet.
See example 6 in: https://github.com/andreasnoack/andreasnoack.github.io/blob/...