Main Page | Directories | File List | Globals

R_ldl.h File Reference

#include <R_ext/RS.h>
#include <R_ext/Memory.h>

Go to the source code of this file.

Functions

void R_ldl_symbolic (int n, const int Ap[], const int Ai[], int Lp[], int Parent[], const int P[], int Pinv[])
int R_ldl_numeric (int n, const int Ap[], const int Ai[], const double Ax[], const int Lp[], const int Parent[], int Li[], double Lx[], double D[], const int P[], const int Pinv[])
void R_ldl_lsolve (int n, double X[], const int Lp[], const int Li[], const double Lx[])
void R_ldl_dsolve (int n, double X[], const double D[])
void R_ldl_ltsolve (int n, double X[], const int Lp[], const int Li[], const double Lx[])
void R_ldl_perm (int n, double X[], const double B[], const int P[])
void R_ldl_permt (int n, double X[], const double B[], const int P[])
int R_ldl_valid_perm (int n, const int P[])
int R_ldl_valid_matrix (int n, const int Ap[], const int Ai[])


Function Documentation

void R_ldl_dsolve int  n,
double  X[],
const double  D[]
 

solve Dx=b

Parameters:
n L is n-by-n, where n >= 0
X size n. right-hand-side on input, soln. on output
D diagonal elements of size n

void R_ldl_lsolve int  n,
double  X[],
const int  Lp[],
const int  Li[],
const double  Lx[]
 

solve Lx=b

Parameters:
n L is n-by-n, where n >= 0
X size n. right-hand-side on input, soln. on output
Lp column pointer array of size n+1
Li row index array of size lnz=Lp[n]
Lx non-zero off-diagonal elements (size lnz=Lp[n])

void R_ldl_ltsolve int  n,
double  X[],
const int  Lp[],
const int  Li[],
const double  Lx[]
 

solve L'x=b

Parameters:
n L is n-by-n, where n >= 0
X size n. right-hand-side on input, soln. on output
Lp column pointer array of size n+1
Li row index array of size lnz=Lp[n]
Lx non-zero off-diagonal elements (size lnz=Lp[n])

int R_ldl_numeric int  n,
const int  Ap[],
const int  Ai[],
const double  Ax[],
const int  Lp[],
const int  Parent[],
int  Li[],
double  Lx[],
double  D[],
const int  P[],
const int  Pinv[]
 

Given a sparse matrix A (the arguments n, Ap, Ai, and Ax) and its symbolic analysis (Lp and Parent, and optionally P and Pinv), compute the numeric LDL' factorization of A or PAP'. The outputs of this routine are arguments Li, Lx, and D.

Parameters:
n A and L are n-by-n, where n >= 0
Ap column pointer array of size n+1
Ai row index array of size nz=Ap[n] (upper triangle only)
Ax array of non-zero matrix elements of size nz=Ap[n]
Lp column pointer array of size n+1
Parent elimination tree of size n
Li row index array of size lnz=Lp[n]
Lx non-zero off-diagonal elements of L (size lnz=Lp[n])
D vector of diagonal elements (size n)
P optional permutation vector of size n [use (int *) NULL for none]
Pinv optional inverse permutation [use (int *) NULL for none]
Returns:
n if successful, k if D (k,k) is zero

void R_ldl_perm int  n,
double  X[],
const double  B[],
const int  P[]
 

permute a vector, x=Pb

Parameters:
n size of X, B, and P
X output of size n
B input of size n
P input permutation array of size n

void R_ldl_permt int  n,
double  X[],
const double  B[],
const int  P[]
 

permute a vector, x=P'b

Parameters:
n size of X, B, and P
X output of size n
B input of size n
P input permutation array of size n

void R_ldl_symbolic int  n,
const int  Ap[],
const int  Ai[],
int  Lp[],
int  Parent[],
const int  P[],
int  Pinv[]
 

The input to this routine is a sparse matrix A, stored in column form, and an optional permutation P. The output is the elimination tree and the number of nonzeros in each column of L. Parent [i] = k if k is the parent of i in the tree. The Parent array is required by R_ldl_numeric. Lnz [k] gives the number of nonzeros in the kth column of L, excluding the diagonal.

If P is NULL, then it is ignored. The factorization will be LDL' = A. Pinv is not computed. In this case, neither P nor Pinv are required by R_ldl_numeric.

If P is not NULL, then it is assumed to be a valid permutation. If row and column j of A is the kth pivot, the P [k] = j. The factorization will be LDL' = PAP', or A (p,p) in MATLAB notation. The inverse permutation Pinv is computed, where Pinv [j] = k if P [k] = j. In this case, both P and Pinv are required as inputs to R_ldl_numeric.

The floating-point operation count of the subsequent call to R_ldl_numeric is not returned, but could be computed after R_ldl_symbolic is done. It is the sum of (Lnz [k]) * (Lnz [k] + 2) for k = 0 to n-1.

Parameters:
n A and L are n-by-n, where n >= 0
Ap column pointers of size n+1
Ai row indices of size nz=Ap[n]
Lp column pointers of size n+1
Parent elimination tree of size n
P optional permutation vector of size n [use (int *) NULL for none]
Pinv optional inverse permutation [not used if P is NULL]

int R_ldl_valid_matrix int  n,
const int  Ap[],
const int  Ai[]
 

This routine checks to see if a sparse matrix A is valid for input to R_ldl_symbolic and R_ldl_numeric. It returns 1 if the matrix is valid, 0 otherwise. A is in sparse column form. The numerical values in column j are stored in Ax [Ap [j] ... Ap [j+1]-1], with row indices in Ai [Ap [j] ... Ap [j+1]-1]. The Ax array is not checked.

Parameters:
n A is n by n (n >= 0)
Ap column pointer array of size n+1
Ai row index array of size nz=Ap[n]
Returns:
1 if valid sparse matrix, otherwise 0

int R_ldl_valid_perm int  n,
const int  P[]
 

Check if a permutation vector is valid

Parameters:
n size of permutation
P input of size n, a permutation of 0:n-1
Returns:
1 if valid, otherwise 0


Generated on Wed Mar 30 08:43:57 2005 for Matrix by  doxygen 1.4.1