CCL Library  1.0
Data Structures | Functions
ccl_learn_ncl.h File Reference

CCL header file for learning nullspace component. More...

#include <ccl_math.h>
#include <ccl_learn_alpha.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_blas.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_eigen.h>
#include <gsl/gsl_sf.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

Go to the source code of this file.

Data Structures

struct  LEARN_NCL_MODEL
 This structure describes a "LEARN_NCL_MODEL" (a learn ncl model). This structure constains the dimentionality of the defined problems and the model parameters. It should always initialised with ccl_learn_ncl_model_alloc, and destroyed with ccl_learn_ncl_model_free. More...
 
struct  LEARN_MODEL_WS
 This structure describes workspace for directly learning the model parameters using linear regression. More...
 
struct  OBJ_WS
 This structure defines the workspace variables for calculating objective functions. More...
 
struct  SOLVE_NONLIN_WS
 This structure defines the workspace variables for solving the non-linear LM optimization. More...
 

Functions

int ccl_learn_ncl_model_alloc (LEARN_NCL_MODEL *model)
 Allocates the memory for the learn_ncl model. More...
 
int ccl_learn_ncl_model_free (LEARN_NCL_MODEL *model)
 Free the memory for the learn_ncl model. More...
 
void ccl_learn_ncl (const double *X, const double *Y, const int dim_x, const int dim_y, const int dim_n, const int dim_b, LEARN_NCL_MODEL *model)
 Computation routine for learn nullspace component . More...
 
void ccl_learn_model_dir (LEARN_NCL_MODEL *model, const double *BX, const double *Y)
 Computation routine for calculating residual errors. More...
 
int ccl_learn_model_ws_alloc (LEARN_NCL_MODEL *model, LEARN_MODEL_WS *ws)
 Allocates the memory for LEARN_MODEL_WS structure. More...
 
int ccl_learn_model_ws_free (LEARN_MODEL_WS *ws)
 Free the memory for LEARN_MODEL_WS structure. More...
 
void obj_ncl (const LEARN_NCL_MODEL *model, const double *W, const double *BX, const double *Y, double *fun, double *J)
 Computation routine for calculating residual errors. More...
 
void obj_ws_alloc (const LEARN_NCL_MODEL *model, OBJ_WS *ws)
 Allocates the memory for OBJ_WS structure. More...
 
void obj_ws_free (OBJ_WS *ws)
 Free the memory for OBJ_WS structure. More...
 
void ccl_lsqnonlin (const LEARN_NCL_MODEL *model, const double *BX, const double *Y, const OPTION option, SOLVE_NONLIN_WS *lm_ws_param, double *W)
 Computation routine for optimizing non-linear objective functions using LM approach. More...
 
int ccl_solve_nonlin_ws_alloc (const LEARN_NCL_MODEL *model, SOLVE_NONLIN_WS *lm_ws)
 Allocates the memory for SOLVE_NONLIN_WS structure. More...
 
int ccl_solve_nonlin_ws_free (SOLVE_NONLIN_WS *lm_ws)
 Free the memory for SOLVE_NONLIN_WS structure. More...
 
void predict_ncl (const LEARN_NCL_MODEL *model, const double *BX, double *Unp)
 Prediction of nullspace components. More...
 
int ccl_write_ncl_model (char *filename, LEARN_NCL_MODEL *model)
 Write model parameters to .txt file. More...
 

Detailed Description

CCL header file for learning nullspace component.

Function Documentation

void ccl_learn_model_dir ( LEARN_NCL_MODEL model,
const double *  BX,
const double *  Y 
)

Computation routine for calculating residual errors.

Parameters
[in]modelMust be pointer to a valid LEARN_NCL_MODEL structure
[in]BXTransformed state variables, must point to an array of dim_b * dim_n of doubles
[in]Y Observation actions
[out]model Must be pointer to a valid LEARN_NCL_MODEL structure
int ccl_learn_model_ws_alloc ( LEARN_NCL_MODEL model,
LEARN_MODEL_WS ws 
)

Allocates the memory for LEARN_MODEL_WS structure.

Parameters
[in]modelMust point to a valid LEARN_MODEL_WS structure
Returns
  • 1 in case of succes
  • 0 in case of failure (e.g. memory could not be allocated)
int ccl_learn_model_ws_free ( LEARN_MODEL_WS ws)

Free the memory for LEARN_MODEL_WS structure.

Parameters
[in]modelMust point to a valid LEARN_MODEL_WS structure
Returns
  • 1 in case of succes
  • 0 in case of failure (e.g. memory could not be freed)
