LinearAlgebra[LinearSolve]  solve the linear equations A . x = b

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 ; options to control the solution method





Description


•

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


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 AB, where B is a column Vector.


The dimensions of the returned object agree with the Matrix equation . 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, , 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, , is interpreted as the result of calling LUDecomposition with the option. The implied option is method=LU.


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


* A list of Matrix, Vector items, , 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, , is interpreted as the result of calling QRDecomposition with the option. The implied option is method=QR.


The sparse methods cannot be used with prefactored input.

•

The 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 floatingpoint mode and then does iterative refinement in software floatingpoint 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 for a machine size prime and padic lifting is used to construct the rational solutions.

•

The inplace option (ip) determines where the result is returned. In the case of a nonaugmented 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 . 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


>


>


>


 (1) 
>


 (2) 
>


>


>


 (3) 
>


>


>


 (4) 
>


 (5) 
>


>


>


 (6) 
>


>


>


>


 (7) 
>


 (8) 

