4x4 Matrix Decomposition Algorithm

I am working on a very large project, and I am trying to revise and solve a problem that I have had for quite some time: 4x4 matrix partition algorithm.

I am writing a commercial game and a simulator. This is an API and platform agnostic engine written entirely in C #. It uses SlimDX as its DirectX server, and I will probably stick with OpenTK for the OpenGL frontend. Since I cannot rely on DirectX or OpenGL math libraries or data types (e.g. Vector2, Vector3, Quaternion, Matrix, etc.), I have to write my own types for the engine. I am done and very well optimized; and the API is semantically similar to XNA because I (and many others) loved XNA to “feel” and felt that it was very elegant and powerful. But do not confuse; this project does not use and has nothing to do with XNA. Anyway, I was able to handle everything except ONE thing ... Matrix.Decompose !!!

The problem is that I just have no idea what I'm doing in this ... I am a self-taught programmer and self-taught in almost everything else (business finance, day trading, German, etc.). This is exactly how I find out. I only had one year and one semester of college, so I do not have a formal education in complex mathematics. Therefore, when I go to Wikipedia and look at the formulas for the decomposition of the Matrix, all this is Greek for me .... a lot of funny characters and diagrams that mean nothing to me. I have always been a poor mathematician, because mathematics just eludes me if I can’t practically apply it to something (for example, to programming games). For example, I can write complex physical modeling of ballistics, but I couldn’t even help my friend with her basic physics and calculus of homework, because it is a bunch of “high-level theoretical mathematics” and I can’t bridge the gap with practicality or programming, therefore I I’m just very lost, I don’t know what I’m doing, and very disappointed ...

What I need to do, in particular, is a mirror of the Matrix.Decompose functionality found in the XNA Framework and DirectX. I tried to find an implementation in the SlimDX source and the OpenTK source, but none of them were implemented! SlimDX just puts off work to the native DirectX libraries, and OpenTK just doesn't have it. Since this algorithm is one large, terribly complex beast, I am not surprised that no development team will want to implement their own. But I need to.

I tried to turn these monstrous formulas into Wikipedia and other sites into a working C # algorithm, but I just can't make heads or tails. I really need to see a working implementation of it in C, C ++ or C # or ask someone to help me figure this out with pseudo code or something else. I simply cannot understand these formulas and the "higher level" theories of mathematics. If you can do something to help (link, working implementation, some pseudocode, etc.), we will be very grateful.

+4
source share
2 answers

Check out the DotNetMatrix , which is a C # library for performing all types of matrix transformations, including Cholesky Decomposition , and this is what I think you're looking for. In addition, its free and source code is included!

0
source

It is best to use an existing matrix library. Pay attention, for example, to ILNumerics. It supports many common matrix decompositions (no "matrix decomposition"): http://ilnumerics.net/$FeatureList.html

This is a commercial license, but since you are selling your engine, it may not be a problem for you.

Free Math.NET , but the section "Decompositions and least squares of problems" is empty, which leads me to believe that they have not yet been implemented.

-1
source

Source: https://habr.com/ru/post/1436231/


All Articles