void ccl_learn_ncl ( const double *  X,
const double *  Y,
const int  dim_x,
const int  dim_y,
const int  dim_n,
const int  dim_b,
LEARN_NCL_MODEL model 
)

Computation routine for learn nullspace component .

Parameters
[in]XInput state variables, must point to an array of dim_x * dim_n doubles
[in]Y Observation actions
[in]dim_x Dimensionality of state inputs
[in]dim_y Dimensionality of action space
[in]dim_y Number of data samples
[in]dim_y Dimensionality of rbf
[out]model Must be pointer to a valid LEARN_NCL_MODEL structure
int ccl_learn_ncl_model_alloc ( LEARN_NCL_MODEL model)

Allocates the memory for the learn_ncl model.

Parameters
[in]modelMust point to a valid LEARN_NCL_MODEL structure
Returns
  • 1 in case of succes
  • 0 in case of failure (e.g. memory could not be allocated)
int ccl_learn_ncl_model_free ( LEARN_NCL_MODEL model)

Free the memory for the learn_ncl model.

Parameters
[in]modelMust point to a valid LEARN_NCL_MODEL structure
Returns
  • 1 in case of succes
  • 0 in case of failure (e.g. memory could not be freed)
void ccl_lsqnonlin ( const LEARN_NCL_MODEL model,
const double *  BX,
const double *  Y,
const OPTION  option,
SOLVE_NONLIN_WS lm_ws_param,
double *  W 
)

Computation routine for optimizing non-linear objective functions using LM approach.

Parameters
[in]modelMust be pointer to a valid LEARN_NCL_MODEL structure.
[in]BXTransformed state variables, must point to an array of dim_b * dim_n of doubles
[in]Y Observation actions
[in]option Options for optimizer
[in]lm_ws_paramMust point to a valid structure of SOLVE_LM_WS for LM optimizer workspace variables
[out]W Returned model parameter, must point to an array of dim_b * dim_x doubles
int ccl_solve_nonlin_ws_alloc ( const LEARN_NCL_MODEL model,
SOLVE_NONLIN_WS lm_ws 
)

Allocates the memory for SOLVE_NONLIN_WS structure.

Parameters
[in]modelMust point to a valid SOLVE_NONLIN_WS structure
Returns
  • 1 in case of succes
  • 0 in case of failure (e.g. memory could not be allocated)
int ccl_solve_nonlin_ws_free ( SOLVE_NONLIN_WS lm_ws)

Free the memory for SOLVE_NONLIN_WS structure.

Parameters
[in]modelMust point to a valid SOLVE_NONLIN_WS structure
Returns
  • 1 in case of succes
  • 0 in case of failure (e.g. memory could not be freed)
int ccl_write_ncl_model ( char *  filename,
LEARN_NCL_MODEL model 
)

Write model parameters to .txt file.

Parameters
[in]filenameFile name
[in]modelMust be pointer to a valid LEARN_NCL_MODEL structure
void obj_ncl ( const LEARN_NCL_MODEL model,
const double *  W,
const double *  BX,
const double *  Y,
double *  fun,
double *  J 
)

Computation routine for calculating residual errors.

Parameters
[in]modelMust be pointer to a valid LEARN_NCL_MODEL structure
[in]WReturned model parameter, must point to an array of dim_b * dim_x doubles
[in]BX Transformed state variables, must point to an array of dim_b * dim_n of doubles
[in]Y Observation actions
[out]fun Returned scalar residual
[out]J Returned Jacobian matrix, must point to an array of dim_n * dim_x doubles
void obj_ws_alloc ( const LEARN_NCL_MODEL model,
OBJ_WS ws 
)

Allocates the memory for OBJ_WS structure.

Parameters
[in]modelMust point to a valid OBJ_WS structure
Returns
  • 1 in case of succes
  • 0 in case of failure (e.g. memory could not be allocated)
void obj_ws_free ( OBJ_WS ws)

Free the memory for OBJ_WS structure.

Parameters
[in]modelMust point to a valid OBJ_WS structure
Returns
  • 1 in case of succes
  • 0 in case of failure (e.g. memory could not be freed)
void predict_ncl ( const LEARN_NCL_MODEL model,
const double *  BX,
double *  Unp 
)

Prediction of nullspace components.

Parameters
[in]modelMust be pointer to a valid LEARN_NCL_MODEL structure
[in]BXHigher dimensionality of the input variable, must point to an array of dim_b * dim_n doubles
[out]Unp Prediction of nullspace component, must point to an array of dim_u * dum_n doubles