LinearAlgebra - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Linear Algebra : LinearAlgebra Package : Standard : LinearAlgebra/MatrixInverse

LinearAlgebra

  

MatrixInverse

  

compute the inverse of a square Matrix or the Moore-Penrose pseudo-inverse of a Matrix

 

Calling Sequence

Parameters

Description

Examples

References

Calling Sequence

MatrixInverse(A, m, mopts, c, out, options)

Parameters

A

-

Matrix or list

m

-

(optional) equation of the form method = name where name is one of 'LU', 'Cholesky', 'subs', 'integer', 'univar', 'polynom', 'complex', 'rational', 'pseudo', or 'none'; method used to factorize the inverse of A

mopts

-

(optional) equation of the form methodoptions=list where the list contains options for specific methods

c

-

(optional) BooleanOpt(conjugate); specifies whether to use the Hermitian transpose in the case of prefactored input from a Cholesky decomposition

out

-

(optional) equation of the form output=obj where obj is 'inverse' or 'proviso' or a list containing one or more of these names; selects the result objects to compute

options

-

(optional); constructor options for the result object

Description

• 

The MatrixInverse(A) function, where A is a nonsingular square Matrix, returns the Matrix inverse A-1.  If A is singular, an error message is returned.  If A is non-square, the Moore-Penrose pseudo-inverse is returned.

• 

If A is a nonsingular nxn Matrix, the inverse A-1 is computed such that A.A-1=I, where I is the nxn identity Matrix.

• 

If A is a non-square mxn Matrix, or if the option method = pseudo is specified, then the Moore-Penrose pseudo-inverse X is computed such that the following identities hold:

  

A.X.A=A

  

X.A.X=X

  

HermitianTransposeA.X=A.X

  

HermitianTransposeX.A=X.A

• 

If m is included in the calling sequence, then the specified method is used to compute the inverse (except for 1x1, 2x2 and 3x3 Matrices where the calculation of the inverse is hard-coded for efficiency).

  

The complex and rational methods augment the input Matrix with a copy of the identity Matrix and then convert the system to reduced row echelon form.

  

The integer method calls `Adjoint/integer` and divides it by the determinant.

  

The univar method uses an evaluation method to reduce the Matrix to a Matrix of integers, then uses `Adjoint/integer`, and then uses genpoly to convert back to univariate polynomials.

  

The polynom method uses an implementation of fraction-free Gaussian elimination.

  

The LU and Cholesky methods use the corresponding LUDecomposition method on the input Matrix (if not already prefactored) and then use forward and back substitution with a copy of the identity Matrix as a right-hand side.

• 

The subs method indicates that the input is already triangular, so only the appropriate forward or back substitution is done.

• 

If the first argument in the calling sequence is a list, then the elements of the list are taken as the Matrix factors of the Matrix A, due to some prefactorization. These factors are in the form of returned values from LUDecomposition. That is, the list items may be:

  

*  A list of a Vector and Matrix, ipiv,LU, for an LU decomposition. The first member is taken as the pivot Vector and the second member as the superimposed unit-lower and upper triangular LU factors (these are the default values returned from LUDecomposition when the method=NAG option is given to that routine). The implied option is method=LU.

  

*  A list of 3 Matrices, P,L,U, the PLU decomposition of a Matrix (these are the values returned from LUDecomposition when the output=['P','L','U'] option is given to that routine). The inverse is U-1.L-1.P-1, each component of which can be inexpensively computed (compared to the cost of obtaining the factors). The implied option is method=LU.

  

*  A list of a single Matrix, [L], for a Cholesky decomposition (as obtained from the LUDecomposition routine when the method=Cholesky option is specified). The data is taken as the lower triangle of the Matrix. The implied option is method=Cholesky.

  

Thus, prefactored data supplied for the Matrix argument uniquely determines the computation scheme. The method=name option, if specified with prefactored data, must be in agreement.

• 

The methodoptions&equals;list option can be used to specify options to a particular method.  This pertains only to the pseudo-inverse method. The method specific option specified in the list can be of the form tolerance&equals;value, where <value> is a positive number. This number, usually small, is used in the case of a floating-point Matrix as the tolerance for accepting a singular value as being effectively nonzero, for use in the pseudo-inverse computation.

• 

The conjugate option specifies whether to use the Hermitian transpose when A is a list of a single Matrix from a symbolic Cholesky decomposition. The default is true. The conjugate=true condition can be abbreviated as conjugate.

• 

The output=obj option can be used to specify the objects returned. The two possible outputs are inverse and proviso. The proviso is relevant only to the Moore-Penrose pseudo-inverse computation. In the floating-point case, it is the ratio of the largest singular value accepted as nonzero to the first singular value. In the exact symbolic case, it is the determinant of the Matrix. If this proviso is zero, in the exact case, or close to zero in the floating-point case, then the four identities given will not necessarily hold.

• 

