[C#] Matrix Multiplication Helper Class

Ace, the method I showed for 2x2 will work with any size, square matrix. See post #6 for the algorithm I developed to do the same steps in for loops for any matrix height matH. You just recursively update each row after getting rid of the upper and lower diagonal portions of it.

By the way, you should take the determinant of the matrix to make sure an inverse exists prior to trying to actually calculate the inverse.



I already did that earlier today (this morning). My class is much extended now: Matrix Operations - Helper Class

I just haven't updated it here.

I'll see what I can do, I don't really like the way you did it though lol, I like my multi-dimensional arrays.

edit: Actually, It seems I already had that implemented yesterday night with IsSingular().
03-04-2013, 09:58 PM (This post was last modified: Yesterday 05:12 AM by AceInfinity.)

*Updated: 10/03/2013

Once I get the Inverse working though I want to get rid of all that static crap I have going on, and make everything internal to that instance. No sense in static since a Matrix object needs to be instantiated anyways to use most of those methods.
 
Last edited:
No need to use my method directly. I provided it as an example to help you understand how the inverse calculation works. As I said, my method had to be ported between c++ and Fortran, so I made it as simple as possible just using for loops with a one dimensional array. The strategy would be the same for two dimensions, and it would likely be easier and cleaner to follow.
 
No need to use my method directly. I provided it as an example to help you understand how the inverse calculation works. As I said, my method had to be ported between c++ and Fortran, so I made it as simple as possible just using for loops with a one dimensional array. The strategy would be the same for two dimensions, and it would likely be easier and cleaner to follow.

That was my point though, I can follow your code, a multi-dimensional array would be cleaner, but I'm still in the process of learning more about the various ways that an Inverse can be calculated. Not that yours is wrong, but it seems there are variations, and for each method, variations in the algorithms that can be used.
 

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top