A sparse MPC solver for walking motion generation.
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
AS::matrix_ecL Class Reference

Initializes lower diagonal matrix L and performs backward and forward substitutions using this matrix. More...

#include <as_matrix_ecL.h>

Public Member Functions

 matrix_ecL (const int)
 
 ~matrix_ecL ()
 
void form (const problem_parameters &)
 Builds matrix L. More...
 
void solve_backward (const int, double *) const
 Solve system ecL' * x = b using backward substitution. More...
 
void solve_forward (const int, double *, const int start_ind=0) const
 Solve system ecL * x = b using forward substitution. More...
 

Public Attributes

double * ecL
 
double ** ecL_diag
 
double ** ecL_ndiag
 

Private Member Functions

void chol_dec (double *)
 Performs Cholesky decomposition of 3x3 matrix. More...
 
void form_iQBiPB (const double *, const double *, const double, double *)
 Forms matrix iQBiPB = 0.5 * inv(Q) + 0.5 * B * inv(P) * B. More...
 
void form_iQAT (const double, const double, const double *)
 Forms matrix iQAT = 0.5 * inv (Q) * A'. More...
 
void form_AiQATiQBiPB (const problem_parameters &, const state_parameters &, double *)
 Forms matrix AiQATiQBiPB = A * inv(Q) * A' + 0.5 * inv(Q) + 0.5 * B * inv(P) * B. More...
 
void form_L_non_diag (const double *, double *)
 Forms a 3x3 matrix L(k+1, k), which lies below the diagonal of L. More...
 
void form_L_diag (const double *, double *)
 Forms a 3x3 matrix L(k+1, k+1), which lies on the main diagonal of L. More...
 

Private Attributes

double * iQAT
 

Detailed Description

Initializes lower diagonal matrix L and performs backward and forward substitutions using this matrix.

Definition at line 35 of file as_matrix_ecL.h.

Constructor & Destructor Documentation

◆ matrix_ecL()

AS::matrix_ecL::matrix_ecL ( const int  N)

A constant and well structured 'upper' part of Cholesky factor, which corresponds to equality constraints is

           full L                           |   compressed L
            a                               |
            0   a                           |           a
            b   0   c                   0   |           b   c
            0   b   0   c                   |   ===>        d   e
                    d   0   e               |   ===>            f   g
                    0   d   0   e           |                       ...
                0           f   0   g       |
                            0   f   0   g   |
                                    ....    |

Here a,c,e,g - lower diagonal 3x3 matrices; b,d,f - upper triangular 3x3 matrices. This matrix is reffered as ecL. It is stored as a sequence of vectors of 9 elements:

        0  3  6 
        1  4  7
        2  5  8

        9  12 15  18 21 24
        10 13 16  19 22 25
        11 14 17  20 23 26

                    ...         ...

Definition at line 50 of file as_matrix_ecL.cpp.

◆ ~matrix_ecL()

AS::matrix_ecL::~matrix_ecL ( )

Definition at line 101 of file as_matrix_ecL.cpp.

Member Function Documentation

◆ chol_dec()

void AS::matrix_ecL::chol_dec ( double *  mx9)
private

Performs Cholesky decomposition of 3x3 matrix.

Parameters
[in,out]mx9a pointer to matrix, the result is stored in the same place.
Attention
Only the elements below the main diagonal are initialized.

Definition at line 127 of file as_matrix_ecL.cpp.

◆ form()

void AS::matrix_ecL::form ( const problem_parameters ppar)

Builds matrix L.

Parameters
[in]pparparameters.

Definition at line 291 of file as_matrix_ecL.cpp.

◆ form_AiQATiQBiPB()

void AS::matrix_ecL::form_AiQATiQBiPB ( const problem_parameters ppar,
const state_parameters stp,
double *  result 
)
private

Forms matrix AiQATiQBiPB = A * inv(Q) * A' + 0.5 * inv(Q) + 0.5 * B * inv(P) * B.

Parameters
[in]pparproblem parameters.
[in]stpstate parameters.
[out]resultresult
Attention
Only the elements below the main diagonal are initialized.

Definition at line 202 of file as_matrix_ecL.cpp.

◆ form_iQAT()

void AS::matrix_ecL::form_iQAT ( const double  A3,
const double  A6,
const double *  i2Q 
)
private

Forms matrix iQAT = 0.5 * inv (Q) * A'.

Parameters
[in]A34th and 7th elements of A.
[in]A66th element of A.
[in]i2Qa vector of 3 elements, which contains diagonal elements of 0.5*inv(Q).

Definition at line 181 of file as_matrix_ecL.cpp.

◆ form_iQBiPB()

void AS::matrix_ecL::form_iQBiPB ( const double *  B,
const double *  i2Q,
const double  i2P,
double *  result 
)
private

Forms matrix iQBiPB = 0.5 * inv(Q) + 0.5 * B * inv(P) * B.

Parameters
[in]Ba vector of 3 elements.
[in]i2Qa vector of 3 elements, which contains diagonal elements of 0.5 * inv(Q).
[in]i2P0.5 * inv(P) (only one number)
[out]resultthe result
Attention
Only the elements below the main diagonal are initialized.

Definition at line 158 of file as_matrix_ecL.cpp.

◆ form_L_diag()

void AS::matrix_ecL::form_L_diag ( const double *  ecLp,
double *  ecLc 
)
private

Forms a 3x3 matrix L(k+1, k+1), which lies on the main diagonal of L.

Parameters
[in]ecLpupper triangular matrix matrix lying to the left from ecLc on the same level of L
[in]ecLcthe result is stored here
Attention
Only the elements below the main diagonal are initialized.

Definition at line 268 of file as_matrix_ecL.cpp.

◆ form_L_non_diag()

void AS::matrix_ecL::form_L_non_diag ( const double *  ecLp,
double *  ecLc 
)
private

Forms a 3x3 matrix L(k+1, k), which lies below the diagonal of L.

Parameters
[in]ecLpprevious matrix lying on the diagonal of L
[in]ecLcthe result is stored here

Definition at line 232 of file as_matrix_ecL.cpp.

◆ solve_backward()

void AS::matrix_ecL::solve_backward ( const int  N,
double *  x 
) const

Solve system ecL' * x = b using backward substitution.

Parameters
[in]Nnumber of states in the preview window
[in,out]xvector "b" as input, vector "x" as output.

Definition at line 396 of file as_matrix_ecL.cpp.

◆ solve_forward()

void AS::matrix_ecL::solve_forward ( const int  N,
double *  x,
const int  start_ind = 0 
) const

Solve system ecL * x = b using forward substitution.

Parameters
[in]Nnumber of states in the preview window
[in,out]xvector "b" as input, vector "x" as output (N * SMPC_NUM_STATE_VAR)
[in]start_indan index of a state, from which substitution should start
Note
This function can perform partial forward substitution starting from a given state, and ignoring all preceding states. This is useful when it is known, that all variables in the preceding states are 0.

Definition at line 334 of file as_matrix_ecL.cpp.

Member Data Documentation

◆ ecL

double* AS::matrix_ecL::ecL

Definition at line 47 of file as_matrix_ecL.h.

◆ ecL_diag

double** AS::matrix_ecL::ecL_diag

Definition at line 48 of file as_matrix_ecL.h.

◆ ecL_ndiag

double** AS::matrix_ecL::ecL_ndiag

Definition at line 49 of file as_matrix_ecL.h.

◆ iQAT

double* AS::matrix_ecL::iQAT
private

Definition at line 63 of file as_matrix_ecL.h.


The documentation for this class was generated from the following files: