## ProblemYou want to invert a matrix. ## SolutionSample code folder: Chapter 06\Matrix Use the ## DiscussionThe inverse of a matrix is another identically sized matrix that, when multiplied with the original matrix, gives the identity matrix. Only square matrices can be inverted. Matrix inversion is one of the basic matrix operations used for scientific, engineering, and computer graphics work. (A full description of matrices and their operations is beyond the scope of this book.) Visual Basic 2005 is a good language for developing high-speed .NET Frameworkbased mathematical collections of number-crunching routines. It allows you to create fast-running classes, structures, and modules containing related functions or methods to meet many requirements. This recipe presents the code required to invert a matrix efficiently: Dim matrixA(,) As Double = { _ {1, 3, 3}, _ {2, 4, 3}, _ {1, 3, 4}} Dim matrixB(,) As Double = MatrixHelper.Inverse(matrixA) MsgBox(MatrixHelper.MakeDisplayable(matrixA) & _ vbNewLine & vbNewLine & "Inverse: " & _ vbNewLine & MatrixHelper.MakeDisplayable(matrixB))
Figure 6-32 shows the result of finding the inverse of a 3 x 3 matrix. ## Figure 6-32. Finding the inverse of a square matrix with the MatrixHelper.Inverse( ) functionTo use the ## See AlsoSee the full MatrixHelper.vb listing in Recipe 6.35. |

Visual Basic 2005 Cookbook: Solutions for VB 2005 Programmers (Cookbooks (OReilly))

ISBN: 0596101775

EAN: 2147483647

EAN: 2147483647

Year: 2006

Pages: 400

Pages: 400

Authors: Tim Patrick, John Craig

Similar book on Amazon

flylib.com © 2008-2017.

If you may any questions please contact us: flylib@qtcs.net

If you may any questions please contact us: flylib@qtcs.net