5

I'm making use of an ARM Cortex-A8 based processor and I have several places where I calculate 3x3 Matrix inverse operations.

As the Cortex-a8 processor has a NEON SIMD processor I'm interested to use this co-processor for 3x3 matrix inverse, I saw several 4x4 implementations (Intel SSE and freevec) but no where did I see a 3x3 matrix inverse operation carried out using SIMD instructions. The method used by freevec is by splitting the 4x4 matrix into 4, 2x2 matrices, then carry out tiny operations on each and recombine the results in the end to get the inverse of 4x4 matrix. I don't see such an opportunity with 3x3 matrices.

Anyone out there has an idea how to carry out 3x3 matrix inversion using SIMD instructions, it will be very helpful to me?

Regards Vikram

HaggarTheHorrible
  • 7,083
  • 20
  • 70
  • 81
  • 3
    Perhaps of interest: "There is hardly ever a good reason to invert a matrix." http://www.johndcook.com/blog/2010/01/19/dont-invert-that-matrix/ – AakashM Jul 26 '10 at 11:19
  • Will take your comment seriously and see how I can get rid of matrix inversion from my algorithm. – HaggarTheHorrible Jul 26 '10 at 11:59
  • 3
    @AakashM that article is not relevant. John D. Cook's article about matrices is about big matrices used in scientific computing. This question is about small matrices, which are commonly used in computer graphics and physics simulation. It is very useful (and quite fast) to invert small matrices. – exDM69 Jun 25 '12 at 11:19
  • Here is an [old Intel PDF](http://download.intel.com/design/PentiumIII/sml/24504301.pdf) on using XMMS and another [ARM Blog post](http://community.arm.com/groups/processors/blog/2010/06/28/coding-for-neon--part-3-matrix-multiplication) on matrix multiplication. A concise answer will probably be impossible as people will have different needs; speed, code size, memory bandwidth, accuracy, etc. – artless noise Apr 24 '15 at 16:07

3 Answers3

6

You can expand the 3x3 matrix to 4x4 matrix by adding a 4th row and 4th column, both being (0 0 0 1). After inversion, the upper-left 3x3 submatrix will have the required inverse.

zvrba
  • 24,186
  • 3
  • 55
  • 65
3

I've initiated an SIMD based portable library for 2x2, 3x3, and 4x4 matrix inversion:

https://github.com/niswegmann/small-matrix-inverse

Unfortunately 3x3 isn't supported yet (as of writing).

Nis Wegmann
  • 101
  • 1
  • 11
1

You could vectorize the analytic standard version for 3x3 matrices described in wikipedia. It should not be hard.

Staffan
  • 1,769
  • 13
  • 15
  • In that version, notice that the 3 differences used in the determinant are also reused in the other 9 parts. – phkahler Jul 26 '10 at 17:48