If you want to compute a single product A-1&period;B, for a Vector or Matrix B, it is typically more efficient to use the command LinearAlgebra&lsqb;LinearSolve&rsqb;A&comma;B than computing the inverse of A and then the product. If you need to do this many times with the same floating point Matrix A, then you can obtain fast and accurate results by computing its LU decomposition or QR decomposition, and passing that to LinearAlgebra[LinearSolve]. See the LinearSolve help page for more details.

• 

The constructor options provide additional information (readonly, shape, storage, order, datatype, and attributes) to the Matrix constructor that builds the result. These options may also be provided in the form outputoptions=[...], where [...] represents a Maple list.  If a constructor option is provided in both the calling sequence directly and in an outputoptions option, the latter takes precedence (regardless of the order).

• 

This function is part of the LinearAlgebra package, and so it can be used in the form MatrixInverse(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[MatrixInverse](..).

• 

This function has an equivalent shortcut notation, A-1, for square Matrices A.

Examples

withLinearAlgebra&colon;

MatrixInversea&comma;c&verbar;b&comma;d

dadbcbadbccadbcaadbc

(1)

MatrixInverse1&comma;2&comma;3&comma;4&verbar;2&comma;3&comma;4&comma;0&verbar;3&comma;4&comma;0&comma;0&verbar;4&comma;0&comma;0&comma;0&comma;method&equals;integer

000140014316014316164143161645256

(2)

A23&comma;13&comma;13&verbar;13&comma;23&comma;13&verbar;13&comma;13&comma;23&colon;

A has rank 2 and, hence, is singular:

MatrixInverseA

Error, (in MatrixInverse) singular matrix

B1&comma;0&comma;0&comma;0&verbar;1&comma;1&comma;0&comma;0&verbar;1&comma;1&comma;1&comma;0&verbar;1&comma;1&comma;1&comma;1&colon;

MatrixInverseB&comma;method&equals;subs

1100011000110001

(3)

CMatrix16&comma;30&comma;21&comma;25&comma;16&comma;68&comma;42&comma;52&comma;36&comma;36&comma;37&comma;24&comma;53&comma;30&comma;20&comma;scan&equals;triangularupper&comma;shape&equals;symmetric&comma;datatype&equals;float&colon;

GLUDecompositionC&comma;method&equals;Cholesky&colon;

C1MatrixInverseG

C1:=0.6297577854671280.4100346020761240.2041522491349480.1557093425605540.7128027681660900.4100346020761240.6557093425605530.1851211072664360.1920415224913491.362456747404840.2041522491349480.1851211072664360.2145328719723180.04498269896193770.4948096885813150.1557093425605540.1920415224913490.04498269896193770.1868512110726640.5553633217993080.7128027681660901.362456747404840.4948096885813150.5553633217993083.35899653979239

(4)

mapfnormal&comma;C1&period;C

1.0.0.0.0.0.1.0000000000.0.0.0.0.1.0000000000.0.0.0.0.1.0000000000.0.0.0.0.1.

(5)

p&comma;luLUDecompositionC&comma;output&equals;&apos;NAG&apos;&colon;

C2MatrixInversep&comma;lu

C2:=0.6297577854671280.4100346020761240.2041522491349480.1557093425605530.7128027681660880.4100346020761240.6557093425605530.1851211072664360.1920415224913491.362456747404840.2041522491349480.1851211072664350.2145328719723180.04498269896193730.4948096885813130.1557093425605540.1920415224913490.04498269896193780.1868512110726640.5553633217993080.7128027681660901.362456747404840.4948096885813150.5553633217993063.35899653979238

(6)

mapfnormal&comma;C&period;C2

1.0.0.0.0.0.1.0000000000.0.0.0.0.1.0000000000.0.0.0.0.1.0.0.0.0.0.1.

(7)

M1&comma;3

M:=13

(8)

MiMatrixInverseM&comma;method&equals;pseudo

Mi:=110310

(9)

NormM&period;Mi&period;MM

0

(10)

NormMi&period;M&period;MiMi

0

(11)

NormHermitianTransposeMi&period;MMi&period;M

0

(12)

NormHermitianTransposeM&period;MiM&period;Mi

0

(13)

M2.0&comma;1.0&comma;1.0&verbar;0.0&comma;3.0&comma;1.0

M:=2.00.1.03.01.01.0

(14)

MatrixInverseM&comma;method&equals;pseudo&comma;methodoptions&equals;&apos;tolerance&apos;&equals;0.000005&comma;output&equals;&apos;inverse&apos;&comma;&apos;proviso&apos;

0.4545454545454550.04545454545454540.1363636363636360.1818181818181820.3181818181818180.0454545454545456&comma;0.531845515847812

(15)

References

  

de Boor, Carl. "An Empty Exercise." ACM SIGNUM Newsletter, Vol. 25 Iss. 2. (1990): 2-6.

See Also

genpoly

LinearAlgebra[Adjoint]

LinearAlgebra[LinearSolve]

LinearAlgebra[LUDecomposition]

LinearAlgebra[QRDecomposition]

Matrix

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam