Matrix inversion (ii): Inverse matrix

Source: Internet
Author: User

1. Mathematical Definitions

  Definition: for n-order matrix a, if there is an n-order matrix B, the

        AB=BA=E

It is said that matrix a is reversible, and the matrix B is called a inverse matrix .

Theorem: If matrix A is reversible, then | A|≠0.

Theorem: If | a|≠0, the matrix A is reversible and

a-1=1/| a|*a*

2. Algorithm implementation

1) Determinant of matrix

    " " <summary>    " "returns the determinant of a matrix" " </summary>    " " <param name= "Dmatrix" >Original Matrix</param>    " " <returns></returns>    " " <remarks></remarks>     Public Shared FunctionDetofmatrix (ByValDmatrix asMatrix) asdeterminantDimTempdet as Newdeterminant (dmatrix.rowlength) fori =1  toTempdet.rank forj =1  toTempdet.rank Tempdet.item (i, J)=Dmatrix.item (i, J)Next        Next        ReturnTempdetEnd Function

2) matrix inversion

    " " <summary>    " "returns the inverse matrix of a matrix" " </summary>    " " <param name= "Imatrix" >Original Matrix</param>    " " <returns></returns>    " " <remarks></remarks>     Public Shared FunctionInversematrix (ByValImatrix asMatrix) asMatrixDimTempmatrix as NewMatrix (imatrix.rowlength, Imatrix.collength)DimTempdet asdeterminant =Matrix.detofmatrix (Imatrix)DimTempdetvalue as Double=Tempdet.value Tempmatrix=Matrix.adjointmatrix (Imatrix)MsgBox(Tempdetvalue)If  notTempdetvalue =0  Then            Return(Tempmatrix * (1/tempdetvalue)) Else            Return  Nothing        End If    End Function

Matrix inversion (ii): Inverse matrix

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.