rsLQR  0.1
nddata.h
Go to the documentation of this file.
1 
13 #pragma once
14 
15 #include "lqr_data.h"
16 #include "matrix.h"
17 
40 typedef struct {
44 } NdFactor;
45 
46 Matrix ndlqr_GetLambdaFactor(NdFactor* factor);
47 Matrix ndlqr_GetStateFactor(NdFactor* factor);
48 Matrix ndlqr_GetInputFactor(NdFactor* factor);
49 
83 typedef struct {
84  // clang-format off
85  int nstates;
86  int ninputs;
87  int nsegments;
88  int depth;
89  int width;
90  double* data;
92  // clang-format on
93 } NdData;
94 
108 NdData* ndlqr_NewNdData(int nstates, int ninputs, int nhorizon, int width);
109 
116 int ndlqr_FreeNdData(NdData* nddata);
117 
138 int ndlqr_GetNdFactor(NdData* nddata, int index, int level, NdFactor** factor);
139 
145 void ndlqr_ResetNdData(NdData* nddata);
146 
NdData::ninputs
int ninputs
number of control inputs
Definition: nddata.h:86
NdData::data
double * data
pointer to entire chunk of allocated memory
Definition: nddata.h:90
NdFactor::input
Matrix input
(m,w) block for the control input variables
Definition: nddata.h:43
ndlqr_GetNdFactor
int ndlqr_GetNdFactor(NdData *nddata, int index, int level, NdFactor **factor)
Retrieve an individual NdFactor out of the NdData.
Definition: nddata.c:82
matrix.h
Matrix type and basic operations.
Matrix
Represents a matrix of double-precision data.
Definition: matrix.h:71
ndlqr_NewNdData
NdData * ndlqr_NewNdData(int nstates, int ninputs, int nhorizon, int width)
Initialize the NdData structure.
Definition: nddata.c:15
ndlqr_FreeNdData
int ndlqr_FreeNdData(NdData *nddata)
Frees the memory allocated in an NdData structure.
Definition: nddata.c:74
NdData::depth
int depth
number of columns of factors to store
Definition: nddata.h:88
ndlqr_ResetNdData
void ndlqr_ResetNdData(NdData *nddata)
Resets all of the memory for an NdData to zero.
Definition: nddata.c:67
NdData::factors
NdFactor * factors
(nsegments, depth) array of factors. Stored in column-order.
Definition: nddata.h:91
NdData
Core storage container for the rsLQR solver.
Definition: nddata.h:83
lqr_data.h
LQRData type.
NdFactor
A chunk of memory for a single time step.
Definition: nddata.h:40
NdData::nsegments
int nsegments
number of segments, or one less than the length of the horizon
Definition: nddata.h:87
NdFactor::lambda
Matrix lambda
(n,w) block for the dual variables
Definition: nddata.h:41
NdFactor::state
Matrix state
(n,w) block for the state variables
Definition: nddata.h:42
NdData::nstates
int nstates
size of state vector
Definition: nddata.h:85
NdData::width
int width
width of each factor. Will be n for matrix data and typically 1 for the right-hand-side vector.
Definition: nddata.h:89