Recommended objective-c Math libraries for working with Quaternions Matrices Vectors etc - iphone

I'm looking for a good Math library in objective-c that does your usual Matrix Vector and Quaternion tasks for use in conjunction with Core Animation. The library needs to be free for commercial use.
Thanks!

Current versions of iOS include the Accelerate Framework, which includes a large set of accelerated matrix math routines (BLAS, LAPACK, etc.)
Added: You can also use any C math libraries/routines you might have, as Objective C is a compatible superset of ANSI C.

Eigen is a lightweight C++ linear algebra package which provides could matrix, vector and quaternion support. While I have not used it in anger, it seems to have a much nicer interface than BLAS/LAPACK and supports a bunch of things those libraries don't

I don't think you find ObjectiveC math library. I use vfpmathlibrary

Related

Is Breeze worth the dependency?

I am programming a machine learning algorithm in Scala. For that one I don't think I will need matrices, but I will need vectors. However, the vectors won't even need a dot product, but just element-wise operations. I see two options:
use a linear algebra library like Breeze
implement my vectors as Scala collections like List or Vector and work on them in a functional manner
The advantage of using a linear algebra library might mean less programming for me... will it though, considering learning? I already started learning and using it and it seems not that straight forward (documentation is so-so). (Another) disadvantage is having a extra dependency. I don't have much experience in writing my own projects (so far I programmed in the job, where libraries usage was dictated).
So, is a linear algebra library - e.g. Breeze - worth the learning and dependency compared to programming needed functionality myself, in my particular case?

Complex inverse and complex pseudo-inverse in Scala?

I'm considering to learn Scala for my algorithm development, but first need to know if the language has implemented (or is implementing) complex inverse and pseudo-inverse functions. I looked at the documentation (here, here), and although it states these functions are for real matrices, in the code, I don't see why it wouldn't accept complex matrices.
There's also the following comment left in the code:
pinv for anything that can be transposed, multiplied with that transposed, and then solved
Is this just my wishful thinking, or will it not accept complex matrices?
Breeze implementer here:
I haven't implemented inv etc. for complex numbers yet, because I haven't figured out a good way to store complex numbers unboxed in a way that is compatible with blas and lapack and doesn't break the current API. You can set the call up yourself using netlib java following a similar recipe to the code you linked.

Accelerate framework on iphone

Accelerate framework is nice if I want to do some algebra on vectors or calculate ffts.
But, unless I'm missing something, in case I want to calculate cosine (or any other trig) of values in a vector there is no way to do that with accelerate. Also, vecLib is marked as unavailable on iphone and vDSP is missing things like square roots, logarithms, trigonometric functions...
Am I really correct? o_O
If I am, how to speed up the calculations of these missing functions and take advantage of facilities accelerate is using?
The answer:
As MrMage said below, there is a vv... family of functions available in Accelerate. These include trigs, log's, roots, etc. But no complex numbers support. Thanks MrMage!
According to the iOS 5.1 docs, at least vvsinf (and similar functions from vecLib) are available in iOS 5.0 and later. I guess this should fulfill your needs.
My reading of the documentation tells me that Accelerate/vfp.h exists on iOS, and that the trig functions are in there. However I haven't tried using it, so I'll carry on on the assumption that I'm wrong.
Fast trig implementations turn out not to be very clever. There's a maths thing called the Taylor expansion, which says, roughly:
sin(theta+epsilon) = sin(theta) + x*epsilon + small corrections
So that means you can build a lookup table that, for key values of theta, records sin(theta) and x. You then do the equation above, which is really fast (look at Accelerate's Fused Add and Multiply).

iOS5 Objective-C library for numerical analysis or GNU Octave wrapper class?

I'm doing some numerical estimation and correction with the Kalman filter, and would like to better estimate my parameters of Q and R, preferably dynamically.
http://en.wikipedia.org/wiki/Kalman_filter#Estimation_of_the_noise_covariances_Qk_and_Rk
That article mentions that GNU Octave is currently the best way of determining these parameters from data:
http://en.wikipedia.org/wiki/GNU_Octave#C.2B.2B_integration
Unfortunately it is written for Matlab, and there's supposedly a C++ implementation. I'm very weak in C++ and would not even know how to import a C++ library and link it properly in XCode. All of my C++ libraries to date have been wrapped in 3rd party Objective-C classes.
Has anyone used the C++ implementation for scientific computing or engineering applications on iPhone? I'd appreciate any pointers or tutorials on how to do this kind of analysis with Objective-C.
Additional keywords:
estimating covariance from data
Autocovariance Least-Squares (ALS) technique
noise covariance
Thank you!
I do not know of any such C++ library, if you fancy doing numerical analysis on iOS, the best way to go is the accelerate framework, specifically (from this description):
Linear Algebra: LAPACK and BLAS
The Basic Linear Algebra Subprograms (BLAS) and Linear Algebra Package
(LAPACK) libraries contain—as you would expect—functions to perform
linear algebra computations such as solving simultaneous linear
equations, least squares solutions of linear equations, and eigenvalue
problems. The BLAS library serves as a building block for the LAPACK
library. The BLAS and LAPACK libraries are widely distributed and
industry standard computational libraries. They are available on a
number of different platforms and architectures. So, if you are
already using these libraries you should feel right at home, as the
APIs are exactly the same on Mac OS X.
You'll need a fairly good grounding in C, pointers, arrays and such though, no way around it I feel. There is a detailed description of how to use these linear algebra primitives to implement kalman filtering (although this is using R, so probably not of mush use to you).
This is a SO post on Kalman Filtering which expressed my opinion quite well. I'm afraid I think the chances of finding a magic Objective-C wrapper for Kalman Filtering are fairly low, though I would be very happy to be proven wrong!

3D-accellerated plotting, as flexible as matlab, mathematica etc?

I am looking for a library to plot large data sets with a feature set similar to professional plotting tools (e.g. Matlab, Mathematica), but 3D accelareted. In particular I value
can be scripted like the professional tools above (flexible usage)
has a feature at least as big as these
fast (well, that's what the title says)
I can imagine (actually, I have very much in mind) something like this might exist for python - say, NumPy, SciPy. But I am not well-versed with these libraries yet. It would be great if I could convince people to abandon matlab.
Check out Mayavi, a 3d visualization package for Python that wraps around VTK. It's very flexible, has decent documentation, and hardware-accelerated rendering.
MathGL is cross-platform GPL library written in C/C++ which can plot huge data set (including 2- and 3-ranged data). Its list of graphics types is the same or larger than ones in Matlab and in Mathematica. MathGL have its own scripting language (MGL) and have interfaces to Python (including numpy), Fortran, Octave, Forth, Pascal and so on.