LinearAlgebra - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Linear Algebra : LinearAlgebra Package : Solvers : LinearAlgebra/LinearSolve

LinearAlgebra

  

LinearSolve

  

solve the linear equations A . x = b

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

LinearSolve(A, B, m, t, c, ip, options, methopts)

Parameters

A

-

Matrix or list

B

-

(optional) Matrix or column Vector

m

-

(optional) equation of the form method = name where name is one of 'none', 'solve', 'subs', 'Cholesky', 'LU', 'QR', 'hybrid', 'modular', 'SparseLU', 'SparseDirect', or 'SparseIterative'; method to use

t

-

(optional) equation of the form free = name; base name to use for free variables in parametrized solutions

c

-

(optional) BooleanOpt(conjugate); specifies whether to use the Hermitian transpose in the case of Cholesky or QR decomposition methods

ip

-

(optional) BooleanOpt(inplace); specifies if output overwrites the second argument B

options

-

(optional); constructor options for the result object

methopts

-

(optional) equation of the form methodoptions=list; options to control the solution method

Description

• 

The LinearSolve function returns the Vector or Matrix x that satisfies the linear system A.x=B.

  

If B is included in the calling sequence as a Matrix or a Vector, then the returned object is of the same type.

  

If B is omitted, then the linear system is interpreted from the first argument, which is taken to be the augmented linear system A|B, where B is a column Vector.

  

The dimensions of the returned object agree with the Matrix equation A.x=B. If A is m x n and B is m x p, then the solution x will be n x p.

  

If the solution x is computed inplace upon B, then n must be at least as large as m.

• 

If method='subs' is specified in the calling sequence, then the first argument must be a Matrix with triangular shape. If it is upper triangular, then the Matrix is assumed to be in upper echelon form and back substitution is performed by using BackwardSubstitute. If the Matrix is lower triangular, then forward substitution is performed by using ForwardSubstitute.

• 

If the first argument 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 interpreted, uniquely, as follows:

  

*   A list of Vector, Matrix items, ipiv,LU, is interpreted as the result of calling LUDecomposition with the output='NAG' option. The first member is taken as the pivot Vector and the second member as the superimposed LU factors. The implied option is method=LU.

  

*   A list of Matrix, Matrix, Matrix items, P,L,U, is interpreted as the result of calling LUDecomposition with the output='P','L','U' option. The implied option is method=LU.

  

*   A list of a Matrix item, L, is interpreted as the result of a Cholesky decomposition. The data is taken as the lower triangle of the Matrix. The implied option is method=Cholesky.

  

*   A list of Matrix, Vector items, QR,τ, is interpreted as the result of calling QRDecomposition with the output='NAG' option. The implied option is method=QR.

  

*   A list of Matrix, Matrix items, Q,R, is interpreted as the result of calling QRDecomposition with the output='Q','R' option. The implied option is method=QR.

  

The sparse methods cannot be used with prefactored input.

• 

The method='SparseIterative' option is compatible with real symmetric or complex hermitian Matrices having storage mode sparse[lower] or sparse[upper].  It is also compatible with real nonsymmetric or complex nonhermitian Matrices which are square and have storage mode sparse.  This is the default method when such a matrix is specified. The method='SparseDirect' option is compatible with real, square Matrices having storage mode sparse.

• 

The method='hybrid' option provides a LU based solver which operates in part in both hardware and software float modes. This can be a more efficient solver at high settings of Digits. It computes the LU decomposition in hardware floating-point mode and then does iterative refinement in software floating-point mode.

• 

The use of the method='modular' option invokes the LinearAlgebra[Modular][IntegerLinearSolve] routine. It can compute rational solutions for an integer input Matrix. The system is solved mod'p' for a machine size prime and p-adic lifting is used to construct the rational solutions.

• 

The inplace option (ip) determines where the result is returned. In the case of a non-augmented system, if inplace=true is specified in the calling sequence, the computation is performed directly on the second argument. The inplace option is not allowed for an augmented system, or with method='solve'.

  

The inplace=true condition can be abbreviated to inplace.

  

The inplace option must be used with caution since, if the operation fails, the original argument may be corrupted.

• 

The conjugate option (c) specifies whether to use HermitianTranspose in the solution of a system using Cholesky or QRDecomposition methods. The default is true. The conjugate=true condition can be abbreviated as conjugate.

• 

The constructor options provide additional information (readonly, shape, storage, order, datatype, and attributes) to the Vector or 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).

• 

The methodoptions option (methopts) provides ways to control the behavior of the solution method.  Currently, the only options available are used with method=SparseIterative.  For more information, see Sparse Iterative Solver Options.

• 

The inplace and constructor options are mutually exclusive.

• 

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

Examples

withLinearAlgebra:

M1,1,1,4|1,1,2,1|3,1,1,8|1,1,1,1|0,1,1,0:

M_solLinearSolveM

M_sol:=25643522

(1)

M1..1,1..2.M_sol=M1..1,1

0110=0110

(2)

A1,0,0|2,1,0|1,0,0|1,1,3:

b2,1,9:

LinearSolveA,b,method='subs',free='s'

1s12s13

(3)

P4,2,1|2,4,3|1,3,5:

z1,0,0:

LinearSolveP,z,method='Cholesky',inplace

11813854

(4)

z

11813854

(5)

SMatrix5,0,0,0,0,0,0,2,1,2,0,0,0,0,3,0,0,0,2,0,0,1,1,0,1,0,0,1,2,3,1,1,0,0,0,6,datatype=float,storage=sparse:

tVector15,12,18,3,6,0,datatype=float:

LinearSolveS,t,method='SparseIterative'

3.0000000000000033.00000000000006.0000000000000042.000000000000033.5.

(6)

N0,1,1,1,1|2,2,0,2,3|0,0,1,1,3|6,0,3,1,3|2,2,2,2,4:

q,rQRDecompositionN,output='Q','R':

C1,6,0,9,4|1,2,3,4,5:

C_solLinearSolveq,r,C

C_sol:=4831373112161721161283

(7)

N.C_sol=C

1162039445=1162039445

(8)

See Also

LinearAlgebra[BackwardSubstitute]

LinearAlgebra[ForwardSubstitute]

LinearAlgebra[GenerateMatrix]

LinearAlgebra[LeastSquares]

LinearAlgebra[LUDecomposition]

LinearAlgebra[Modular][IntegerLinearSolve]

LinearAlgebra[QRDecomposition]

Matrix

rtable_indexfcn

Vector

 


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