Admin Production ni-theme
Current Publication

BackSub

LabWindows/CVI

BackSub

Advanced Analysis Library Only

AnalysisLibErrType BackSub (void *inputMatrixA, double knownVectory[], ssize_t arraySizes, double outputVectorx[]);

Purpose

Solves linear equations AX=Y using backward substitution. BackSub assumes that A is an upper triangular matrix whose diagonal elements are all ones. BackSub obtains X using the following formulas:



The input matrix must be an upper triangular matrix or a matrix obtained from LU decomposition.

BackSub can perform the operation in place; that is, the input and output arrays can be the same. Use BackSub in conjunction with LU and ForwSub to solve linear equations.

Example Code

/* to solve a linear equation A*x = y */
double A[10][10], x[10], y[10];
int p[10]; /* permutation vector */
int sign, n;
n = 10;
LU(A, n, p, &sign); /* LU decomposition of A */
ForwSub(A, y, n, x, p); /* forward substitution */
BackSub(A, x, n, x); /* backward substitution */

Parameters

Input
Name Type Description
inputMatrix_A void * Input square matrix. inputMatrixA can be either an upper triangular matrix or a matrix from the LU decomposition. This matrix must be an array of doubles.
knownVector_y double [] The array that represents the set of known vector coefficients.
arraySizes ssize_t The number of rows and columns in the square input matrix and the number of elements in the known vector array. The size of knownVectory must be arraySizes.
Output
Name Type Description
outputVector_x double [] The solution vector. outputVectorx can be NULL or knownVectory to perform in place operation.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.

Additional Information

Library: Advanced Analysis Library

Include file: analysis.h

LabWindows/CVI compatibility: LabWindows/CVI 3.1 and later