<< linalg_gaussnaive linalg linalg_gausspivotalnaive >>

linalg >> linalg > linalg_gausspivotal

linalg_gausspivotal

Computes the solution of a linear equation with Gauss and row pivoting.

Calling Sequence

x = linalg_gausspivotal ( A , b )
x = linalg_gausspivotal ( A , b , verbose )

Parameters

A :

a n-by-n matrix of doubles

b :

a n-by-1 matrix of doubles

verbose :

a 1-by-1 matrix of boolean (default verbose = %f), set to %t to display intermediate messages

x :

a n-by-1 matrix of doubles

Description

Returns the solution of Ax = b with a Gauss elimination and row exchanges. This algorithm might be sensitive to inaccuracies if A near singular. There is no solution is A is singular. If A is not ill-conditionned, the algorithm is accurate. Uses an effective algorithm with vectorization.

Examples

A = [
3 17 10
2 4 -2
6 18 -12
];
b = [
67
4
6
];
x = linalg_gausspivotal ( A , b )
xe = [1 2 3]'
// See what happens
x = linalg_gausspivotal ( A , b , %t )

// See the algorithm
edit linalg_gausspivotal

Authors


Report an issue
<< linalg_gaussnaive linalg linalg_gausspivotalnaive >>