Admin Production ni-theme
Current Publication

ForwSub

LabWindows/CVI

ForwSub

Advanced Analysis Library Only

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

Purpose

Solves linear equations AX=Y using forward substitution. ForwSub assumes that A is an LU-decomposed lower triangular matrix. ForwSub obtains X using the following formulas:

x0 = y0

for i = 1, 2, . . ., arraySizes – 1

ForwSub can perform the operation in place; that is, the input and output arrays can be the same.

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 * The lower triangular matrix from LU decomposition. This matrix must be an array of doubles.
knownVector_y double [] 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.
permutationVector ssize_t [] The permutation vector obtained from the LU decomposition. This vector has the row exchange information. If there was no row exchange in LU, pi = i.
Output
Name Type Description
outputVector_x double [] The solution vector.

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