ADOL-C: Automatic Differentiation in C/C++ 2.7.3
Loading...
Searching...
No Matches
Functions
sparsedrivers_c.h File Reference
#include <adolc/sparse/sparsedrivers.h>
#include <cstdlib>
Include dependency graph for sparsedrivers_c.h:

Go to the source code of this file.

Functions

int sparse_jac (short tag, int m, int n, int repeat, const double *x, int *nnz, unsigned int **rind, unsigned int **cind, double **values, int *options)
 Compute and recover a sparse Jacobian using ColPack.
 
int sparse_hess (short tag, int n, int repeat, const double *x, int *nnz, unsigned int **rind, unsigned int **cind, double **values, int *options)
 Compute and recover a sparse Hessian using ColPack.
 
int jac_pat (short tag, int m, int n, const double *x, unsigned int **JP, int *options)
 Compute a Jacobian sparsity pattern.
 
int hess_pat (short tag, int n, const double *x, unsigned int **HP, int *option)
 Compute a scalar function's Hessian sparsity pattern.
 
void generate_seed_jac (int m, int n, unsigned int **JP, double ***S, int *p, int *options)
 Generate a ColPack seed matrix for compressed Jacobian recovery.
 
void generate_seed_hess (int n, unsigned int **HP, double ***S, int *p, int *options)
 Generate a ColPack seed matrix for compressed Hessian recovery.
 

Function Documentation

◆ generate_seed_hess()

void generate_seed_hess ( int  n,
unsigned int **  HP,
double ***  S,
int *  p,
int *  options 
)

Generate a ColPack seed matrix for compressed Hessian recovery.

Parameters
nNumber of independent variables.
HPHessian pattern: n rows, each with a count and column indices.
[out]SSeed matrix with n rows and p columns.
[out]pNumber of seed columns.
optionsTwo entries; entry 1 selects recovery: 0 indirect or 1 direct.
Note
The caller owns the seed. Delete each row with delete[], then delete the row-pointer array with delete[].

◆ generate_seed_jac()

void generate_seed_jac ( int  m,
int  n,
unsigned int **  JP,
double ***  S,
int *  p,
int *  options 
)

Generate a ColPack seed matrix for compressed Jacobian recovery.

Parameters
mNumber of dependent variables.
nNumber of independent variables.
JPJacobian pattern: m rows, each with a count and column indices.
[out]SSeed matrix: n x p for column compression or p x m for row compression.
[out]pCompressed dimension.
optionsOne entry selecting compression: 0 column or 1 row.
Note
The caller owns the seed. Delete each row with delete[], then delete the row-pointer array with delete[].

◆ hess_pat()

int hess_pat ( short  tag,
int  n,
const double *  x,
unsigned int **  HP,
int *  option 
)

Compute a scalar function's Hessian sparsity pattern.

Parameters
tagTape identifier.
nNumber of independent variables (rows and columns).
xEvaluation point, with n entries; may be null in safe modes.
[out]HPArray of n row pointers. Each allocated row starts with its nonzero count, followed by zero-based column indices.
optionOne entry selecting control flow: 0 safe, 1 tight, 2 old safe, or 3 old tight.
Returns
Nonnegative sweep status on success; negative on failure.
Note
Initialize row pointers to null. Release each allocated row with delete[] before reusing the pointer array; this call resets its entries.

◆ jac_pat()

int jac_pat ( short  tag,
int  m,
int  n,
const double *  x,
unsigned int **  JP,
int *  options 
)

Compute a Jacobian sparsity pattern.

Parameters
tagTape identifier.
mNumber of dependent variables (rows).
nNumber of independent variables (columns).
xEvaluation point, with n entries; may be null in safe mode.
[out]JPArray of m row pointers. Each allocated row starts with its nonzero count, followed by zero-based column indices.
optionsThree entries: method (0 index domains, 1 bit patterns), control flow (0 safe, 1 tight), and bit propagation (0 auto, 1 forward, 2 reverse).
Returns
Nonnegative sweep status on success; negative on failure.
Note
Initialize row pointers to null. Release each allocated row with delete[] before reusing the pointer array; this call resets its entries.

◆ sparse_hess()

int sparse_hess ( short  tag,
int  n,
int  repeat,
const double *  x,
int *  nnz,
unsigned int **  rind,
unsigned int **  cind,
double **  values,
int *  options 
)

Compute and recover a sparse Hessian using ColPack.

Parameters
tagTape identifier for a scalar function.
nNumber of independent variables.
repeatZero builds and caches the pattern and seed; nonzero reuses them.
xEvaluation point, with n entries. Required for numeric recovery.
[in,out]nnzNonzero count set on the first call; must match on reuse.
[in,out]rindZero-based row indices.
[in,out]cindZero-based column indices.
[in,out]valuesNonzero values.
optionsTwo entries: control flow (0 safe, 1 tight, 2 old safe, 3 old tight) and recovery (0 indirect, 1 direct).
Returns
Nonnegative sweep status on success; negative on failure.
Precondition
Pointer arguments other than the three buffer values are non-null.
Note
Supply all three buffers with capacity *nnz to reuse them. Otherwise, the routine deletes any supplied buffers and uses ColPack's unmanaged recovery. Release returned buffers with delete[].

◆ sparse_jac()

int sparse_jac ( short  tag,
int  m,
int  n,
int  repeat,
const double *  x,
int *  nnz,
unsigned int **  rind,
unsigned int **  cind,
double **  values,
int *  options 
)

Compute and recover a sparse Jacobian using ColPack.

Parameters
tagTape identifier.
mNumber of dependent variables (rows).
nNumber of independent variables (columns).
repeatZero builds and caches the pattern and seed; nonzero reuses them.
xEvaluation point, with n entries. Required for numeric recovery.
[in,out]nnzRecovered nonzero count. On entry, the count of any supplied buffers; they are reused only if all three are non-null and the count matches.
[in,out]rindZero-based row indices.
[in,out]cindZero-based column indices.
[in,out]valuesNonzero values.
optionsFour entries: method (0 index domains, 1 bit patterns), control flow (0 safe, 1 tight), bit propagation (0 auto, 1 forward, 2 reverse), and compression (0 column, 1 row).
Returns
Nonnegative sweep status on success; negative on failure.
Precondition
nnz, rind, cind, values, and options are non-null.
Note
Set the three buffer pointers to null for allocation. If supplied buffers cannot be reused, the wrapper deletes them and allocates replacements with new[]. Release returned buffers with delete[].