parent
ea6f779b3e
commit
6e4c2aa4d2
234 changed files with 44571 additions and 218 deletions
@ -0,0 +1 @@ |
||||
acados/ |
@ -0,0 +1,40 @@ |
||||
#!/usr/bin/bash -e |
||||
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" |
||||
|
||||
ARCHNAME="x86_64" |
||||
BLAS_TARGET="X64_AUTOMATIC" |
||||
if [ -f /TICI ]; then |
||||
ARCHNAME="larch64" |
||||
BLAS_TARGET="ARMV8A_ARM_CORTEX_A57" |
||||
elif [ -f /EON ]; then |
||||
ARCHNAME="aarch64" |
||||
BLAS_TARGET="ARMV8A_ARM_CORTEX_A57" |
||||
fi |
||||
|
||||
if [ ! -d acados/ ]; then |
||||
#git clone https://github.com/acados/acados.git $DIR/acados |
||||
git clone https://github.com/commaai/acados.git $DIR/acados |
||||
fi |
||||
cd acados |
||||
git fetch |
||||
git checkout 9a1bab3f8fc4814a295fbf424fdc8125c63fdd08 |
||||
git submodule update --recursive --init |
||||
|
||||
# build |
||||
mkdir -p build |
||||
cd build |
||||
cmake -DACADOS_WITH_QPOASES=ON -UBLASFEO_TARGET -DBLASFEO_TARGET=$BLAS_TARGET .. |
||||
make -j4 install |
||||
|
||||
INSTALL_DIR="$DIR/$ARCHNAME" |
||||
rm -rf $INSTALL_DIR |
||||
mkdir -p $INSTALL_DIR |
||||
|
||||
rm $DIR/acados/lib/*.json |
||||
|
||||
cp -r $DIR/acados/include $DIR |
||||
cp -r $DIR/acados/lib $INSTALL_DIR |
||||
cp -r $DIR/acados/interfaces/acados_template/acados_template $DIR/../../pyextra |
||||
|
||||
#pip3 install -e $DIR/acados/interfaces/acados_template |
@ -0,0 +1,84 @@ |
||||
/*
|
||||
* Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, |
||||
* Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, |
||||
* Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, |
||||
* Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl |
||||
* |
||||
* This file is part of acados. |
||||
* |
||||
* The 2-Clause BSD License |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* 1. Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, |
||||
* this list of conditions and the following disclaimer in the documentation |
||||
* and/or other materials provided with the distribution. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||||
* POSSIBILITY OF SUCH DAMAGE.; |
||||
*/ |
||||
|
||||
|
||||
#ifndef INTERFACES_ACADOS_C_CONDENSING_INTERFACE_H_ |
||||
#define INTERFACES_ACADOS_C_CONDENSING_INTERFACE_H_ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
#include "acados/ocp_qp/ocp_qp_full_condensing.h" |
||||
#include "acados/ocp_qp/ocp_qp_partial_condensing.h" |
||||
|
||||
typedef enum { |
||||
PARTIAL_CONDENSING, |
||||
FULL_CONDENSING, |
||||
} condensing_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
condensing_t condensing_type; |
||||
} condensing_plan; |
||||
|
||||
typedef struct |
||||
{ |
||||
ocp_qp_xcond_config *config; |
||||
void *dims; |
||||
void *opts; |
||||
void *mem; |
||||
void *work; |
||||
} condensing_module; |
||||
|
||||
ocp_qp_xcond_config *ocp_qp_condensing_config_create(condensing_plan *plan); |
||||
//
|
||||
void *ocp_qp_condensing_opts_create(ocp_qp_xcond_config *config, void *dims_); |
||||
//
|
||||
acados_size_t ocp_qp_condensing_calculate_size(ocp_qp_xcond_config *config, void *dims_, void *opts_); |
||||
//
|
||||
condensing_module *ocp_qp_condensing_assign(ocp_qp_xcond_config *config, void *dims_, |
||||
void *opts_, void *raw_memory); |
||||
//
|
||||
condensing_module *ocp_qp_condensing_create(ocp_qp_xcond_config *config, void *dims_, |
||||
void *opts_); |
||||
//
|
||||
int ocp_qp_condense(condensing_module *module, void *qp_in, void *qp_out); |
||||
//
|
||||
int ocp_qp_expand(condensing_module *module, void *qp_in, void *qp_out); |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif // INTERFACES_ACADOS_C_CONDENSING_INTERFACE_H_
|
@ -0,0 +1,94 @@ |
||||
/*
|
||||
* Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, |
||||
* Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, |
||||
* Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, |
||||
* Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl |
||||
* |
||||
* This file is part of acados. |
||||
* |
||||
* The 2-Clause BSD License |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* 1. Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, |
||||
* this list of conditions and the following disclaimer in the documentation |
||||
* and/or other materials provided with the distribution. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||||
* POSSIBILITY OF SUCH DAMAGE.; |
||||
*/ |
||||
|
||||
|
||||
#ifndef INTERFACES_ACADOS_C_DENSE_QP_INTERFACE_H_ |
||||
#define INTERFACES_ACADOS_C_DENSE_QP_INTERFACE_H_ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
#include "acados/dense_qp/dense_qp_common.h" |
||||
|
||||
typedef enum { DENSE_QP_HPIPM, DENSE_QP_QORE, DENSE_QP_QPOASES, DENSE_QP_OOQP } dense_qp_solver_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
dense_qp_solver_t qp_solver; |
||||
} dense_qp_solver_plan; |
||||
|
||||
typedef struct |
||||
{ |
||||
qp_solver_config *config; |
||||
void *dims; |
||||
void *opts; |
||||
void *mem; |
||||
void *work; |
||||
} dense_qp_solver; |
||||
|
||||
qp_solver_config *dense_qp_config_create(dense_qp_solver_plan *plan); |
||||
//
|
||||
dense_qp_dims *dense_qp_dims_create(); |
||||
//
|
||||
dense_qp_in *dense_qp_in_create(qp_solver_config *config, dense_qp_dims *dims); |
||||
//
|
||||
dense_qp_out *dense_qp_out_create(qp_solver_config *config, dense_qp_dims *dims); |
||||
//
|
||||
void *dense_qp_opts_create(qp_solver_config *config, dense_qp_dims *dims); |
||||
//
|
||||
acados_size_t dense_qp_calculate_size(qp_solver_config *config, dense_qp_dims *dims, void *opts_); |
||||
//
|
||||
dense_qp_solver *dense_qp_assign(qp_solver_config *config, dense_qp_dims *dims, void *opts_, |
||||
void *raw_memory); |
||||
//
|
||||
dense_qp_solver *dense_qp_create(qp_solver_config *config, dense_qp_dims *dims, void *opts_); |
||||
//
|
||||
int dense_qp_solve(dense_qp_solver *solver, dense_qp_in *qp_in, dense_qp_out *qp_out); |
||||
//
|
||||
void dense_qp_inf_norm_residuals(dense_qp_dims *dims, dense_qp_in *qp_in, dense_qp_out *qp_out, |
||||
double *res); |
||||
//
|
||||
bool dense_qp_set_field_double_array(const char *field, double *arr, dense_qp_in *qp_in); |
||||
//
|
||||
bool dense_qp_set_field_int_array(const char *field, int *arr, dense_qp_in *qp_in); |
||||
//
|
||||
bool dense_qp_get_field_double_array(const char *field, dense_qp_in *qp_in, double *arr); |
||||
//
|
||||
bool dense_qp_get_field_int_array(const char *field, dense_qp_in *qp_in, int *arr); |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif // INTERFACES_ACADOS_C_DENSE_QP_INTERFACE_H_
|
@ -0,0 +1,92 @@ |
||||
/*
|
||||
* Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, |
||||
* Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, |
||||
* Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, |
||||
* Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl |
||||
* |
||||
* This file is part of acados. |
||||
* |
||||
* The 2-Clause BSD License |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* 1. Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, |
||||
* this list of conditions and the following disclaimer in the documentation |
||||
* and/or other materials provided with the distribution. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||||
* POSSIBILITY OF SUCH DAMAGE.; |
||||
*/ |
||||
|
||||
|
||||
#ifndef INTERFACES_ACADOS_C_EXTERNAL_FUNCTION_INTERFACE_H_ |
||||
#define INTERFACES_ACADOS_C_EXTERNAL_FUNCTION_INTERFACE_H_ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
#include "acados/utils/external_function_generic.h" |
||||
|
||||
|
||||
|
||||
/************************************************
|
||||
* generic external parametric function |
||||
************************************************/ |
||||
|
||||
//
|
||||
void external_function_param_generic_create(external_function_param_generic *fun, int np); |
||||
//
|
||||
void external_function_param_generic_free(external_function_param_generic *fun); |
||||
|
||||
|
||||
|
||||
/************************************************
|
||||
* casadi external function |
||||
************************************************/ |
||||
|
||||
//
|
||||
void external_function_casadi_create(external_function_casadi *fun); |
||||
//
|
||||
void external_function_casadi_free(external_function_casadi *fun); |
||||
//
|
||||
void external_function_casadi_create_array(int size, external_function_casadi *funs); |
||||
//
|
||||
void external_function_casadi_free_array(int size, external_function_casadi *funs); |
||||
|
||||
|
||||
|
||||
/************************************************
|
||||
* casadi external parametric function |
||||
************************************************/ |
||||
|
||||
//
|
||||
void external_function_param_casadi_create(external_function_param_casadi *fun, int np); |
||||
//
|
||||
void external_function_param_casadi_free(external_function_param_casadi *fun); |
||||
//
|
||||
void external_function_param_casadi_create_array(int size, external_function_param_casadi *funs, |
||||
int np); |
||||
//
|
||||
void external_function_param_casadi_free_array(int size, external_function_param_casadi *funs); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif // INTERFACES_ACADOS_C_EXTERNAL_FUNCTION_INTERFACE_H_
|
@ -0,0 +1,399 @@ |
||||
/*
|
||||
* Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, |
||||
* Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, |
||||
* Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, |
||||
* Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl |
||||
* |
||||
* This file is part of acados. |
||||
* |
||||
* The 2-Clause BSD License |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* 1. Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, |
||||
* this list of conditions and the following disclaimer in the documentation |
||||
* and/or other materials provided with the distribution. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||||
* POSSIBILITY OF SUCH DAMAGE.; |
||||
*/ |
||||
|
||||
|
||||
#ifndef INTERFACES_ACADOS_C_OCP_NLP_INTERFACE_H_ |
||||
#define INTERFACES_ACADOS_C_OCP_NLP_INTERFACE_H_ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
// acados
|
||||
#include "acados/ocp_nlp/ocp_nlp_common.h" |
||||
#include "acados/ocp_nlp/ocp_nlp_constraints_bgh.h" |
||||
#include "acados/sim/sim_erk_integrator.h" |
||||
#include "acados/sim/sim_irk_integrator.h" |
||||
#include "acados/sim/sim_lifted_irk_integrator.h" |
||||
#include "acados/sim/sim_gnsf.h" |
||||
// acados_c
|
||||
#include "acados_c/ocp_qp_interface.h" |
||||
#include "acados_c/sim_interface.h" |
||||
|
||||
|
||||
/// Solution methods for optimal control problems.
|
||||
typedef enum |
||||
{ |
||||
SQP, |
||||
SQP_RTI, |
||||
INVALID_NLP_SOLVER, |
||||
} ocp_nlp_solver_t; |
||||
|
||||
|
||||
/// Types of the cost function.
|
||||
typedef enum |
||||
{ |
||||
LINEAR_LS, |
||||
NONLINEAR_LS, |
||||
EXTERNAL, |
||||
INVALID_COST, |
||||
} ocp_nlp_cost_t; |
||||
|
||||
|
||||
/// Types of the system dynamics, discrete or continuous time.
|
||||
typedef enum |
||||
{ |
||||
CONTINUOUS_MODEL, |
||||
DISCRETE_MODEL, |
||||
INVALID_DYNAMICS, |
||||
} ocp_nlp_dynamics_t; |
||||
|
||||
|
||||
/// Constraint types
|
||||
typedef enum |
||||
{ |
||||
/// Comprises simple bounds, polytopic constraints,
|
||||
/// general non-linear constraints.
|
||||
BGH, |
||||
|
||||
/// Comprises simple bounds, polytopic constraints,
|
||||
/// general non-linear constraints, and positive definite constraints.
|
||||
BGP, |
||||
|
||||
INVALID_CONSTRAINT, |
||||
} ocp_nlp_constraints_t; |
||||
|
||||
|
||||
/// Regularization types
|
||||
typedef enum |
||||
{ |
||||
NO_REGULARIZE, |
||||
MIRROR, |
||||
PROJECT, |
||||
PROJECT_REDUC_HESS, |
||||
CONVEXIFY, |
||||
INVALID_REGULARIZE, |
||||
} ocp_nlp_reg_t; |
||||
|
||||
|
||||
/// Structure to store the configuration of a non-linear program
|
||||
typedef struct ocp_nlp_plan |
||||
{ |
||||
/// QP solver configuration.
|
||||
ocp_qp_solver_plan ocp_qp_solver_plan; |
||||
|
||||
/// Simulation solver configuration for each stage.
|
||||
sim_solver_plan *sim_solver_plan; |
||||
|
||||
/// Nlp solver type.
|
||||
ocp_nlp_solver_t nlp_solver; |
||||
|
||||
/// Regularization type, defaults to no regularization.
|
||||
ocp_nlp_reg_t regularization; |
||||
|
||||
/// Cost type for each stage.
|
||||
ocp_nlp_cost_t *nlp_cost; |
||||
|
||||
/// Dynamics type for each stage.
|
||||
ocp_nlp_dynamics_t *nlp_dynamics; |
||||
|
||||
/// Constraints type for each stage.
|
||||
ocp_nlp_constraints_t *nlp_constraints; |
||||
|
||||
/// Horizon length.
|
||||
int N; |
||||
|
||||
} ocp_nlp_plan; |
||||
|
||||
|
||||
/// Structure to store the state/configuration for the non-linear programming solver
|
||||
typedef struct ocp_nlp_solver |
||||
{ |
||||
ocp_nlp_config *config; |
||||
void *dims; |
||||
void *opts; |
||||
void *mem; |
||||
void *work; |
||||
} ocp_nlp_solver; |
||||
|
||||
|
||||
/// Constructs an empty plan struct (user nlp configuration), all fields are set to a
|
||||
/// default/invalid state.
|
||||
///
|
||||
/// \param N Horizon length
|
||||
ocp_nlp_plan *ocp_nlp_plan_create(int N); |
||||
|
||||
/// Destructor for plan struct, frees memory.
|
||||
///
|
||||
/// \param plan_ The plan struct to destroy.
|
||||
void ocp_nlp_plan_destroy(void* plan_); |
||||
|
||||
|
||||
/// Constructs an nlp configuration struct from a plan.
|
||||
///
|
||||
/// \param plan The plan (user nlp configuration).
|
||||
ocp_nlp_config *ocp_nlp_config_create(ocp_nlp_plan plan); |
||||
|
||||
/// Desctructor of the nlp configuration.
|
||||
///
|
||||
/// \param config_ The configuration struct.
|
||||
void ocp_nlp_config_destroy(void *config_); |
||||
|
||||
|
||||
/// Constructs an struct that contains the dimensions of the variables.
|
||||
///
|
||||
/// \param config_ The configuration struct.
|
||||
ocp_nlp_dims *ocp_nlp_dims_create(void *config_); |
||||
|
||||
/// Destructor of The dimension struct.
|
||||
///
|
||||
/// \param dims_ The dimension struct.
|
||||
void ocp_nlp_dims_destroy(void *dims_); |
||||
|
||||
|
||||
/// Constructs an input struct for a non-linear programs.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
ocp_nlp_in *ocp_nlp_in_create(ocp_nlp_config *config, ocp_nlp_dims *dims); |
||||
|
||||
/// Destructor of the inputs struct.
|
||||
///
|
||||
/// \param in The inputs struct.
|
||||
void ocp_nlp_in_destroy(void *in); |
||||
|
||||
|
||||
/// Sets the sampling times for the given stage.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param in The inputs struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param field Has to be "Ts" (TBC other options).
|
||||
/// \param value The sampling times (floating point).
|
||||
void ocp_nlp_in_set(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_in *in, int stage, |
||||
const char *field, void *value); |
||||
|
||||
|
||||
/// Sets the function pointers to the dynamics functions for the given stage.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param in The inputs struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param fun_type The name of the function type, either impl_ode_fun,
|
||||
/// impl_ode_fun_jac_x_xdot, impl_ode_jac_x_xdot_u (TBC)
|
||||
/// \param fun_ptr Function pointer to the dynamics function.
|
||||
int ocp_nlp_dynamics_model_set(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_in *in, |
||||
int stage, const char *fun_type, void *fun_ptr); |
||||
|
||||
|
||||
/// Sets the function pointers to the cost functions for the given stage.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param in The inputs struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param field The name of the field, either nls_res_jac,
|
||||
/// y_ref, W (others TBC)
|
||||
/// \param value Cost values.
|
||||
int ocp_nlp_cost_model_set(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_in *in, |
||||
int stage, const char *field, void *value); |
||||
|
||||
|
||||
/// Sets the function pointers to the constraints functions for the given stage.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param in The inputs struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param field The name of the field, either lb, ub (others TBC)
|
||||
/// \param value Constraints function or values.
|
||||
int ocp_nlp_constraints_model_set(ocp_nlp_config *config, ocp_nlp_dims *dims, |
||||
ocp_nlp_in *in, int stage, const char *field, void *value); |
||||
|
||||
/* out */ |
||||
|
||||
/// Constructs an output struct for the non-linear program.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
ocp_nlp_out *ocp_nlp_out_create(ocp_nlp_config *config, ocp_nlp_dims *dims); |
||||
|
||||
/// Destructor of the output struct.
|
||||
///
|
||||
/// \param out The output struct.
|
||||
void ocp_nlp_out_destroy(void *out); |
||||
|
||||
|
||||
/// Sets fields in the output struct of an nlp solver, used to initialize the solver.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param out The output struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param field The name of the field, either x, u, pi.
|
||||
/// \param value Initialization values.
|
||||
void ocp_nlp_out_set(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_out *out, |
||||
int stage, const char *field, void *value); |
||||
|
||||
|
||||
/// Gets values of fields in the output struct of an nlp solver.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param out The output struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param field The name of the field, either x, u, z, pi.
|
||||
/// \param value Pointer to the output memory.
|
||||
void ocp_nlp_out_get(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_out *out, |
||||
int stage, const char *field, void *value); |
||||
|
||||
//
|
||||
void ocp_nlp_get_at_stage(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_solver *solver, |
||||
int stage, const char *field, void *value); |
||||
|
||||
// TODO(andrea): remove this once/if the MATLAB interface uses the new setters below?
|
||||
int ocp_nlp_dims_get_from_attr(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_out *out, |
||||
int stage, const char *field); |
||||
|
||||
void ocp_nlp_constraint_dims_get_from_attr(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_out *out, |
||||
int stage, const char *field, int *dims_out); |
||||
|
||||
void ocp_nlp_cost_dims_get_from_attr(ocp_nlp_config *config, ocp_nlp_dims *dims, ocp_nlp_out *out, |
||||
int stage, const char *field, int *dims_out); |
||||
|
||||
|
||||
/* opts */ |
||||
|
||||
/// Creates an options struct for the non-linear program.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
void *ocp_nlp_solver_opts_create(ocp_nlp_config *config, ocp_nlp_dims *dims); |
||||
|
||||
/// Destructor of the options.
|
||||
///
|
||||
/// \param opts The options struct.
|
||||
void ocp_nlp_solver_opts_destroy(void *opts); |
||||
|
||||
/// Sets an option.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param opts_ The options struct.
|
||||
/// \param field Name of the option.
|
||||
/// \param value Value of the option.
|
||||
void ocp_nlp_solver_opts_set(ocp_nlp_config *config, void *opts_, const char *field, void* value); |
||||
|
||||
|
||||
void ocp_nlp_solver_opts_set_at_stage(ocp_nlp_config *config, void *opts_, int stage, const char *field, void* value); |
||||
|
||||
|
||||
/// TBC
|
||||
/// Updates the options.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param opts_ The options struct.
|
||||
void ocp_nlp_solver_opts_update(ocp_nlp_config *config, ocp_nlp_dims *dims, void *opts_); |
||||
|
||||
|
||||
/* solver */ |
||||
|
||||
/// Creates an ocp solver.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param opts_ The options struct.
|
||||
/// \return The solver.
|
||||
ocp_nlp_solver *ocp_nlp_solver_create(ocp_nlp_config *config, ocp_nlp_dims *dims, void *opts_); |
||||
|
||||
/// Destructor of the solver.
|
||||
///
|
||||
/// \param solver The solver struct.
|
||||
void ocp_nlp_solver_destroy(void *solver); |
||||
|
||||
/// Solves the optimal control problem. Call ocp_nlp_precompute before
|
||||
/// calling this functions (TBC).
|
||||
///
|
||||
/// \param solver The solver struct.
|
||||
/// \param nlp_in The inputs struct.
|
||||
/// \param nlp_out The output struct.
|
||||
int ocp_nlp_solve(ocp_nlp_solver *solver, ocp_nlp_in *nlp_in, ocp_nlp_out *nlp_out); |
||||
|
||||
/// Performs precomputations for the solver. Needs to be called before
|
||||
/// ocl_nlp_solve (TBC).
|
||||
///
|
||||
/// \param solver The solver struct.
|
||||
/// \param nlp_in The inputs struct.
|
||||
/// \param nlp_out The output struct.
|
||||
int ocp_nlp_precompute(ocp_nlp_solver *solver, ocp_nlp_in *nlp_in, ocp_nlp_out *nlp_out); |
||||
|
||||
|
||||
/// Computes cost function value.
|
||||
///
|
||||
/// \param solver The solver struct.
|
||||
/// \param nlp_in The inputs struct.
|
||||
/// \param nlp_out The output struct.
|
||||
void ocp_nlp_eval_cost(ocp_nlp_solver *solver, ocp_nlp_in *nlp_in, ocp_nlp_out *nlp_out); |
||||
|
||||
|
||||
//
|
||||
void ocp_nlp_eval_param_sens(ocp_nlp_solver *solver, char *field, int stage, int index, ocp_nlp_out *sens_nlp_out); |
||||
|
||||
/* get */ |
||||
/// \param config The configuration struct.
|
||||
/// \param solver The solver struct.
|
||||
/// \param field Supports "sqp_iter", "status", "nlp_res", "time_tot", ...
|
||||
/// \param return_value_ Pointer to the output memory.
|
||||
void ocp_nlp_get(ocp_nlp_config *config, ocp_nlp_solver *solver, |
||||
const char *field, void *return_value_); |
||||
|
||||
/* set */ |
||||
/// Sets the initial guesses for the integrator for the given stage.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param solver The ocp_nlp_solver struct.
|
||||
/// \param stage Stage number.
|
||||
/// \param field Supports "z_guess", "xdot_guess" (IRK), "phi_guess" (GNSF-IRK)
|
||||
/// \param value The initial guess for the algebraic variables in the integrator (if continuous model is used).
|
||||
void ocp_nlp_set(ocp_nlp_config *config, ocp_nlp_solver *solver, |
||||
int stage, const char *field, void *value); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif // INTERFACES_ACADOS_C_OCP_NLP_INTERFACE_H_
|
@ -0,0 +1,261 @@ |
||||
/*
|
||||
* Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, |
||||
* Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, |
||||
* Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, |
||||
* Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl |
||||
* |
||||
* This file is part of acados. |
||||
* |
||||
* The 2-Clause BSD License |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* 1. Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, |
||||
* this list of conditions and the following disclaimer in the documentation |
||||
* and/or other materials provided with the distribution. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||||
* POSSIBILITY OF SUCH DAMAGE.; |
||||
*/ |
||||
|
||||
|
||||
#ifndef INTERFACES_ACADOS_C_OCP_QP_INTERFACE_H_ |
||||
#define INTERFACES_ACADOS_C_OCP_QP_INTERFACE_H_ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
#include "acados/ocp_qp/ocp_qp_common.h" |
||||
#include "acados/ocp_qp/ocp_qp_xcond_solver.h" |
||||
|
||||
|
||||
/// QP solver types (Enumeration).
|
||||
///
|
||||
/// Full list of fields:
|
||||
/// PARTIAL_CONDENSING_HPIPM
|
||||
/// PARTIAL_CONDENSING_HPMPC
|
||||
/// PARTIAL_CONDENSING_OOQP
|
||||
/// PARTIAL_CONDENSING_OSQP
|
||||
/// PARTIAL_CONDENSING_QPDUNES
|
||||
/// FULL_CONDENSING_HPIPM
|
||||
/// FULL_CONDENSING_QPOASES
|
||||
/// FULL_CONDENSING_QORE
|
||||
/// FULL_CONDENSING_OOQP
|
||||
/// INVALID_QP_SOLVER
|
||||
///
|
||||
/// Note: In this enumeration the partial condensing solvers have to be
|
||||
/// specified before the full condensing solvers.
|
||||
typedef enum { |
||||
PARTIAL_CONDENSING_HPIPM, |
||||
#ifdef ACADOS_WITH_HPMPC |
||||
PARTIAL_CONDENSING_HPMPC, |
||||
#else |
||||
PARTIAL_CONDENSING_HPMPC_NOT_AVAILABLE, |
||||
#endif |
||||
#ifdef ACADOS_WITH_OOQP |
||||
PARTIAL_CONDENSING_OOQP, |
||||
#else |
||||
PARTIAL_CONDENSING_OOQP_NOT_AVAILABLE, |
||||
#endif |
||||
#ifdef ACADOS_WITH_OSQP |
||||
PARTIAL_CONDENSING_OSQP, |
||||
#else |
||||
PARTIAL_CONDENSING_OSQP_NOT_AVAILABLE, |
||||
#endif |
||||
#ifdef ACADOS_WITH_QPDUNES |
||||
PARTIAL_CONDENSING_QPDUNES, |
||||
#else |
||||
PARTIAL_CONDENSING_QPDUNES_NOT_AVAILABLE, |
||||
#endif |
||||
FULL_CONDENSING_HPIPM, |
||||
#ifdef ACADOS_WITH_QPOASES |
||||
FULL_CONDENSING_QPOASES, |
||||
#else |
||||
FULL_CONDENSING_QPOASES_NOT_AVAILABLE, |
||||
#endif |
||||
#ifdef ACADOS_WITH_QORE |
||||
FULL_CONDENSING_QORE, |
||||
#else |
||||
FULL_CONDENSING_QORE_NOT_AVAILABLE, |
||||
#endif |
||||
#ifdef ACADOS_WITH_OOQP |
||||
FULL_CONDENSING_OOQP, |
||||
#else |
||||
FULL_CONDENSING_OOQP_NOT_AVAILABLE, |
||||
#endif |
||||
INVALID_QP_SOLVER, |
||||
} ocp_qp_solver_t; |
||||
|
||||
|
||||
/// Struct containing qp solver
|
||||
typedef struct |
||||
{ |
||||
ocp_qp_solver_t qp_solver; |
||||
} ocp_qp_solver_plan; |
||||
|
||||
|
||||
/// Linear ocp configuration.
|
||||
typedef struct |
||||
{ |
||||
ocp_qp_xcond_solver_config *config; |
||||
ocp_qp_xcond_solver_dims *dims; |
||||
void *opts; |
||||
void *mem; |
||||
void *work; |
||||
} ocp_qp_solver; |
||||
|
||||
|
||||
/// Initializes the qp solver configuration.
|
||||
/// TBC should this be private/static - no, used in ocp_nlp
|
||||
void ocp_qp_xcond_solver_config_initialize_from_plan( |
||||
ocp_qp_solver_t solver_name, ocp_qp_xcond_solver_config *solver_config); |
||||
|
||||
/// Constructs a qp solver config and Initializes with default values.
|
||||
///
|
||||
/// \param plan The qp solver plan struct.
|
||||
ocp_qp_xcond_solver_config *ocp_qp_xcond_solver_config_create(ocp_qp_solver_plan plan); |
||||
|
||||
/// Destructor for config struct, frees memory.
|
||||
///
|
||||
/// \param config The config object to destroy.
|
||||
void ocp_qp_xcond_solver_config_free(ocp_qp_xcond_solver_config *config); |
||||
|
||||
|
||||
/// Constructs a struct that contains the dimensions for the variables of the qp.
|
||||
///
|
||||
/// \param N The number of variables.
|
||||
ocp_qp_dims *ocp_qp_dims_create(int N); |
||||
|
||||
/// Destructor of The dimension struct.
|
||||
///
|
||||
/// \param dims The dimension struct.
|
||||
void ocp_qp_dims_free(void *dims); |
||||
|
||||
//
|
||||
ocp_qp_xcond_solver_dims *ocp_qp_xcond_solver_dims_create(ocp_qp_xcond_solver_config *config, int N); |
||||
//
|
||||
ocp_qp_xcond_solver_dims *ocp_qp_xcond_solver_dims_create_from_ocp_qp_dims( |
||||
ocp_qp_xcond_solver_config *config, ocp_qp_dims *dims); |
||||
//
|
||||
void ocp_qp_xcond_solver_dims_free(ocp_qp_xcond_solver_dims *dims_); |
||||
|
||||
void ocp_qp_xcond_solver_dims_set(void *config_, ocp_qp_xcond_solver_dims *dims, |
||||
int stage, const char *field, int* value); |
||||
|
||||
|
||||
/// Constructs an input object for the qp.
|
||||
///
|
||||
/// \param dims The dimension struct.
|
||||
ocp_qp_in *ocp_qp_in_create(ocp_qp_dims *dims); |
||||
|
||||
|
||||
void ocp_qp_in_set(ocp_qp_xcond_solver_config *config, ocp_qp_in *in, |
||||
int stage, char *field, void *value); |
||||
|
||||
/// Destructor of the inputs struct.
|
||||
///
|
||||
/// \param in_ The inputs struct.
|
||||
void ocp_qp_in_free(void *in_); |
||||
|
||||
|
||||
/// Constructs an outputs object for the qp.
|
||||
///
|
||||
/// \param dims The dimension struct.
|
||||
ocp_qp_out *ocp_qp_out_create(ocp_qp_dims *dims); |
||||
|
||||
/// Destructor of the output struct.
|
||||
///
|
||||
/// \param out_ The output struct.
|
||||
void ocp_qp_out_free(void *out_); |
||||
|
||||
|
||||
/// Getter of output struct
|
||||
void ocp_qp_out_get(ocp_qp_out *out, const char *field, void *value); |
||||
|
||||
|
||||
/// Constructs an options object for the qp.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
void *ocp_qp_xcond_solver_opts_create(ocp_qp_xcond_solver_config *config, |
||||
ocp_qp_xcond_solver_dims *dims); |
||||
|
||||
/// Destructor of the options struct.
|
||||
///
|
||||
/// \param opts The options struct to destroy.
|
||||
void ocp_qp_xcond_solver_opts_free(ocp_qp_xcond_solver_opts *opts); |
||||
|
||||
|
||||
/// Setter of the options struct.
|
||||
///
|
||||
/// \param opts The options struct.
|
||||
void ocp_qp_xcond_solver_opts_set(ocp_qp_xcond_solver_config *config, |
||||
ocp_qp_xcond_solver_opts *opts, const char *field, void* value); |
||||
|
||||
/// TBC Should be private/static?
|
||||
acados_size_t ocp_qp_calculate_size(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_dims *dims, void *opts_); |
||||
|
||||
|
||||
/// TBC Reserves memory? TBC Should this be private?
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param opts_ The options struct.
|
||||
/// \param raw_memory Pointer to raw memory to assign to qp solver.
|
||||
ocp_qp_solver *ocp_qp_assign(ocp_qp_xcond_solver_config *config, ocp_qp_xcond_solver_dims *dims, |
||||
void *opts_, void *raw_memory); |
||||
|
||||
/// Creates a qp solver. Reserves memory.
|
||||
///
|
||||
/// \param config The configuration struct.
|
||||
/// \param dims The dimension struct.
|
||||
/// \param opts_ The options struct.
|
||||
ocp_qp_solver *ocp_qp_create(ocp_qp_xcond_solver_config *config, |
||||
ocp_qp_xcond_solver_dims *dims, void *opts_); |
||||
|
||||
|
||||
/// Destroys a qp solver. Frees memory.
|
||||
///
|
||||
/// \param solver The qp solver
|
||||
void ocp_qp_solver_destroy(ocp_qp_solver *solver); |
||||
|
||||
void ocp_qp_x_cond_solver_free(ocp_qp_xcond_solver_config *config, |
||||
ocp_qp_xcond_solver_dims *dims, void *opts_); |
||||
|
||||
|
||||
/// Solves the qp.
|
||||
///
|
||||
/// \param solver The solver.
|
||||
/// \param qp_in The inputs struct.
|
||||
/// \param qp_out The output struct.
|
||||
int ocp_qp_solve(ocp_qp_solver *solver, ocp_qp_in *qp_in, ocp_qp_out *qp_out); |
||||
|
||||
|
||||
/// Calculates the infinity norm of the residuals.
|
||||
///
|
||||
/// \param dims The dimension struct.
|
||||
/// \param qp_in The inputs struct.
|
||||
/// \param qp_out The output struct.
|
||||
/// \param res Output array for the residuals.
|
||||
void ocp_qp_inf_norm_residuals(ocp_qp_dims *dims, ocp_qp_in *qp_in, ocp_qp_out *qp_out, |
||||
double *res); |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif // INTERFACES_ACADOS_C_OCP_QP_INTERFACE_H_
|
@ -0,0 +1,140 @@ |
||||
/*
|
||||
* Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, |
||||
* Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, |
||||
* Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, |
||||
* Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Diehl |
||||
* |
||||
* This file is part of acados. |
||||
* |
||||
* The 2-Clause BSD License |
||||
* |
||||
* Redistribution and use in source and binary forms, with or without |
||||
* modification, are permitted provided that the following conditions are met: |
||||
* |
||||
* 1. Redistributions of source code must retain the above copyright notice, |
||||
* this list of conditions and the following disclaimer. |
||||
* |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, |
||||
* this list of conditions and the following disclaimer in the documentation |
||||
* and/or other materials provided with the distribution. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||||
* POSSIBILITY OF SUCH DAMAGE.; |
||||
*/ |
||||
|
||||
|
||||
#ifndef INTERFACES_ACADOS_C_SIM_INTERFACE_H_ |
||||
#define INTERFACES_ACADOS_C_SIM_INTERFACE_H_ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
#include "acados/sim/sim_common.h" |
||||
|
||||
|
||||
|
||||
typedef enum |
||||
{ |
||||
ERK, |
||||
IRK, |
||||
GNSF, |
||||
LIFTED_IRK, |
||||
INVALID_SIM_SOLVER, |
||||
} sim_solver_t; |
||||
|
||||
|
||||
|
||||
typedef struct |
||||
{ |
||||
sim_solver_t sim_solver; |
||||
} sim_solver_plan; |
||||
|
||||
|
||||
|
||||
typedef struct |
||||
{ |
||||
sim_config *config; |
||||
void *dims; |
||||
void *opts; |
||||
void *mem; |
||||
void *work; |
||||
} sim_solver; |
||||
|
||||
|
||||
|
||||
/* config */ |
||||
//
|
||||
sim_config *sim_config_create(sim_solver_plan plan); |
||||
//
|
||||
void sim_config_destroy(void *config); |
||||
|
||||
/* dims */ |
||||
//
|
||||
void *sim_dims_create(void *config_); |
||||
//
|
||||
void sim_dims_destroy(void *dims); |
||||
//
|
||||
void sim_dims_set(sim_config *config, void *dims, const char *field, const int* value); |
||||
//
|
||||
void sim_dims_get(sim_config *config, void *dims, const char *field, int* value); |
||||
//
|
||||
void sim_dims_get_from_attr(sim_config *config, void *dims, const char *field, int *dims_out); |
||||
|
||||
/* in */ |
||||
//
|
||||
sim_in *sim_in_create(sim_config *config, void *dims); |
||||
//
|
||||
void sim_in_destroy(void *out); |
||||
//
|
||||
int sim_in_set(void *config_, void *dims_, sim_in *in, const char *field, void *value); |
||||
|
||||
|
||||
/* out */ |
||||
//
|
||||
sim_out *sim_out_create(sim_config *config, void *dims); |
||||
//
|
||||
void sim_out_destroy(void *out); |
||||
//
|
||||
int sim_out_get(void *config, void *dims, sim_out *out, const char *field, void *value); |
||||
|
||||
/* opts */ |
||||
//
|
||||
void *sim_opts_create(sim_config *config, void *dims); |
||||
//
|
||||
void sim_opts_destroy(void *opts); |
||||
//
|
||||
void sim_opts_set(sim_config *config, void *opts, const char *field, void *value); |
||||
//
|
||||
void sim_opts_get(sim_config *config, void *opts, const char *field, void *value); |
||||
|
||||
/* solver */ |
||||
//
|
||||
acados_size_t sim_calculate_size(sim_config *config, void *dims, void *opts_); |
||||
//
|
||||
sim_solver *sim_assign(sim_config *config, void *dims, void *opts_, void *raw_memory); |
||||
//
|
||||
sim_solver *sim_solver_create(sim_config *config, void *dims, void *opts_); |
||||
//
|
||||
void sim_solver_destroy(void *solver); |
||||
//
|
||||
int sim_solve(sim_solver *solver, sim_in *in, sim_out *out); |
||||
//
|
||||
int sim_precompute(sim_solver *solver, sim_in *in, sim_out *out); |
||||
//
|
||||
int sim_solver_set(sim_solver *solver, const char *field, void *value); |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif // INTERFACES_ACADOS_C_SIM_INTERFACE_H_
|
@ -0,0 +1,52 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#include "blasfeo_processor_features.h" |
||||
#include "blasfeo_target.h" |
||||
#include "blasfeo_block_size.h" |
||||
#include "blasfeo_stdlib.h" |
||||
#include "blasfeo_common.h" |
||||
#include "blasfeo_d_aux.h" |
||||
#include "blasfeo_d_aux_ext_dep.h" |
||||
#include "blasfeo_d_kernel.h" |
||||
#include "blasfeo_d_blas.h" |
||||
#include "blasfeo_s_aux.h" |
||||
#include "blasfeo_s_aux_ext_dep.h" |
||||
#include "blasfeo_s_kernel.h" |
||||
#include "blasfeo_s_blas.h" |
||||
#include "blasfeo_i_aux_ext_dep.h" |
||||
#include "blasfeo_v_aux_ext_dep.h" |
||||
#include "blasfeo_timing.h" |
||||
#include "blasfeo_memory.h" |
@ -0,0 +1,371 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_BLOCK_SIZE_H_ |
||||
#define BLASFEO_BLOCK_SIZE_H_ |
||||
|
||||
|
||||
|
||||
#define D_EL_SIZE 8 // double precision
|
||||
#define S_EL_SIZE 4 // single precision
|
||||
|
||||
|
||||
|
||||
#if defined( TARGET_X64_INTEL_HASWELL ) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 // data cache size: 64 bytes
|
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 kB, 8-way
|
||||
#define L2_CACHE_SIZE (256*1024) // L2 data cache size: 256 kB ; DTLB1 64*4 kB = 256 kB
|
||||
#define LLC_CACHE_SIZE (6*1024*1024) // LLC cache size: 6 MB ; TLB 1024*4 kB = 4 MB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 12 // max kernel size
|
||||
#define D_KC 256 // 192
|
||||
#define D_NC 72 //96 //72 // 120 // 512
|
||||
#define D_MC 1500 // 6000
|
||||
// single
|
||||
#define S_PS 8 // panel size
|
||||
#define S_PLD 4 // 2 // GCD of panel length
|
||||
#define S_M_KERNEL 24 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 144 |
||||
#define S_MC 3000 |
||||
|
||||
#elif defined( TARGET_X64_INTEL_SANDY_BRIDGE ) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 // data cache size: 64 bytes
|
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 kB, 8-way
|
||||
#define L2_CACHE_SIZE (256*1024) // L2 data cache size: 256 kB ; DTLB1 64*4 kB = 256 kB
|
||||
#define LLC_CACHE_SIZE (4*1024*1024) // LLC cache size: 4 MB ; TLB 1024*4 kB = 4 MB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 8 // max kernel size
|
||||
#define D_KC 256 //320 //256 //320
|
||||
#define D_NC 72 //64 //72 //60 // 120
|
||||
#define D_MC 1000 // 800
|
||||
// single
|
||||
#define S_PS 8 // panel size
|
||||
#define S_PLD 4 // 2 // GCD of panel length
|
||||
#define S_M_KERNEL 16 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 144 |
||||
#define S_MC 2000 |
||||
|
||||
#elif defined( TARGET_X64_INTEL_CORE ) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 |
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 kB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 4 // max kernel size
|
||||
#define D_KC 256 |
||||
#define D_NC 128 // TODO these are just dummy
|
||||
#define D_MC 3000 // TODO these are just dummy
|
||||
// single
|
||||
#define S_PS 4 |
||||
#define S_PLD 4 //2
|
||||
#define S_M_KERNEL 4 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 128 // TODO these are just dummy
|
||||
#define S_MC 3000 // TODO these are just dummy
|
||||
|
||||
#elif defined( TARGET_X64_AMD_BULLDOZER ) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 |
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 kB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 4 // max kernel size
|
||||
#define D_KC 256 |
||||
#define D_NC 128 // TODO these are just dummy
|
||||
#define D_MC 3000 // TODO these are just dummy
|
||||
// single
|
||||
#define S_PS 4 |
||||
#define S_PLD 4 //2
|
||||
#define S_M_KERNEL 4 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 128 // TODO these are just dummy
|
||||
#define S_MC 3000 // TODO these are just dummy
|
||||
|
||||
|
||||
#elif defined( TARGET_X86_AMD_JAGUAR ) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 |
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 kB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 4 // max kernel size
|
||||
#define D_KC 256 |
||||
#define D_NC 128 // TODO these are just dummy
|
||||
#define D_MC 3000 // TODO these are just dummy
|
||||
// single
|
||||
#define S_PS 4 |
||||
#define S_PLD 4 //2
|
||||
#define S_M_KERNEL 4 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 128 // TODO these are just dummy
|
||||
#define S_MC 3000 // TODO these are just dummy
|
||||
|
||||
|
||||
#elif defined( TARGET_X86_AMD_BARCELONA ) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 |
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 kB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 4 // max kernel size
|
||||
#define D_KC 256 |
||||
#define D_NC 128 // TODO these are just dummy
|
||||
#define D_MC 3000 // TODO these are just dummy
|
||||
// single
|
||||
#define S_PS 4 |
||||
#define S_PLD 4 //2
|
||||
#define S_M_KERNEL 4 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 128 // TODO these are just dummy
|
||||
#define S_MC 3000 // TODO these are just dummy
|
||||
|
||||
|
||||
#elif defined(TARGET_ARMV8A_ARM_CORTEX_A76) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 |
||||
#define L1_CACHE_SIZE (64*1024) // L1 data cache size: 64 kB, 4-way ; DTLB1 48*4 kB = 192 kB
|
||||
#define LLC_CACHE_SIZE (1*1024*1024) // LLC cache size: 1 MB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 8 // max kernel size
|
||||
#define D_KC 512 //256
|
||||
#define D_NC 128 //256
|
||||
#define D_MC 6000 |
||||
// single
|
||||
#define S_PS 4 |
||||
#define S_PLD 4 //2
|
||||
#define S_M_KERNEL 8 // max kernel size
|
||||
#define S_KC 512 |
||||
#define S_NC 256 |
||||
#define S_MC 6000 |
||||
|
||||
|
||||
#elif defined(TARGET_ARMV8A_ARM_CORTEX_A73) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 |
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 (64?) kB, 4-way, seen as 8-(16-)way ; DTLB1 48*4 kB = 192 kB
|
||||
#define LLC_CACHE_SIZE (1*1024*1024) // LLC cache size: 1 MB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 8 // max kernel size
|
||||
#define D_KC 320 |
||||
#define D_NC 256 |
||||
#define D_MC 6000 |
||||
// single
|
||||
#define S_PS 4 |
||||
#define S_PLD 4 //2
|
||||
#define S_M_KERNEL 8 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 128 // TODO these are just dummy
|
||||
#define S_MC 3000 // TODO these are just dummy
|
||||
|
||||
|
||||
#elif defined(TARGET_ARMV8A_ARM_CORTEX_A57) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 |
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 kB, 2-way ; DTLB1 32*4 kB = 128 kB
|
||||
#define LLC_CACHE_SIZE (1*1024*1024) // LLC cache size: 1 MB // 2 MB ???
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 8 // max kernel size
|
||||
#define D_KC 224 //256 //192
|
||||
#define D_NC 40 //36 //48
|
||||
#define D_MC 512 //488 //600
|
||||
// single
|
||||
#define S_PS 4 |
||||
#define S_PLD 4 //2
|
||||
#define S_M_KERNEL 8 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 128 // TODO these are just dummy
|
||||
#define S_MC 3000 // TODO these are just dummy
|
||||
|
||||
|
||||
#elif defined(TARGET_ARMV8A_ARM_CORTEX_A55) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 |
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 kB, 4-way ; DTLB1 16*4 kB = 64 kB
|
||||
#define LLC_CACHE_SIZE (512*1024) // LLC cache size: 512 kB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 12 // max kernel size
|
||||
#define D_KC 224 |
||||
#define D_NC 160 |
||||
#define D_MC 6000 |
||||
// single
|
||||
#define S_PS 4 |
||||
#define S_PLD 4 //2
|
||||
#define S_M_KERNEL 8 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 128 // TODO these are just dummy
|
||||
#define S_MC 3000 // TODO these are just dummy
|
||||
|
||||
|
||||
#elif defined(TARGET_ARMV8A_ARM_CORTEX_A53) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 |
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 kB, 4-way ??? ; DTLB1 10*4 kB = 40 kB
|
||||
#define LLC_CACHE_SIZE (256*1024) // LLC cache size: 256 kB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 12 // max kernel size
|
||||
#define D_KC 160 |
||||
#define D_NC 128 |
||||
#define D_MC 6000 |
||||
// single
|
||||
#define S_PS 4 |
||||
#define S_PLD 4 //2
|
||||
#define S_M_KERNEL 8 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 128 // TODO these are just dummy
|
||||
#define S_MC 3000 // TODO these are just dummy
|
||||
|
||||
|
||||
#elif defined( TARGET_ARMV7A_ARM_CORTEX_A15 ) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 |
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 kB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 4 // max kernel size
|
||||
#define D_KC 256 |
||||
#define D_NC 128 // TODO these are just dummy
|
||||
#define D_MC 3000 // TODO these are just dummy
|
||||
// single
|
||||
#define S_PS 4 |
||||
#define S_PLD 4 //2
|
||||
#define S_M_KERNEL 4 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 128 // TODO these are just dummy
|
||||
#define S_MC 3000 // TODO these are just dummy
|
||||
|
||||
|
||||
#elif defined( TARGET_ARMV7A_ARM_CORTEX_A7 ) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 |
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 kB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 4 // max kernel size
|
||||
#define D_KC 256 |
||||
#define D_NC 128 // TODO these are just dummy
|
||||
#define D_MC 3000 // TODO these are just dummy
|
||||
// single
|
||||
#define S_PS 4 |
||||
#define S_PLD 4 //2
|
||||
#define S_M_KERNEL 4 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 128 // TODO these are just dummy
|
||||
#define S_MC 3000 // TODO these are just dummy
|
||||
|
||||
|
||||
#elif defined( TARGET_ARMV7A_ARM_CORTEX_A9 ) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 32 |
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 kB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 4 // max kernel size
|
||||
#define D_KC 256 |
||||
#define D_NC 128 // TODO these are just dummy
|
||||
#define D_MC 3000 // TODO these are just dummy
|
||||
// single
|
||||
#define S_PS 4 |
||||
#define S_PLD 4 //2
|
||||
#define S_M_KERNEL 4 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 128 // TODO these are just dummy
|
||||
#define S_MC 3000 // TODO these are just dummy
|
||||
|
||||
|
||||
#elif defined( TARGET_GENERIC ) |
||||
// common
|
||||
#define CACHE_LINE_SIZE 64 |
||||
#define L1_CACHE_SIZE (32*1024) // L1 data cache size: 32 kB
|
||||
// double
|
||||
#define D_PS 4 // panel size
|
||||
#define D_PLD 4 // 2 // GCD of panel length
|
||||
#define D_M_KERNEL 4 // max kernel size
|
||||
#define D_KC 256 |
||||
#define D_NC 128 // TODO these are just dummy
|
||||
#define D_MC 3000 // TODO these are just dummy
|
||||
|
||||
// single
|
||||
#define S_PS 4 |
||||
#define S_PLD 4 //2
|
||||
#define S_M_KERNEL 4 // max kernel size
|
||||
#define S_KC 256 |
||||
#define S_NC 128 // TODO these are just dummy
|
||||
#define S_MC 3000 // TODO these are just dummy
|
||||
|
||||
|
||||
#else |
||||
#error "Unknown architecture" |
||||
#endif |
||||
|
||||
|
||||
|
||||
#define D_CACHE_LINE_EL (CACHE_LINE_SIZE/D_EL_SIZE) |
||||
#define D_L1_CACHE_EL (L1_CACHE_SIZE/D_EL_SIZE) |
||||
#define D_L2_CACHE_EL (L2_CACHE_SIZE/D_EL_SIZE) |
||||
#define D_LLC_CACHE_EL (LLC_CACHE_SIZE/D_EL_SIZE) |
||||
|
||||
#define S_CACHE_LINE_EL (CACHE_LINE_SIZE/S_EL_SIZE) |
||||
#define S_L1_CACHE_EL (L1_CACHE_SIZE/S_EL_SIZE) |
||||
#define S_L2_CACHE_EL (L2_CACHE_SIZE/S_EL_SIZE) |
||||
#define S_LLC_CACHE_EL (LLC_CACHE_SIZE/S_EL_SIZE) |
||||
|
||||
|
||||
|
||||
#endif // BLASFEO_BLOCK_SIZE_H_
|
@ -0,0 +1,236 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_COMMON_H_ |
||||
#define BLASFEO_COMMON_H_ |
||||
|
||||
|
||||
|
||||
#include "blasfeo_target.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__INTEL_LLVM_COMPILER) |
||||
#define ALIGNED(VEC, BYTES) VEC __attribute__ ((aligned ( BYTES ))) |
||||
#elif defined (_MSC_VER) |
||||
#define ALIGNED(VEC, BYTES) __declspec(align( BYTES )) VEC |
||||
#else |
||||
#define ALIGNED(VEC, BYTES) VEC |
||||
#endif |
||||
|
||||
|
||||
|
||||
|
||||
#if ( defined(LA_HIGH_PERFORMANCE) & defined(MF_PANELMAJ) ) | ( defined(LA_REFERENCE) & defined(MF_PANELMAJ) ) |
||||
|
||||
#include "blasfeo_block_size.h" |
||||
|
||||
// matrix structure
|
||||
struct blasfeo_dmat |
||||
{ |
||||
double *mem; // pointer to passed chunk of memory
|
||||
double *pA; // pointer to a pm*pn array of doubles, the first is aligned to cache line size
|
||||
double *dA; // pointer to a min(m,n) (or max???) array of doubles
|
||||
int m; // rows
|
||||
int n; // cols
|
||||
int pm; // packed number or rows
|
||||
int cn; // packed number or cols
|
||||
int use_dA; // flag to tell if dA can be used
|
||||
int memsize; // size of needed memory
|
||||
}; |
||||
|
||||
struct blasfeo_smat |
||||
{ |
||||
float *mem; // pointer to passed chunk of memory
|
||||
float *pA; // pointer to a pm*pn array of floats, the first is aligned to cache line size
|
||||
float *dA; // pointer to a min(m,n) (or max???) array of floats
|
||||
int m; // rows
|
||||
int n; // cols
|
||||
int pm; // packed number or rows
|
||||
int cn; // packed number or cols
|
||||
int use_dA; // flag to tell if dA can be used
|
||||
int memsize; // size of needed memory
|
||||
}; |
||||
|
||||
// vector structure
|
||||
struct blasfeo_dvec |
||||
{ |
||||
double *mem; // pointer to passed chunk of memory
|
||||
double *pa; // pointer to a pm array of doubles, the first is aligned to cache line size
|
||||
int m; // size
|
||||
int pm; // packed size
|
||||
int memsize; // size of needed memory
|
||||
}; |
||||
|
||||
struct blasfeo_svec |
||||
{ |
||||
float *mem; // pointer to passed chunk of memory
|
||||
float *pa; // pointer to a pm array of floats, the first is aligned to cache line size
|
||||
int m; // size
|
||||
int pm; // packed size
|
||||
int memsize; // size of needed memory
|
||||
}; |
||||
|
||||
#define BLASFEO_DMATEL(sA,ai,aj) ((sA)->pA[((ai)-((ai)&(D_PS-1)))*(sA)->cn+(aj)*D_PS+((ai)&(D_PS-1))]) |
||||
#define BLASFEO_SMATEL(sA,ai,aj) ((sA)->pA[((ai)-((ai)&(S_PS-1)))*(sA)->cn+(aj)*S_PS+((ai)&(S_PS-1))]) |
||||
#define BLASFEO_DVECEL(sa,ai) ((sa)->pa[ai]) |
||||
#define BLASFEO_SVECEL(sa,ai) ((sa)->pa[ai]) |
||||
|
||||
#elif ( defined(LA_HIGH_PERFORMANCE) & defined(MF_COLMAJ) ) | ( defined(LA_REFERENCE) & defined(MF_COLMAJ) ) | defined(LA_EXTERNAL_BLAS_WRAPPER) |
||||
|
||||
// matrix structure
|
||||
struct blasfeo_dmat |
||||
{ |
||||
double *mem; // pointer to passed chunk of memory
|
||||
double *pA; // pointer to a m*n array of doubles
|
||||
double *dA; // pointer to a min(m,n) (or max???) array of doubles
|
||||
int m; // rows
|
||||
int n; // cols
|
||||
int use_dA; // flag to tell if dA can be used
|
||||
int memsize; // size of needed memory
|
||||
}; |
||||
|
||||
struct blasfeo_smat |
||||
{ |
||||
float *mem; // pointer to passed chunk of memory
|
||||
float *pA; // pointer to a m*n array of floats
|
||||
float *dA; // pointer to a min(m,n) (or max???) array of floats
|
||||
int m; // rows
|
||||
int n; // cols
|
||||
int use_dA; // flag to tell if dA can be used
|
||||
int memsize; // size of needed memory
|
||||
}; |
||||
|
||||
// vector structure
|
||||
struct blasfeo_dvec |
||||
{ |
||||
double *mem; // pointer to passed chunk of memory
|
||||
double *pa; // pointer to a m array of doubles, the first is aligned to cache line size
|
||||
int m; // size
|
||||
int memsize; // size of needed memory
|
||||
}; |
||||
|
||||
struct blasfeo_svec |
||||
{ |
||||
float *mem; // pointer to passed chunk of memory
|
||||
float *pa; // pointer to a m array of floats, the first is aligned to cache line size
|
||||
int m; // size
|
||||
int memsize; // size of needed memory
|
||||
}; |
||||
|
||||
#define BLASFEO_DMATEL(sA,ai,aj) ((sA)->pA[(ai)+(aj)*(sA)->m]) |
||||
#define BLASFEO_SMATEL(sA,ai,aj) ((sA)->pA[(ai)+(aj)*(sA)->m]) |
||||
#define BLASFEO_DVECEL(sa,ai) ((sa)->pa[ai]) |
||||
#define BLASFEO_SVECEL(sa,ai) ((sa)->pa[ai]) |
||||
|
||||
#else |
||||
|
||||
#error : wrong LA or MF choice |
||||
|
||||
#endif |
||||
|
||||
|
||||
|
||||
// Explicitly panel-major matrix structure
|
||||
struct blasfeo_pm_dmat |
||||
{ |
||||
double *mem; // pointer to passed chunk of memory
|
||||
double *pA; // pointer to a pm*pn array of doubles, the first is aligned to cache line size
|
||||
double *dA; // pointer to a min(m,n) (or max???) array of doubles
|
||||
int m; // rows
|
||||
int n; // cols
|
||||
int pm; // packed number or rows
|
||||
int cn; // packed number or cols
|
||||
int use_dA; // flag to tell if dA can be used
|
||||
int ps; // panel size
|
||||
int memsize; // size of needed memory
|
||||
}; |
||||
|
||||
struct blasfeo_pm_smat |
||||
{ |
||||
float *mem; // pointer to passed chunk of memory
|
||||
float *pA; // pointer to a pm*pn array of floats, the first is aligned to cache line size
|
||||
float *dA; // pointer to a min(m,n) (or max???) array of floats
|
||||
int m; // rows
|
||||
int n; // cols
|
||||
int pm; // packed number or rows
|
||||
int cn; // packed number or cols
|
||||
int use_dA; // flag to tell if dA can be used
|
||||
int ps; // panel size
|
||||
int memsize; // size of needed memory
|
||||
}; |
||||
|
||||
// Explicitly column-major matrix structure
|
||||
struct blasfeo_cm_dmat |
||||
{ |
||||
double *mem; // pointer to passed chunk of memory
|
||||
double *pA; // pointer to a m*n array of doubles
|
||||
double *dA; // pointer to a min(m,n) (or max???) array of doubles
|
||||
int m; // rows
|
||||
int n; // cols
|
||||
int use_dA; // flag to tell if dA can be used
|
||||
int memsize; // size of needed memory
|
||||
}; |
||||
|
||||
struct blasfeo_cm_smat |
||||
{ |
||||
float *mem; // pointer to passed chunk of memory
|
||||
float *pA; // pointer to a m*n array of floats
|
||||
float *dA; // pointer to a min(m,n) (or max???) array of floats
|
||||
int m; // rows
|
||||
int n; // cols
|
||||
int use_dA; // flag to tell if dA can be used
|
||||
int memsize; // size of needed memory
|
||||
}; |
||||
|
||||
|
||||
#define BLASFEO_PM_DMATEL(sA,ai,aj) ((sA)->pA[((ai)-((ai)&((sA)->ps-1)))*(sA)->cn+(aj)*((sA)->ps)+((ai)&((sA)->ps-1))]) |
||||
#define BLASFEO_PM_SMATEL(sA,ai,aj) ((sA)->pA[((ai)-((ai)&((sA)->ps-1)))*(sA)->cn+(aj)*((sA)->ps)+((ai)&((sA)->ps-1))]) |
||||
#define BLASFEO_CM_DMATEL(sA,ai,aj) ((sA)->pA[(ai)+(aj)*(sA)->m]) |
||||
#define BLASFEO_CM_SMATEL(sA,ai,aj) ((sA)->pA[(ai)+(aj)*(sA)->m]) |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_COMMON_H_
|
@ -0,0 +1,239 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
/*
|
||||
* auxiliary algebra operations header |
||||
* |
||||
* include/blasfeo_aux_lib*.h |
||||
* |
||||
*/ |
||||
|
||||
#ifndef BLASFEO_D_AUX_H_ |
||||
#define BLASFEO_D_AUX_H_ |
||||
|
||||
|
||||
|
||||
#include <stdlib.h> |
||||
|
||||
#include "blasfeo_common.h" |
||||
#include "blasfeo_d_aux_old.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
// --- memory size calculations
|
||||
//
|
||||
// returns the memory size (in bytes) needed for a dmat
|
||||
size_t blasfeo_memsize_dmat(int m, int n); |
||||
// returns the memory size (in bytes) needed for the diagonal of a dmat
|
||||
size_t blasfeo_memsize_diag_dmat(int m, int n); |
||||
// returns the memory size (in bytes) needed for a dvec
|
||||
size_t blasfeo_memsize_dvec(int m); |
||||
|
||||
// --- creation
|
||||
//
|
||||
// create a strmat for a matrix of size m*n by using memory passed by a pointer (pointer is not updated)
|
||||
void blasfeo_create_dmat(int m, int n, struct blasfeo_dmat *sA, void *memory); |
||||
// create a strvec for a vector of size m by using memory passed by a pointer (pointer is not updated)
|
||||
void blasfeo_create_dvec(int m, struct blasfeo_dvec *sA, void *memory); |
||||
|
||||
// --- packing
|
||||
// pack the column-major matrix A into the matrix struct B
|
||||
void blasfeo_pack_dmat(int m, int n, double *A, int lda, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// pack the lower-triangular column-major matrix A into the matrix struct B
|
||||
void blasfeo_pack_l_dmat(int m, int n, double *A, int lda, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// pack the upper-triangular column-major matrix A into the matrix struct B
|
||||
void blasfeo_pack_u_dmat(int m, int n, double *A, int lda, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// transpose and pack the column-major matrix A into the matrix struct B
|
||||
void blasfeo_pack_tran_dmat(int m, int n, double *A, int lda, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// pack the vector x into the vector structure y
|
||||
void blasfeo_pack_dvec(int m, double *x, int xi, struct blasfeo_dvec *sy, int yi); |
||||
// unpack the matrix structure A into the column-major matrix B
|
||||
void blasfeo_unpack_dmat(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, double *B, int ldb); |
||||
// transpose and unpack the matrix structure A into the column-major matrix B
|
||||
void blasfeo_unpack_tran_dmat(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, double *B, int ldb); |
||||
// pack the vector structure x into the vector y
|
||||
void blasfeo_unpack_dvec(int m, struct blasfeo_dvec *sx, int xi, double *y, int yi); |
||||
|
||||
// --- cast
|
||||
//
|
||||
//void d_cast_mat2strmat(double *A, struct blasfeo_dmat *sA); // TODO
|
||||
//void d_cast_diag_mat2strmat(double *dA, struct blasfeo_dmat *sA); // TODO
|
||||
//void d_cast_vec2vecmat(double *a, struct blasfeo_dvec *sx); // TODO
|
||||
|
||||
|
||||
// ge
|
||||
// --- insert/extract
|
||||
//
|
||||
// sA[ai, aj] <= a
|
||||
void blasfeo_dgein1(double a, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// <= sA[ai, aj]
|
||||
double blasfeo_dgeex1(struct blasfeo_dmat *sA, int ai, int aj); |
||||
|
||||
// --- set
|
||||
// A <= alpha
|
||||
void blasfeo_dgese(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj); |
||||
|
||||
// --- copy / scale
|
||||
// B <= A
|
||||
void blasfeo_dgecp(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// A <= alpha*A
|
||||
void blasfeo_dgesc(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// B <= alpha*A
|
||||
void blasfeo_dgecpsc(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// B <= A, A lower triangular
|
||||
void blasfeo_dtrcp_l(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
void blasfeo_dtrcpsc_l(int m, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
void blasfeo_dtrsc_l(int m, double alpha, struct blasfeo_dmat *sA, int ai, int aj); |
||||
|
||||
// --- sum
|
||||
// B <= B + alpha*A
|
||||
void blasfeo_dgead(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// y <= y + alpha*x
|
||||
void blasfeo_dvecad(int m, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi); |
||||
|
||||
// --- traspositions
|
||||
// B <= A'
|
||||
void blasfeo_dgetr(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// B <= A', A lower triangular
|
||||
void blasfeo_dtrtr_l(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// B <= A', A upper triangular
|
||||
void blasfeo_dtrtr_u(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
|
||||
// dia
|
||||
// diag(A) += alpha
|
||||
void blasfeo_ddiare(int kmax, double alpha, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// diag(A) <= alpha*x
|
||||
void blasfeo_ddiain(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// diag(A)[idx] <= alpha*x
|
||||
void blasfeo_ddiain_sp(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dmat *sD, int di, int dj); |
||||
// x <= diag(A)
|
||||
void blasfeo_ddiaex(int kmax, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi); |
||||
// x <= diag(A)[idx]
|
||||
void blasfeo_ddiaex_sp(int kmax, double alpha, int *idx, struct blasfeo_dmat *sD, int di, int dj, struct blasfeo_dvec *sx, int xi); |
||||
// diag(A) += alpha*x
|
||||
void blasfeo_ddiaad(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// diag(A)[idx] += alpha*x
|
||||
void blasfeo_ddiaad_sp(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dmat *sD, int di, int dj); |
||||
// diag(A)[idx] = y + alpha*x
|
||||
void blasfeo_ddiaadin_sp(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi, int *idx, struct blasfeo_dmat *sD, int di, int dj); |
||||
|
||||
// row
|
||||
void blasfeo_drowin(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void blasfeo_drowex(int kmax, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi); |
||||
void blasfeo_drowad(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void blasfeo_drowad_sp(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dmat *sD, int di, int dj); |
||||
void blasfeo_drowsw(int kmax, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sC, int ci, int cj); |
||||
void blasfeo_drowpe(int kmax, int *ipiv, struct blasfeo_dmat *sA); |
||||
void blasfeo_drowpei(int kmax, int *ipiv, struct blasfeo_dmat *sA); |
||||
|
||||
// col
|
||||
void blasfeo_dcolex(int kmax, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi); |
||||
void blasfeo_dcolin(int kmax, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void blasfeo_dcolad(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void blasfeo_dcolsc(int kmax, double alpha, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void blasfeo_dcolsw(int kmax, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sC, int ci, int cj); |
||||
void blasfeo_dcolpe(int kmax, int *ipiv, struct blasfeo_dmat *sA); |
||||
void blasfeo_dcolpei(int kmax, int *ipiv, struct blasfeo_dmat *sA); |
||||
|
||||
// vec
|
||||
// a <= alpha
|
||||
void blasfeo_dvecse(int m, double alpha, struct blasfeo_dvec *sx, int xi); |
||||
// sx[xi] <= a
|
||||
void blasfeo_dvecin1(double a, struct blasfeo_dvec *sx, int xi); |
||||
// <= sx[xi]
|
||||
double blasfeo_dvecex1(struct blasfeo_dvec *sx, int xi); |
||||
// y <= x
|
||||
void blasfeo_dveccp(int m, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi); |
||||
// x <= alpha*x
|
||||
void blasfeo_dvecsc(int m, double alpha, struct blasfeo_dvec *sx, int xi); |
||||
// y <= alpha*x
|
||||
void blasfeo_dveccpsc(int m, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi); |
||||
void blasfeo_dvecad_sp(int m, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dvec *sz, int zi); |
||||
void blasfeo_dvecin_sp(int m, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dvec *sz, int zi); |
||||
void blasfeo_dvecex_sp(int m, double alpha, int *idx, struct blasfeo_dvec *sx, int x, struct blasfeo_dvec *sz, int zi); |
||||
|
||||
void blasfeo_dveccl(int m, |
||||
struct blasfeo_dvec *sxm, int xim, struct blasfeo_dvec *sx, int xi, |
||||
struct blasfeo_dvec *sxp, int xip, struct blasfeo_dvec *sz, int zi); |
||||
|
||||
void blasfeo_dveccl_mask(int m, |
||||
struct blasfeo_dvec *sxm, int xim, struct blasfeo_dvec *sx, int xi, |
||||
struct blasfeo_dvec *sxp, int xip, struct blasfeo_dvec *sz, int zi, |
||||
struct blasfeo_dvec *sm, int mi); |
||||
|
||||
void blasfeo_dvecze(int m, struct blasfeo_dvec *sm, int mi, struct blasfeo_dvec *sv, int vi, struct blasfeo_dvec *se, int ei); |
||||
void blasfeo_dvecnrm_inf(int m, struct blasfeo_dvec *sx, int xi, double *ptr_norm); |
||||
void blasfeo_dvecnrm_2(int m, struct blasfeo_dvec *sx, int xi, double *ptr_norm); |
||||
void blasfeo_dvecpe(int kmax, int *ipiv, struct blasfeo_dvec *sx, int xi); |
||||
void blasfeo_dvecpei(int kmax, int *ipiv, struct blasfeo_dvec *sx, int xi); |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Explicitly panel-major matrix format |
||||
*/ |
||||
|
||||
// returns the memory size (in bytes) needed for a dmat
|
||||
size_t blasfeo_pm_memsize_dmat(int ps, int m, int n); |
||||
// create a strmat for a matrix of size m*n by using memory passed by a pointer (pointer is not updated)
|
||||
void blasfeo_pm_create_dmat(int ps, int m, int n, struct blasfeo_pm_dmat *sA, void *memory); |
||||
// print
|
||||
void blasfeo_pm_print_dmat(int m, int n, struct blasfeo_pm_dmat *sA, int ai, int aj); |
||||
|
||||
|
||||
|
||||
/*
|
||||
* Explicitly panel-major matrix format |
||||
*/ |
||||
|
||||
// returns the memory size (in bytes) needed for a dmat
|
||||
size_t blasfeo_cm_memsize_dmat(int m, int n); |
||||
// create a strmat for a matrix of size m*n by using memory passed by a pointer (pointer is not updated)
|
||||
void blasfeo_cm_create_dmat(int m, int n, struct blasfeo_pm_dmat *sA, void *memory); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_D_AUX_H_
|
@ -0,0 +1,145 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
/*
|
||||
* auxiliary algebra operation external dependancies header |
||||
* |
||||
* include/blasfeo_d_aux_ext_dep.h |
||||
* |
||||
* - dynamic memory allocation |
||||
* - print |
||||
* |
||||
*/ |
||||
|
||||
#ifndef BLASFEO_D_AUX_EXT_DEP_H_ |
||||
#define BLASFEO_D_AUX_EXT_DEP_H_ |
||||
|
||||
|
||||
|
||||
#include <stdio.h> |
||||
|
||||
|
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
#ifdef EXT_DEP |
||||
|
||||
/* column-major matrices */ |
||||
|
||||
// dynamically allocate row*col doubles of memory and set accordingly a pointer to double; set allocated memory to zero
|
||||
void d_zeros(double **pA, int row, int col); |
||||
// dynamically allocate row*col doubles of memory aligned to 64-byte boundaries and set accordingly a pointer to double; set allocated memory to zero
|
||||
void d_zeros_align(double **pA, int row, int col); |
||||
// dynamically allocate size bytes of memory aligned to 64-byte boundaries and set accordingly a pointer to double; set allocated memory to zero
|
||||
void d_zeros_align_bytes(double **pA, int size); |
||||
// free the memory allocated by d_zeros
|
||||
void d_free(double *pA); |
||||
// free the memory allocated by d_zeros_align or d_zeros_align_bytes
|
||||
void d_free_align(double *pA); |
||||
// print a column-major matrix
|
||||
void d_print_mat(int m, int n, double *A, int lda); |
||||
// print the transposed of a column-major matrix
|
||||
void d_print_tran_mat(int row, int col, double *A, int lda); |
||||
// print to file a column-major matrix
|
||||
void d_print_to_file_mat(FILE *file, int row, int col, double *A, int lda); |
||||
// print to file a column-major matrix in exponential format
|
||||
void d_print_to_file_exp_mat(FILE *file, int row, int col, double *A, int lda); |
||||
// print to string a column-major matrix
|
||||
void d_print_to_string_mat(char **buf_out, int row, int col, double *A, int lda); |
||||
// print to file the transposed of a column-major matrix
|
||||
void d_print_tran_to_file_mat(FILE *file, int row, int col, double *A, int lda); |
||||
// print to file the transposed of a column-major matrix in exponential format
|
||||
void d_print_tran_to_file_exp_mat(FILE *file, int row, int col, double *A, int lda); |
||||
// print in exponential notation a column-major matrix
|
||||
void d_print_exp_mat(int m, int n, double *A, int lda); |
||||
// print in exponential notation the transposed of a column-major matrix
|
||||
void d_print_exp_tran_mat(int row, int col, double *A, int lda); |
||||
|
||||
/* strmat and strvec */ |
||||
|
||||
// create a strmat for a matrix of size m*n by dynamically allocating memory
|
||||
void blasfeo_allocate_dmat(int m, int n, struct blasfeo_dmat *sA); |
||||
// create a strvec for a vector of size m by dynamically allocating memory
|
||||
void blasfeo_allocate_dvec(int m, struct blasfeo_dvec *sa); |
||||
// free the memory allocated by blasfeo_allocate_dmat
|
||||
void blasfeo_free_dmat(struct blasfeo_dmat *sA); |
||||
// free the memory allocated by blasfeo_allocate_dvec
|
||||
void blasfeo_free_dvec(struct blasfeo_dvec *sa); |
||||
// print a strmat
|
||||
void blasfeo_print_dmat(int m, int n, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// print in exponential notation a strmat
|
||||
void blasfeo_print_exp_dmat(int m, int n, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// print to file a strmat
|
||||
void blasfeo_print_to_file_dmat(FILE *file, int m, int n, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// print to file a strmat in exponential format
|
||||
void blasfeo_print_to_file_exp_dmat(FILE *file, int m, int n, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// print to string a strmat
|
||||
void blasfeo_print_to_string_dmat(char **buf_out, int m, int n, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// print the transposed of a strmat
|
||||
void blasfeo_print_tran_dmat(int m, int n, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// print a strvec
|
||||
void blasfeo_print_dvec(int m, struct blasfeo_dvec *sa, int ai); |
||||
// print in exponential notation a strvec
|
||||
void blasfeo_print_exp_dvec(int m, struct blasfeo_dvec *sa, int ai); |
||||
// print to file a strvec
|
||||
void blasfeo_print_to_file_dvec(FILE *file, int m, struct blasfeo_dvec *sa, int ai); |
||||
// print to string a strvec
|
||||
void blasfeo_print_to_string_dvec(char **buf_out, int m, struct blasfeo_dvec *sa, int ai); |
||||
// print the transposed of a strvec
|
||||
void blasfeo_print_tran_dvec(int m, struct blasfeo_dvec *sa, int ai); |
||||
// print in exponential notation the transposed of a strvec
|
||||
void blasfeo_print_exp_tran_dvec(int m, struct blasfeo_dvec *sa, int ai); |
||||
// print to file the transposed of a strvec
|
||||
void blasfeo_print_to_file_tran_dvec(FILE *file, int m, struct blasfeo_dvec *sa, int ai); |
||||
// print to string the transposed of a strvec
|
||||
void blasfeo_print_to_string_tran_dvec(char **buf_out, int m, struct blasfeo_dvec *sa, int ai); |
||||
|
||||
#endif // EXT_DEP
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_D_AUX_EXT_DEP_H_
|
@ -0,0 +1,84 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
/*
|
||||
* auxiliary algebra operation external dependancies header |
||||
* |
||||
* include/blasfeo_d_aux_ext_dep.h |
||||
* |
||||
* - dynamic memory allocation |
||||
* - print |
||||
* |
||||
*/ |
||||
|
||||
#ifndef BLASFEO_D_AUX_EXT_DEP_REF_H_ |
||||
#define BLASFEO_D_AUX_EXT_DEP_REF_H_ |
||||
|
||||
|
||||
#include <stdio.h> |
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
// expose reference BLASFEO for testing
|
||||
// see blasfeo_d_aux_exp_dep.h for help
|
||||
|
||||
void blasfeo_print_dmat_ref(int m, int n, struct blasfeo_dmat_ref *sA, int ai, int aj); |
||||
void blasfeo_allocate_dmat_ref(int m, int n, struct blasfeo_dmat_ref *sA); |
||||
void blasfeo_allocate_dvec_ref(int m, struct blasfeo_dvec_ref *sa); |
||||
void blasfeo_free_dmat_ref(struct blasfeo_dmat_ref *sA); |
||||
void blasfeo_free_dvec_ref(struct blasfeo_dvec_ref *sa); |
||||
void blasfeo_print_dmat_ref(int m, int n, struct blasfeo_dmat_ref *sA, int ai, int aj); |
||||
void blasfeo_print_exp_dmat_ref(int m, int n, struct blasfeo_dmat_ref *sA, int ai, int aj); |
||||
void blasfeo_print_to_file_dmat_ref(FILE *file, int m, int n, struct blasfeo_dmat_ref *sA, int ai, int aj); |
||||
void blasfeo_print_to_file_exp_dmat_ref(FILE *file, int m, int n, struct blasfeo_dmat_ref *sA, int ai, int aj); |
||||
void blasfeo_print_to_string_dmat_ref(char **buf_out, int m, int n, struct blasfeo_dmat_ref *sA, int ai, int aj); |
||||
void blasfeo_print_dvec(int m, struct blasfeo_dvec *sa, int ai); |
||||
void blasfeo_print_exp_dvec(int m, struct blasfeo_dvec *sa, int ai); |
||||
void blasfeo_print_to_file_dvec(FILE *file, int m, struct blasfeo_dvec *sa, int ai); |
||||
void blasfeo_print_to_string_dvec(char **buf_out, int m, struct blasfeo_dvec *sa, int ai); |
||||
void blasfeo_print_tran_dvec(int m, struct blasfeo_dvec *sa, int ai); |
||||
void blasfeo_print_exp_tran_dvec(int m, struct blasfeo_dvec *sa, int ai); |
||||
void blasfeo_print_to_file_tran_dvec(FILE *file, int m, struct blasfeo_dvec *sa, int ai); |
||||
void blasfeo_print_to_string_tran_dvec(char **buf_out, int m, struct blasfeo_dvec *sa, int ai); |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_D_AUX_EXT_DEP_REF_H_
|
@ -0,0 +1,75 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
/*
|
||||
* ----------- TOMOVE |
||||
* |
||||
* expecting column major matrices |
||||
* |
||||
*/ |
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
|
||||
void dtrcp_l_lib(int m, double alpha, int offsetA, double *A, int sda, int offsetB, double *B, int sdb); |
||||
void dgead_lib(int m, int n, double alpha, int offsetA, double *A, int sda, int offsetB, double *B, int sdb); |
||||
// TODO remove ???
|
||||
void ddiain_sqrt_lib(int kmax, double *x, int offset, double *pD, int sdd); |
||||
// TODO ddiaad1
|
||||
void ddiareg_lib(int kmax, double reg, int offset, double *pD, int sdd); |
||||
|
||||
|
||||
void dgetr_lib(int m, int n, double alpha, int offsetA, double *pA, int sda, int offsetC, double *pC, int sdc); |
||||
void dtrtr_l_lib(int m, double alpha, int offsetA, double *pA, int sda, int offsetC, double *pC, int sdc); |
||||
void dtrtr_u_lib(int m, double alpha, int offsetA, double *pA, int sda, int offsetC, double *pC, int sdc); |
||||
void ddiaex_lib(int kmax, double alpha, int offset, double *pD, int sdd, double *x); |
||||
void ddiaad_lib(int kmax, double alpha, double *x, int offset, double *pD, int sdd); |
||||
void ddiain_libsp(int kmax, int *idx, double alpha, double *x, double *pD, int sdd); |
||||
void ddiaex_libsp(int kmax, int *idx, double alpha, double *pD, int sdd, double *x); |
||||
void ddiaad_libsp(int kmax, int *idx, double alpha, double *x, double *pD, int sdd); |
||||
void ddiaadin_libsp(int kmax, int *idx, double alpha, double *x, double *y, double *pD, int sdd); |
||||
void drowin_lib(int kmax, double alpha, double *x, double *pD); |
||||
void drowex_lib(int kmax, double alpha, double *pD, double *x); |
||||
void drowad_lib(int kmax, double alpha, double *x, double *pD); |
||||
void drowin_libsp(int kmax, double alpha, int *idx, double *x, double *pD); |
||||
void drowad_libsp(int kmax, int *idx, double alpha, double *x, double *pD); |
||||
void drowadin_libsp(int kmax, int *idx, double alpha, double *x, double *y, double *pD); |
||||
void dcolin_lib(int kmax, double *x, int offset, double *pD, int sdd); |
||||
void dcolad_lib(int kmax, double alpha, double *x, int offset, double *pD, int sdd); |
||||
void dcolin_libsp(int kmax, int *idx, double *x, double *pD, int sdd); |
||||
void dcolad_libsp(int kmax, double alpha, int *idx, double *x, double *pD, int sdd); |
||||
void dcolsw_lib(int kmax, int offsetA, double *pA, int sda, int offsetC, double *pC, int sdc); |
||||
void dvecin_libsp(int kmax, int *idx, double *x, double *y); |
||||
void dvecad_libsp(int kmax, int *idx, double alpha, double *x, double *y); |
@ -0,0 +1,206 @@ |
||||
|
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_D_AUX_REF_H_ |
||||
#define BLASFEO_D_AUX_REF_H_ |
||||
|
||||
|
||||
|
||||
#include <stdlib.h> |
||||
|
||||
#include "blasfeo_common.h" |
||||
#include "blasfeo_d_aux_old.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
// --- memory calculations
|
||||
//
|
||||
// returns the memory size (in bytes) needed for a dmat
|
||||
size_t blasfeo_ref_memsize_dmat(int m, int n); |
||||
// returns the memory size (in bytes) needed for the diagonal of a dmat
|
||||
size_t blasfeo_ref_memsize_diag_dmat(int m, int n); |
||||
// returns the memory size (in bytes) needed for a dvec
|
||||
size_t blasfeo_ref_memsize_dvec(int m); |
||||
|
||||
// --- creation
|
||||
//
|
||||
// create a strmat for a matrix of size m*n by using memory passed by a pointer (pointer is not updated)
|
||||
void blasfeo_ref_create_dmat(int m, int n, struct blasfeo_dmat *sA, void *memory); |
||||
// create a strvec for a vector of size m by using memory passed by a pointer (pointer is not updated)
|
||||
void blasfeo_ref_create_dvec(int m, struct blasfeo_dvec *sA, void *memory); |
||||
|
||||
// --- packing
|
||||
// pack the column-major matrix A into the matrix struct B
|
||||
void blasfeo_ref_pack_dmat(int m, int n, double *A, int lda, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// pack the lower-triangular column-major matrix A into the matrix struct B
|
||||
void blasfeo_ref_pack_l_dmat(int m, int n, double *A, int lda, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// pack the upper-triangular column-major matrix A into the matrix struct B
|
||||
void blasfeo_ref_pack_u_dmat(int m, int n, double *A, int lda, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// transpose and pack the column-major matrix A into the matrix struct B
|
||||
void blasfeo_ref_pack_tran_dmat(int m, int n, double *A, int lda, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// pack the vector x into the vector structure y
|
||||
void blasfeo_ref_pack_dvec(int m, double *x, int xi, struct blasfeo_dvec *sy, int yi); |
||||
// unpack the matrix structure A into the column-major matrix B
|
||||
void blasfeo_ref_unpack_dmat(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, double *B, int ldb); |
||||
// transpose and unpack the matrix structure A into the column-major matrix B
|
||||
void blasfeo_ref_unpack_tran_dmat(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, double *B, int ldb); |
||||
// pack the vector structure x into the vector y
|
||||
void blasfeo_ref_unpack_dvec(int m, struct blasfeo_dvec *sx, int xi, double *y, int yi); |
||||
|
||||
// --- cast
|
||||
//
|
||||
void ref_d_cast_mat2strmat(double *A, struct blasfeo_dmat *sA); // TODO
|
||||
void ref_d_cast_diag_mat2strmat(double *dA, struct blasfeo_dmat *sA); // TODO
|
||||
void ref_d_cast_vec2vecmat(double *a, struct blasfeo_dvec *sx); // TODO
|
||||
|
||||
|
||||
// ge
|
||||
// --- insert/extract
|
||||
//
|
||||
// sA[ai, aj] <= a
|
||||
void blasfeo_ref_dgein1(double a, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// <= sA[ai, aj]
|
||||
double blasfeo_ref_dgeex1(struct blasfeo_dmat *sA, int ai, int aj); |
||||
|
||||
// --- set
|
||||
// A <= alpha
|
||||
void blasfeo_ref_dgese(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj); |
||||
|
||||
// --- copy / scale
|
||||
// B <= A
|
||||
void blasfeo_ref_dgecp(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// A <= alpha*A
|
||||
void blasfeo_ref_dgesc(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// B <= alpha*A
|
||||
void blasfeo_ref_dgecpsc(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// B <= A, A lower triangular
|
||||
void blasfeo_ref_dtrcp_l(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
void blasfeo_ref_dtrcpsc_l(int m, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
void blasfeo_ref_dtrsc_l(int m, double alpha, struct blasfeo_dmat *sA, int ai, int aj); |
||||
|
||||
// --- sum
|
||||
// B <= B + alpha*A
|
||||
void blasfeo_ref_dgead(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sC, int yi, int cj); |
||||
// y <= y + alpha*x
|
||||
void blasfeo_ref_dvecad(int m, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi); |
||||
|
||||
// --- traspositions
|
||||
// B <= A'
|
||||
void blasfeo_ref_dgetr(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// B <= A', A lower triangular
|
||||
void blasfeo_ref_dtrtr_l(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
// B <= A', A upper triangular
|
||||
void blasfeo_ref_dtrtr_u(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj); |
||||
|
||||
// dia
|
||||
// diag(A) += alpha
|
||||
void blasfeo_ref_ddiare(int kmax, double alpha, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// diag(A) <= alpha*x
|
||||
void blasfeo_ref_ddiain(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// diag(A)[idx] <= alpha*x
|
||||
void blasfeo_ref_ddiain_sp(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dmat *sD, int di, int dj); |
||||
// x <= diag(A)
|
||||
void blasfeo_ref_ddiaex(int kmax, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi); |
||||
// x <= diag(A)[idx]
|
||||
void blasfeo_ref_ddiaex_sp(int kmax, double alpha, int *idx, struct blasfeo_dmat *sD, int di, int dj, struct blasfeo_dvec *sx, int xi); |
||||
// diag(A) += alpha*x
|
||||
void blasfeo_ref_ddiaad(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj); |
||||
// diag(A)[idx] += alpha*x
|
||||
void blasfeo_ref_ddiaad_sp(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dmat *sD, int di, int dj); |
||||
// diag(A)[idx] = y + alpha*x
|
||||
void blasfeo_ref_ddiaadin_sp(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi, int *idx, struct blasfeo_dmat *sD, int di, int dj); |
||||
|
||||
// row
|
||||
void blasfeo_ref_drowin(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void blasfeo_ref_drowex(int kmax, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi); |
||||
void blasfeo_ref_drowad(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void blasfeo_ref_drowad_sp(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dmat *sD, int di, int dj); |
||||
void blasfeo_ref_drowsw(int kmax, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sC, int ci, int cj); |
||||
void blasfeo_ref_drowpe(int kmax, int *ipiv, struct blasfeo_dmat *sA); |
||||
void blasfeo_ref_drowpei(int kmax, int *ipiv, struct blasfeo_dmat *sA); |
||||
|
||||
// col
|
||||
void blasfeo_ref_dcolex(int kmax, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi); |
||||
void blasfeo_ref_dcolin(int kmax, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void blasfeo_ref_dcolad(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void blasfeo_ref_dcolsc(int kmax, double alpha, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void blasfeo_ref_dcolsw(int kmax, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sC, int ci, int cj); |
||||
void blasfeo_ref_dcolpe(int kmax, int *ipiv, struct blasfeo_dmat *sA); |
||||
void blasfeo_ref_dcolpei(int kmax, int *ipiv, struct blasfeo_dmat *sA); |
||||
|
||||
// vec
|
||||
// a <= alpha
|
||||
void blasfeo_ref_dvecse(int m, double alpha, struct blasfeo_dvec *sx, int xi); |
||||
// sx[xi] <= a
|
||||
void blasfeo_ref_dvecin1(double a, struct blasfeo_dvec *sx, int xi); |
||||
// <= sx[xi]
|
||||
double blasfeo_ref_dvecex1(struct blasfeo_dvec *sx, int xi); |
||||
// y <= x
|
||||
void blasfeo_ref_dveccp(int m, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi); |
||||
// x <= alpha*x
|
||||
void blasfeo_ref_dvecsc(int m, double alpha, struct blasfeo_dvec *sx, int xi); |
||||
// y <= alpha*x
|
||||
void blasfeo_ref_dveccpsc(int m, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi); |
||||
void blasfeo_ref_dvecad_sp(int m, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dvec *sz, int zi); |
||||
void blasfeo_ref_dvecin_sp(int m, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dvec *sz, int zi); |
||||
void blasfeo_ref_dvecex_sp(int m, double alpha, int *idx, struct blasfeo_dvec *sx, int x, struct blasfeo_dvec *sz, int zi); |
||||
|
||||
void blasfeo_ref_dveccl(int m, |
||||
struct blasfeo_dvec *sxm, int xim, struct blasfeo_dvec *sx, int xi, |
||||
struct blasfeo_dvec *sxp, int xip, struct blasfeo_dvec *sz, int zi); |
||||
|
||||
void blasfeo_ref_dveccl_mask(int m, |
||||
struct blasfeo_dvec *sxm, int xim, struct blasfeo_dvec *sx, int xi, |
||||
struct blasfeo_dvec *sxp, int xip, struct blasfeo_dvec *sz, int zi, |
||||
struct blasfeo_dvec *sm, int mi); |
||||
|
||||
void blasfeo_ref_dvecze(int m, struct blasfeo_dvec *sm, int mi, struct blasfeo_dvec *sv, int vi, struct blasfeo_dvec *se, int ei); |
||||
void blasfeo_ref_dvecnrm_inf(int m, struct blasfeo_dvec *sx, int xi, double *ptr_norm); |
||||
void blasfeo_ref_dvecpe(int kmax, int *ipiv, struct blasfeo_dvec *sx, int xi); |
||||
void blasfeo_ref_dvecpei(int kmax, int *ipiv, struct blasfeo_dvec *sx, int xi); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_D_AUX_REF_H_
|
@ -0,0 +1,226 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
/*
|
||||
* auxiliary algebra operations header |
||||
* |
||||
* include/blasfeo_aux_lib*.h |
||||
* |
||||
*/ |
||||
|
||||
#ifndef BLASFEO_D_AUX_TEST_H_ |
||||
#define BLASFEO_D_AUX_TEST_H_ |
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
// --- memory calculations
|
||||
int test_blasfeo_memsize_dmat(int m, int n); |
||||
int test_blasfeo_memsize_diag_dmat(int m, int n); |
||||
int test_blasfeo_memsize_dvec(int m); |
||||
|
||||
// --- creation
|
||||
void test_blasfeo_create_dmat(int m, int n, struct blasfeo_dmat *sA, void *memory); |
||||
void test_blasfeo_create_dvec(int m, struct blasfeo_dvec *sA, void *memory); |
||||
|
||||
// --- conversion
|
||||
void test_blasfeo_pack_dmat(int m, int n, double *A, int lda, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void test_blasfeo_pack_dvec(int m, double *x, int xi, struct blasfeo_dvec *sa, int ai); |
||||
void test_blasfeo_pack_tran_dmat(int m, int n, double *A, int lda, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void test_blasfeo_unpack_dmat(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, double *A, int lda); |
||||
void test_blasfeo_unpack_dvec(int m, struct blasfeo_dvec *sa, int ai, double *x, int xi); |
||||
void test_blasfeo_unpack_tran_dmat(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, double *A, int lda); |
||||
|
||||
// --- cast
|
||||
void test_d_cast_mat2strmat(double *A, struct blasfeo_dmat *sA); |
||||
void test_d_cast_diag_mat2strmat(double *dA, struct blasfeo_dmat *sA); |
||||
void test_d_cast_vec2vecmat(double *a, struct blasfeo_dvec *sa); |
||||
|
||||
// ------ copy / scale
|
||||
|
||||
// B <= A
|
||||
void test_blasfeo_dgecp(int m, int n, |
||||
struct blasfeo_dmat *sA, int ai, int aj, |
||||
struct blasfeo_dmat *sB, int bi, int bj); |
||||
|
||||
// A <= alpha*A
|
||||
void test_blasfeo_dgesc(int m, int n, |
||||
double alpha, |
||||
struct blasfeo_dmat *sA, int ai, int aj); |
||||
|
||||
// B <= alpha*A
|
||||
void test_blasfeo_dgecpsc(int m, int n, |
||||
double alpha, |
||||
struct blasfeo_dmat *sA, int ai, int aj, |
||||
struct blasfeo_dmat *sB, int bi, int bj); |
||||
|
||||
// // --- insert/extract
|
||||
// //
|
||||
// // <= sA[ai, aj]
|
||||
// void test_blasfeo_dgein1(double a, struct blasfeo_dmat *sA, int ai, int aj);
|
||||
// // <= sA[ai, aj]
|
||||
// double blasfeo_dgeex1(struct blasfeo_dmat *sA, int ai, int aj);
|
||||
// // sx[xi] <= a
|
||||
// void test_blasfeo_dvecin1(double a, struct blasfeo_dvec *sx, int xi);
|
||||
// // <= sx[xi]
|
||||
// double blasfeo_dvecex1(struct blasfeo_dvec *sx, int xi);
|
||||
// // A <= alpha
|
||||
|
||||
// // --- set
|
||||
// void test_blasfeo_dgese(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj);
|
||||
// // a <= alpha
|
||||
// void test_blasfeo_dvecse(int m, double alpha, struct blasfeo_dvec *sx, int xi);
|
||||
// // B <= A
|
||||
|
||||
|
||||
// // --- vector
|
||||
// // y <= x
|
||||
// void test_blasfeo_dveccp(int m, struct blasfeo_dvec *sa, int ai, struct blasfeo_dvec *sc, int ci);
|
||||
// // x <= alpha*x
|
||||
// void test_blasfeo_dvecsc(int m, double alpha, struct blasfeo_dvec *sa, int ai);
|
||||
// // TODO
|
||||
// // x <= alpha*x
|
||||
// void test_blasfeo_dveccpsc(int m, double alpha, struct blasfeo_dvec *sa, int ai, struct blasfeo_dvec *sc, int ci);
|
||||
|
||||
|
||||
// // B <= A, A lower triangular
|
||||
// void test_blasfeo_dtrcp_l(int m,
|
||||
// struct blasfeo_dmat *sA, int ai, int aj,
|
||||
// struct blasfeo_dmat *sB, int bi, int bj);
|
||||
|
||||
// void test_blasfeo_dtrcpsc_l(int m, double alpha,
|
||||
// struct blasfeo_dmat *sA, int ai, int aj,
|
||||
// struct blasfeo_dmat *sB, int bi, int bj);
|
||||
|
||||
// void test_blasfeo_dtrsc_l(int m, double alpha,
|
||||
// struct blasfeo_dmat *sA, int ai, int aj);
|
||||
|
||||
|
||||
// // B <= B + alpha*A
|
||||
// void test_blasfeo_dgead(int m, int n, double alpha,
|
||||
// struct blasfeo_dmat *sA, int ai, int aj,
|
||||
// struct blasfeo_dmat *sC, int ci, int cj);
|
||||
|
||||
// // y <= y + alpha*x
|
||||
// void test_blasfeo_dvecad(int m, double alpha,
|
||||
// struct blasfeo_dvec *sa, int ai,
|
||||
// struct blasfeo_dvec *sc, int ci);
|
||||
|
||||
// // --- traspositions
|
||||
// void test_dgetr_lib(int m, int n, double alpha, int offsetA, double *pA, int sda, int offsetC, double *pC, int sdc);
|
||||
// void test_blasfeo_dgetr(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sC, int ci, int cj);
|
||||
// void test_dtrtr_l_lib(int m, double alpha, int offsetA, double *pA, int sda, int offsetC, double *pC, int sdc);
|
||||
// void test_blasfeo_dtrtr_l(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sC, int ci, int cj);
|
||||
// void test_dtrtr_u_lib(int m, double alpha, int offsetA, double *pA, int sda, int offsetC, double *pC, int sdc);
|
||||
// void test_blasfeo_dtrtr_u(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sC, int ci, int cj);
|
||||
// void test_blasfeo_ddiare(int kmax, double alpha, struct blasfeo_dmat *sA, int ai, int aj);
|
||||
// void test_blasfeo_ddiain(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj);
|
||||
// void test_ddiaex_lib(int kmax, double alpha, int offset, double *pD, int sdd, double *x);
|
||||
// void test_ddiaad_lib(int kmax, double alpha, double *x, int offset, double *pD, int sdd);
|
||||
// void test_ddiain_libsp(int kmax, int *idx, double alpha, double *x, double *pD, int sdd);
|
||||
// void test_blasfeo_ddiain_sp(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dmat *sD, int di, int dj);
|
||||
// void test_ddiaex_libsp(int kmax, int *idx, double alpha, double *pD, int sdd, double *x);
|
||||
// void test_blasfeo_ddiaex(int kmax, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi);
|
||||
// void test_blasfeo_ddiaex_sp(int kmax, double alpha, int *idx, struct blasfeo_dmat *sD, int di, int dj, struct blasfeo_dvec *sx, int xi);
|
||||
// void test_blasfeo_ddiaad(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj);
|
||||
// void test_ddiaad_libsp(int kmax, int *idx, double alpha, double *x, double *pD, int sdd);
|
||||
// void test_blasfeo_ddiaad_sp(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dmat *sD, int di, int dj);
|
||||
// void test_ddiaadin_libsp(int kmax, int *idx, double alpha, double *x, double *y, double *pD, int sdd);
|
||||
// void test_blasfeo_ddiaadin_sp(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi, int *idx, struct blasfeo_dmat *sD, int di, int dj);
|
||||
// void test_drowin_lib(int kmax, double alpha, double *x, double *pD);
|
||||
// void test_blasfeo_drowin(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj);
|
||||
// void test_drowex_lib(int kmax, double alpha, double *pD, double *x);
|
||||
// void test_blasfeo_drowex(int kmax, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi);
|
||||
// void test_drowad_lib(int kmax, double alpha, double *x, double *pD);
|
||||
// void test_blasfeo_drowad(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj);
|
||||
// void test_drowin_libsp(int kmax, double alpha, int *idx, double *x, double *pD);
|
||||
// void test_drowad_libsp(int kmax, int *idx, double alpha, double *x, double *pD);
|
||||
// void test_blasfeo_drowad_sp(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dmat *sD, int di, int dj);
|
||||
// void test_drowadin_libsp(int kmax, int *idx, double alpha, double *x, double *y, double *pD);
|
||||
// void test_drowsw_lib(int kmax, double *pA, double *pC);
|
||||
// void test_blasfeo_drowsw(int kmax, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sC, int ci, int cj);
|
||||
// void test_blasfeo_drowpe(int kmax, int *ipiv, struct blasfeo_dmat *sA);
|
||||
// void test_blasfeo_dcolex(int kmax, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi);
|
||||
// void test_dcolin_lib(int kmax, double *x, int offset, double *pD, int sdd);
|
||||
// void test_blasfeo_dcolin(int kmax, struct blasfeo_dvec *sx, int xi, struct blasfeo_dmat *sA, int ai, int aj);
|
||||
// void test_dcolad_lib(int kmax, double alpha, double *x, int offset, double *pD, int sdd);
|
||||
// void test_dcolin_libsp(int kmax, int *idx, double *x, double *pD, int sdd);
|
||||
// void test_dcolad_libsp(int kmax, double alpha, int *idx, double *x, double *pD, int sdd);
|
||||
// void test_dcolsw_lib(int kmax, int offsetA, double *pA, int sda, int offsetC, double *pC, int sdc);
|
||||
// void test_blasfeo_dcolsw(int kmax, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sC, int ci, int cj);
|
||||
// void test_blasfeo_dcolpe(int kmax, int *ipiv, struct blasfeo_dmat *sA);
|
||||
// void test_dvecin_libsp(int kmax, int *idx, double *x, double *y);
|
||||
// void test_dvecad_libsp(int kmax, int *idx, double alpha, double *x, double *y);
|
||||
// void test_blasfeo_dvecad_sp(int m, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dvec *sz, int zi);
|
||||
// void test_blasfeo_dvecin_sp(int m, double alpha, struct blasfeo_dvec *sx, int xi, int *idx, struct blasfeo_dvec *sz, int zi);
|
||||
// void test_blasfeo_dvecex_sp(int m, double alpha, int *idx, struct blasfeo_dvec *sx, int x, struct blasfeo_dvec *sz, int zi);
|
||||
// void test_blasfeo_dveccl(int m, struct blasfeo_dvec *sxm, int xim, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sxp, int xip, struct blasfeo_dvec *sz, int zi);
|
||||
// void test_blasfeo_dveccl_mask(int m, struct blasfeo_dvec *sxm, int xim, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sxp, int xip, struct blasfeo_dvec *sz, int zi, struct blasfeo_dvec *sm, int mi);
|
||||
// void test_blasfeo_dvecze(int m, struct blasfeo_dvec *sm, int mi, struct blasfeo_dvec *sv, int vi, struct blasfeo_dvec *se, int ei);
|
||||
// void test_blasfeo_dvecnrm_inf(int m, struct blasfeo_dvec *sx, int xi, double *ptr_norm);
|
||||
// void test_blasfeo_dvecpe(int kmax, int *ipiv, struct blasfeo_dvec *sx, int xi);
|
||||
// void test_blasfeo_dvecpei(int kmax, int *ipiv, struct blasfeo_dvec *sx, int xi);
|
||||
|
||||
// ext_dep
|
||||
|
||||
void test_blasfeo_allocate_dmat(int m, int n, struct blasfeo_dmat *sA); |
||||
void test_blasfeo_allocate_dvec(int m, struct blasfeo_dvec *sa); |
||||
|
||||
void test_blasfeo_free_dmat(struct blasfeo_dmat *sA); |
||||
void test_blasfeo_free_dvec(struct blasfeo_dvec *sa); |
||||
|
||||
void test_blasfeo_print_dmat(int m, int n, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void test_blasfeo_print_dvec(int m, struct blasfeo_dvec *sa, int ai); |
||||
void test_blasfeo_print_tran_dvec(int m, struct blasfeo_dvec *sa, int ai); |
||||
|
||||
void test_blasfeo_print_to_file_dmat(FILE *file, int m, int n, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void test_blasfeo_print_to_file_dvec(FILE *file, int m, struct blasfeo_dvec *sa, int ai); |
||||
void test_blasfeo_print_to_file_tran_dvec(FILE *file, int m, struct blasfeo_dvec *sa, int ai); |
||||
|
||||
void test_blasfeo_print_exp_dmat(int m, int n, struct blasfeo_dmat *sA, int ai, int aj); |
||||
void test_blasfeo_print_exp_dvec(int m, struct blasfeo_dvec *sa, int ai); |
||||
void test_blasfeo_print_exp_tran_dvec(int m, struct blasfeo_dvec *sa, int ai); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_D_AUX_TEST_H_
|
@ -0,0 +1,46 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_D_BLAS_H_ |
||||
#define BLASFEO_D_BLAS_H_ |
||||
|
||||
|
||||
|
||||
#include "blasfeo_d_blasfeo_api.h" |
||||
#include "blasfeo_d_blas_api.h" |
||||
|
||||
|
||||
|
||||
#endif // BLASFEO_D_BLAS_H_
|
@ -0,0 +1,161 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef BLASFEO_D_BLAS_API_H_ |
||||
#define BLASFEO_D_BLAS_API_H_ |
||||
|
||||
|
||||
|
||||
#include "blasfeo_target.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
#ifdef BLAS_API |
||||
|
||||
|
||||
|
||||
#ifdef FORTRAN_BLAS_API |
||||
|
||||
|
||||
|
||||
// BLAS 1
|
||||
//
|
||||
void daxpy_(int *n, double *alpha, double *x, int *incx, double *y, int *incy); |
||||
//
|
||||
void dcopy_(int *n, double *x, int *incx, double *y, int *incy); |
||||
//
|
||||
double ddot_(int *n, double *x, int *incx, double *y, int *incy); |
||||
|
||||
// BLAS 3
|
||||
//
|
||||
void dgemm_(char *ta, char *tb, int *m, int *n, int *k, double *alpha, double *A, int *lda, double *B, int *ldb, double *beta, double *C, int *ldc); |
||||
//
|
||||
void dsyrk_(char *uplo, char *ta, int *m, int *k, double *alpha, double *A, int *lda, double *beta, double *C, int *ldc); |
||||
//
|
||||
void dtrmm_(char *side, char *uplo, char *transa, char *diag, int *m, int *n, double *alpha, double *A, int *lda, double *B, int *ldb); |
||||
//
|
||||
void dtrsm_(char *side, char *uplo, char *transa, char *diag, int *m, int *n, double *alpha, double *A, int *lda, double *B, int *ldb); |
||||
|
||||
|
||||
|
||||
// LAPACK
|
||||
//
|
||||
void dgesv_(int *m, int *n, double *A, int *lda, int *ipiv, double *B, int *ldb, int *info); |
||||
//
|
||||
void dgetrf_(int *m, int *n, double *A, int *lda, int *ipiv, int *info); |
||||
//
|
||||
void dgetrf_np_(int *m, int *n, double *A, int *lda, int *info); |
||||
//
|
||||
void dgetrs_(char *trans, int *m, int *n, double *A, int *lda, int *ipiv, double *B, int *ldb, int *info); |
||||
//
|
||||
void dlaswp_(int *n, double *A, int *lda, int *k1, int *k2, int *ipiv, int *incx); |
||||
//
|
||||
void dposv_(char *uplo, int *m, int *n, double *A, int *lda, double *B, int *ldb, int *info); |
||||
//
|
||||
void dpotrf_(char *uplo, int *m, double *A, int *lda, int *info); |
||||
//
|
||||
void dpotrs_(char *uplo, int *m, int *n, double *A, int *lda, double *B, int *ldb, int *info); |
||||
//
|
||||
void dtrtrs_(char *uplo, char *trans, char *diag, int *m, int *n, double *A, int *lda, double *B, int *ldb, int *info); |
||||
|
||||
|
||||
|
||||
#else // BLASFEO_API
|
||||
|
||||
|
||||
|
||||
// BLAS 1
|
||||
//
|
||||
void blas_daxpy(int *n, double *alpha, double *x, int *incx, double *y, int *incy); |
||||
//
|
||||
double blas_ddot(int *n, double *x, int *incx, double *y, int *incy); |
||||
//
|
||||
void blas_dcopy(int *n, double *x, int *incx, double *y, int *incy); |
||||
|
||||
// BLAS 3
|
||||
//
|
||||
void blas_dgemm(char *ta, char *tb, int *m, int *n, int *k, double *alpha, double *A, int *lda, double *B, int *ldb, double *beta, double *C, int *ldc); |
||||
//
|
||||
void blas_dsyrk(char *uplo, char *ta, int *m, int *k, double *alpha, double *A, int *lda, double *beta, double *C, int *ldc); |
||||
//
|
||||
void blas_dtrmm(char *side, char *uplo, char *transa, char *diag, int *m, int *n, double *alpha, double *A, int *lda, double *B, int *ldb); |
||||
//
|
||||
void blas_dtrsm(char *side, char *uplo, char *transa, char *diag, int *m, int *n, double *alpha, double *A, int *lda, double *B, int *ldb); |
||||
|
||||
|
||||
|
||||
// LAPACK
|
||||
//
|
||||
void blas_dgesv(int *m, int *n, double *A, int *lda, int *ipiv, double *B, int *ldb, int *info); |
||||
//
|
||||
void blas_dgetrf(int *m, int *n, double *A, int *lda, int *ipiv, int *info); |
||||
//
|
||||
void blas_dgetrf_np(int *m, int *n, double *A, int *lda, int *info); |
||||
//
|
||||
void blas_dgetrs(char *trans, int *m, int *n, double *A, int *lda, int *ipiv, double *B, int *ldb, int *info); |
||||
//
|
||||
void blas_dlaswp(int *n, double *A, int *lda, int *k1, int *k2, int *ipiv, int *incx); |
||||
//
|
||||
void blas_dposv(char *uplo, int *m, int *n, double *A, int *lda, double *B, int *ldb, int *info); |
||||
//
|
||||
void blas_dpotrf(char *uplo, int *m, double *A, int *lda, int *info); |
||||
//
|
||||
void blas_dpotrs(char *uplo, int *m, int *n, double *A, int *lda, double *B, int *ldb, int *info); |
||||
//
|
||||
void blas_dtrtrs(char *uplo, char *trans, char *diag, int *m, int *n, double *A, int *lda, double *B, int *ldb, int *info); |
||||
|
||||
|
||||
|
||||
#endif // BLASFEO_API
|
||||
|
||||
|
||||
|
||||
#endif // BLAS_API
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_D_BLAS_API_H_
|
@ -0,0 +1,342 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_D_BLASFEO_API_H_ |
||||
#define BLASFEO_D_BLASFEO_API_H_ |
||||
|
||||
|
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
//
|
||||
// level 1 BLAS
|
||||
//
|
||||
|
||||
// z = y + alpha*x
|
||||
// z[zi:zi+n] = alpha*x[xi:xi+n] + y[yi:yi+n]
|
||||
// NB: Different arguments semantic compare to equivalent standard BLAS routine
|
||||
void blasfeo_daxpy(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// z = beta*y + alpha*x
|
||||
void blasfeo_daxpby(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, double beta, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// z = x .* y
|
||||
void blasfeo_dvecmul(int m, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// z += x .* y
|
||||
void blasfeo_dvecmulacc(int m, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// z = x .* y, return sum(z) = x^T * y
|
||||
double blasfeo_dvecmuldot(int m, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// return x^T * y
|
||||
double blasfeo_ddot(int m, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi); |
||||
// construct givens plane rotation
|
||||
void blasfeo_drotg(double a, double b, double *c, double *s); |
||||
// apply plane rotation [a b] [c -s; s; c] to the aj0 and aj1 columns of A at row index ai
|
||||
void blasfeo_dcolrot(int m, struct blasfeo_dmat *sA, int ai, int aj0, int aj1, double c, double s); |
||||
// apply plane rotation [c s; -s c] [a; b] to the ai0 and ai1 rows of A at column index aj
|
||||
void blasfeo_drowrot(int m, struct blasfeo_dmat *sA, int ai0, int ai1, int aj, double c, double s); |
||||
|
||||
|
||||
|
||||
//
|
||||
// level 2 BLAS
|
||||
//
|
||||
|
||||
// dense
|
||||
|
||||
// z <= beta * y + alpha * A * x
|
||||
void blasfeo_dgemv_n(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, double beta, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= beta * y + alpha * A^T * x
|
||||
void blasfeo_dgemv_t(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, double beta, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A ) * x, A (m)x(n)
|
||||
void blasfeo_dtrsv_lnn_mn(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A^T ) * x, A (m)x(n)
|
||||
void blasfeo_dtrsv_ltn_mn(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A ) * x, A (m)x(m) lower, not_transposed, not_unit
|
||||
void blasfeo_dtrsv_lnn(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A ) * x, A (m)x(m) lower, not_transposed, unit
|
||||
void blasfeo_dtrsv_lnu(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A^T ) * x, A (m)x(m) lower, transposed, not_unit
|
||||
void blasfeo_dtrsv_ltn(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A^T ) * x, A (m)x(m) lower, transposed, unit
|
||||
void blasfeo_dtrsv_ltu(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A^T ) * x, A (m)x(m) upper, not_transposed, not_unit
|
||||
void blasfeo_dtrsv_unn(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A^T ) * x, A (m)x(m) upper, transposed, not_unit
|
||||
void blasfeo_dtrsv_utn(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= beta * y + alpha * A * x ; A upper triangular
|
||||
void blasfeo_dtrmv_unn(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= A^T * x ; A upper triangular
|
||||
void blasfeo_dtrmv_utn(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= A * x ; A lower triangular
|
||||
void blasfeo_dtrmv_lnn(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= A^T * x ; A lower triangular
|
||||
void blasfeo_dtrmv_ltn(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= A * x ; A lower triangular, unit diagonal
|
||||
void blasfeo_dtrmv_lnu(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= A^T * x ; A lower triangular, unit diagonal
|
||||
void blasfeo_dtrmv_ltu(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z_n <= beta_n * y_n + alpha_n * A * x_n
|
||||
// z_t <= beta_t * y_t + alpha_t * A^T * x_t
|
||||
void blasfeo_dgemv_nt(int m, int n, double alpha_n, double alpha_t, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx_n, int xi_n, struct blasfeo_dvec *sx_t, int xi_t, double beta_n, double beta_t, struct blasfeo_dvec *sy_n, int yi_n, struct blasfeo_dvec *sy_t, int yi_t, struct blasfeo_dvec *sz_n, int zi_n, struct blasfeo_dvec *sz_t, int zi_t); |
||||
// z <= beta * y + alpha * A * x, where A is symmetric and only the lower triangular patr of A is accessed
|
||||
void blasfeo_dsymv_l(int m, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, double beta, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
void blasfeo_dsymv_l_mn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, double beta, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
|
||||
// diagonal
|
||||
|
||||
// z <= beta * y + alpha * A * x, A diagonal
|
||||
void blasfeo_dgemv_d(int m, double alpha, struct blasfeo_dvec *sA, int ai, struct blasfeo_dvec *sx, int xi, double beta, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
|
||||
|
||||
|
||||
//
|
||||
// level 3 BLAS
|
||||
//
|
||||
|
||||
// dense
|
||||
|
||||
// D <= beta * C + alpha * A * B
|
||||
void blasfeo_dgemm_nn(int m, int n, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A * B^T
|
||||
void blasfeo_dgemm_nt(int m, int n, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B
|
||||
void blasfeo_dgemm_tn(int m, int n, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B^T
|
||||
void blasfeo_dgemm_tt(int m, int n, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A * B^T ; C, D lower triangular
|
||||
void blasfeo_dsyrk_ln(int m, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
void blasfeo_dsyrk_ln_mn(int m, int n, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
#if ( defined(LA_HIGH_PERFORMANCE) & defined(MF_COLMAJ) ) |
||||
void blasfeo_dsyrk3_ln(int m, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
#endif |
||||
// D <= beta * C + alpha * A^T * B ; C, D lower triangular
|
||||
void blasfeo_dsyrk_lt(int m, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
#if ( defined(LA_HIGH_PERFORMANCE) & defined(MF_COLMAJ) ) |
||||
void blasfeo_dsyrk3_lt(int m, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
#endif |
||||
// D <= beta * C + alpha * A * B^T ; C, D upper triangular
|
||||
void blasfeo_dsyrk_un(int m, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
#if ( defined(LA_HIGH_PERFORMANCE) & defined(MF_COLMAJ) ) |
||||
void blasfeo_dsyrk3_un(int m, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
#endif |
||||
// D <= beta * C + alpha * A^T * B ; C, D upper triangular
|
||||
void blasfeo_dsyrk_ut(int m, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
#if ( defined(LA_HIGH_PERFORMANCE) & defined(MF_COLMAJ) ) |
||||
void blasfeo_dsyrk3_ut(int m, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
#endif |
||||
// D <= alpha * A * B ; A lower triangular
|
||||
void blasfeo_dtrmm_llnn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A * B ; A lower triangular
|
||||
void blasfeo_dtrmm_llnu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^T * B ; A lower triangular
|
||||
void blasfeo_dtrmm_lltn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^T * B ; A lower triangular
|
||||
void blasfeo_dtrmm_lltu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A * B ; A upper triangular
|
||||
void blasfeo_dtrmm_lunn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A * B ; A upper triangular
|
||||
void blasfeo_dtrmm_lunu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^T * B ; A upper triangular
|
||||
void blasfeo_dtrmm_lutn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^T * B ; A upper triangular
|
||||
void blasfeo_dtrmm_lutu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A ; A lower triangular
|
||||
void blasfeo_dtrmm_rlnn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A ; A lower triangular
|
||||
void blasfeo_dtrmm_rlnu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^T ; A lower triangular
|
||||
void blasfeo_dtrmm_rltn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^T ; A lower triangular
|
||||
void blasfeo_dtrmm_rltu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A ; A upper triangular
|
||||
void blasfeo_dtrmm_runn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A ; A upper triangular
|
||||
void blasfeo_dtrmm_runu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^T ; A upper triangular
|
||||
void blasfeo_dtrmm_rutn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^T ; A upper triangular
|
||||
void blasfeo_dtrmm_rutu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A lower triangular employint explicit inverse of diagonal
|
||||
// D <= alpha * A^{-1} * B , with A lower triangular employing explicit inverse of diagonal
|
||||
void blasfeo_dtrsm_llnn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A lower triangular with unit diagonal
|
||||
void blasfeo_dtrsm_llnu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A lower triangular employing explicit inverse of diagonal
|
||||
void blasfeo_dtrsm_lltn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A lower triangular with unit diagonal
|
||||
void blasfeo_dtrsm_lltu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_dtrsm_lunn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A upper triangular with unit diagonal
|
||||
void blasfeo_dtrsm_lunu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_dtrsm_lutn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A upper triangular with unit diagonal
|
||||
void blasfeo_dtrsm_lutu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A lower triangular employing explicit inverse of diagonal
|
||||
void blasfeo_dtrsm_rlnn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A lower triangular with unit diagonal
|
||||
void blasfeo_dtrsm_rlnu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A lower triangular employing explicit inverse of diagonal
|
||||
void blasfeo_dtrsm_rltn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A lower triangular with unit diagonal
|
||||
void blasfeo_dtrsm_rltu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_dtrsm_runn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A upper triangular with unit diagonal
|
||||
void blasfeo_dtrsm_runu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_dtrsm_rutn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A upper triangular with unit diagonal
|
||||
void blasfeo_dtrsm_rutu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
|
||||
// diagonal
|
||||
|
||||
// D <= alpha * A * B + beta * C, with A diagonal (stored as strvec)
|
||||
void dgemm_diag_left_lib(int m, int n, double alpha, double *dA, double *pB, int sdb, double beta, double *pC, int sdc, double *pD, int sdd); |
||||
void blasfeo_dgemm_dn(int m, int n, double alpha, struct blasfeo_dvec *sA, int ai, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A * B + beta * C, with B diagonal (stored as strvec)
|
||||
void blasfeo_dgemm_nd(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sB, int bi, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
|
||||
|
||||
|
||||
//
|
||||
// LAPACK
|
||||
//
|
||||
|
||||
// D <= chol( C ) ; C, D lower triangular
|
||||
void blasfeo_dpotrf_l(int m, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
void blasfeo_dpotrf_l_mn(int m, int n, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= chol( C ) ; C, D upper triangular
|
||||
void blasfeo_dpotrf_u(int m, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= chol( C + A * B' ) ; C, D lower triangular
|
||||
// D <= chol( C + A * B^T ) ; C, D lower triangular
|
||||
void blasfeo_dsyrk_dpotrf_ln(int m, int k, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
void blasfeo_dsyrk_dpotrf_ln_mn(int m, int n, int k, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= lu( C ) ; no pivoting
|
||||
void blasfeo_dgetrf_np(int m, int n, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= lu( C ) ; row pivoting
|
||||
void blasfeo_dgetrf_rp(int m, int n, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj, int *ipiv); |
||||
// D <= qr( C )
|
||||
int blasfeo_dgeqrf_worksize(int m, int n); // in bytes
|
||||
void blasfeo_dgeqrf(int m, int n, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj, void *work); |
||||
// D <= Q factor, where C is the output of the LQ factorization
|
||||
int blasfeo_dorglq_worksize(int m, int n, int k); // in bytes
|
||||
void blasfeo_dorglq(int m, int n, int k, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj, void *work); |
||||
// D <= lq( C )
|
||||
void blasfeo_dgelqf(int m, int n, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj, void *work); |
||||
int blasfeo_dgelqf_worksize(int m, int n); // in bytes
|
||||
// D <= lq( C ), positive diagonal elements
|
||||
void blasfeo_dgelqf_pd(int m, int n, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj, void *work); |
||||
// [L, A] <= lq( [L, A] ), positive diagonal elements, array of matrices, with
|
||||
// L lower triangular, of size (m)x(m)
|
||||
// A full, of size (m)x(n1)
|
||||
void blasfeo_dgelqf_pd_la(int m, int n1, struct blasfeo_dmat *sL, int li, int lj, struct blasfeo_dmat *sA, int ai, int aj, void *work); |
||||
// [L, L, A] <= lq( [L, L, A] ), positive diagonal elements, array of matrices, with:
|
||||
// L lower triangular, of size (m)x(m)
|
||||
// A full, of size (m)x(n1)
|
||||
void blasfeo_dgelqf_pd_lla(int m, int n1, struct blasfeo_dmat *sL0, int l0i, int l0j, struct blasfeo_dmat *sL1, int l1i, int l1j, struct blasfeo_dmat *sA, int ai, int aj, void *work); |
||||
|
||||
|
||||
|
||||
//
|
||||
// BLAS API helper functions
|
||||
//
|
||||
|
||||
#if ( defined(BLAS_API) & defined(MF_PANELMAJ) ) |
||||
// BLAS 3
|
||||
void blasfeo_cm_dgemm_nn(int m, int n, int k, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, double beta, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dgemm_nt(int m, int n, int k, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, double beta, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dgemm_tn(int m, int n, int k, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, double beta, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dgemm_tt(int m, int n, int k, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, double beta, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dsyrk_ln(int m, int k, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, double beta, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dsyrk_lt(int m, int k, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, double beta, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dsyrk_un(int m, int k, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, double beta, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dsyrk_ut(int m, int k, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, double beta, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dsyrk3_ln(int m, int k, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, double beta, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dsyrk3_lt(int m, int k, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, double beta, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dsyrk3_un(int m, int k, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, double beta, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dsyrk3_ut(int m, int k, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, double beta, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_llnn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_llnu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_lltn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_lltu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_lunn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_lunu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_lutn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_lutu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_rlnn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_rlnu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_rltn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_rltu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_runn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_runu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_rutn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrsm_rutu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_llnn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_llnu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_lltn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_lltu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_lunn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_lunu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_lutn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_lutu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_rlnn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_rlnu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_rltn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_rltu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_runn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_runu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_rutn(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dtrmm_rutu(int m, int n, double alpha, struct blasfeo_cm_dmat *sA, int ai, int aj, struct blasfeo_cm_dmat *sB, int bi, int bj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
// LAPACK
|
||||
void blasfeo_cm_dpotrf_l(int m, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dpotrf_u(int m, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj); |
||||
void blasfeo_cm_dgetrf_rp(int m, int n, struct blasfeo_cm_dmat *sC, int ci, int cj, struct blasfeo_cm_dmat *sD, int di, int dj, int *ipiv); |
||||
#endif |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_D_BLASFEO_API_H_
|
@ -0,0 +1,147 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_D_BLASFEO_API_REF_H_ |
||||
#define BLASFEO_D_BLASFEO_API_REF_H_ |
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
// expose reference BLASFEO for testing
|
||||
|
||||
// --- level 1
|
||||
|
||||
void blasfeo_daxpy_ref(int kmax, double alpha, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sy, int yi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_daxpby_ref(int kmax, double alpha, struct blasfeo_dvec_ref *sx, int xi, double beta, struct blasfeo_dvec_ref *sy, int yi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dvecmul_ref(int m, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sy, int yi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dvecmulacc_ref(int m, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sy, int yi, struct blasfeo_dvec_ref *sz, int zi); |
||||
double blasfeo_dvecmuldot_ref(int m, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sy, int yi, struct blasfeo_dvec_ref *sz, int zi); |
||||
double blasfeo_ddot_ref(int m, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sy, int yi); |
||||
void blasfeo_drotg_ref(double a, double b, double *c, double *s); |
||||
void blasfeo_dcolrot_ref(int m, struct blasfeo_dmat_ref *sA, int ai, int aj0, int aj1, double c, double s); |
||||
void blasfeo_drowrot_ref(int m, struct blasfeo_dmat_ref *sA, int ai0, int ai1, int aj, double c, double s); |
||||
|
||||
|
||||
// --- level 2
|
||||
|
||||
// dense
|
||||
void blasfeo_dgemv_n_ref(int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, double beta, struct blasfeo_dvec_ref *sy, int yi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dgemv_t_ref(int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, double beta, struct blasfeo_dvec_ref *sy, int yi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrsv_lnn_mn_ref(int m, int n, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrsv_ltn_mn_ref(int m, int n, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrsv_lnn_ref(int m, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrsv_lnu_ref(int m, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrsv_ltn_ref(int m, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrsv_ltu_ref(int m, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrsv_unn_ref(int m, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrsv_utn_ref(int m, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrmv_unn_ref(int m, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrmv_utn_ref(int m, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrmv_lnn_ref(int m, int n, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrmv_ltn_ref(int m, int n, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrmv_lnu_ref(int m, int n, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dtrmv_ltu_ref(int m, int n, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, struct blasfeo_dvec_ref *sz, int zi); |
||||
void blasfeo_dgemv_nt_ref(int m, int n, double alpha_n, double alpha_t, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx_n, int xi_n, struct blasfeo_dvec_ref *sx_t, int xi_t, double beta_n, double beta_t, struct blasfeo_dvec_ref *sy_n, int yi_n, struct blasfeo_dvec_ref *sy_t, int yi_t, struct blasfeo_dvec_ref *sz_n, int zi_n, struct blasfeo_dvec_ref *sz_t, int zi_t); |
||||
void blasfeo_dsymv_l_ref(int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sx, int xi, double beta, struct blasfeo_dvec_ref *sy, int yi, struct blasfeo_dvec_ref *sz, int zi); |
||||
|
||||
// diagonal
|
||||
void blasfeo_dgemv_d_ref(int m, double alpha, struct blasfeo_dvec_ref *sA, int ai, struct blasfeo_dvec_ref *sx, int xi, double beta, struct blasfeo_dvec_ref *sy, int yi, struct blasfeo_dvec_ref *sz, int zi); |
||||
|
||||
|
||||
// --- level 3
|
||||
|
||||
// dense
|
||||
void blasfeo_dgemm_nn_ref( int m, int n, int k, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, double beta, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dgemm_nt_ref( int m, int n, int k, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, double beta, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dgemm_tn_ref(int m, int n, int k, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, double beta, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dgemm_tt_ref(int m, int n, int k, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, double beta, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
|
||||
void blasfeo_dsyrk_ln_mn_ref( int m, int n, int k, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, double beta, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dsyrk_ln_ref( int m, int k, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, double beta, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dsyrk_lt_ref( int m, int k, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, double beta, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dsyrk_un_ref( int m, int k, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, double beta, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dsyrk_ut_ref( int m, int k, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, double beta, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
|
||||
void blasfeo_dtrmm_rutn_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrmm_rlnn_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
|
||||
void blasfeo_dtrsm_lunu_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_lunn_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_lutu_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_lutn_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_llnu_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_llnn_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_lltu_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_lltn_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_runu_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_runn_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_rutu_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_rutn_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_rlnu_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_rlnn_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_rltu_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dtrsm_rltn_ref( int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
|
||||
// diagonal
|
||||
void dgemm_diag_left_lib_ref(int m, int n, double alpha, double *dA, double *pB, int sdb, double beta, double *pC, int sdc, double *pD, int sdd); |
||||
void blasfeo_dgemm_dn_ref(int m, int n, double alpha, struct blasfeo_dvec_ref *sA, int ai, struct blasfeo_dmat_ref *sB, int bi, int bj, double beta, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dgemm_nd_ref(int m, int n, double alpha, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dvec_ref *sB, int bi, double beta, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
|
||||
// --- lapack
|
||||
|
||||
void blasfeo_dgetrf_nopivot_ref(int m, int n, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dgetrf_rowpivot_ref(int m, int n, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj, int *ipiv); |
||||
void blasfeo_dpotrf_l_ref(int m, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dpotrf_l_mn_ref(int m, int n, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dsyrk_dpotrf_ln_ref(int m, int k, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dsyrk_dpotrf_ln_mn_ref(int m, int n, int k, struct blasfeo_dmat_ref *sA, int ai, int aj, struct blasfeo_dmat_ref *sB, int bi, int bj, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dgetrf_nopivot_ref(int m, int n, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj); |
||||
void blasfeo_dgetrf_rowpivot_ref(int m, int n, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj, int *ipiv); |
||||
void blasfeo_dgeqrf_ref(int m, int n, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj, void *work); |
||||
void blasfeo_dgelqf_ref(int m, int n, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj, void *work); |
||||
void blasfeo_dgelqf_pd_ref(int m, int n, struct blasfeo_dmat_ref *sC, int ci, int cj, struct blasfeo_dmat_ref *sD, int di, int dj, void *work); |
||||
void blasfeo_dgelqf_pd_la_ref(int m, int n1, struct blasfeo_dmat_ref *sL, int li, int lj, struct blasfeo_dmat_ref *sA, int ai, int aj, void *work); |
||||
void blasfeo_dgelqf_pd_lla_ref(int m, int n1, struct blasfeo_dmat_ref *sL0, int l0i, int l0j, struct blasfeo_dmat_ref *sL1, int l1i, int l1j, struct blasfeo_dmat_ref *sA, int ai, int aj, void *work); |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_D_BLASFEO_API_REF_H_
|
@ -0,0 +1,270 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_D_BLASFEO_REF_API_H_ |
||||
#define BLASFEO_D_BLASFEO_REF_API_H_ |
||||
|
||||
|
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
//
|
||||
// level 1 BLAS
|
||||
//
|
||||
|
||||
// z = y + alpha*x
|
||||
// z[zi:zi+n] = alpha*x[xi:xi+n] + y[yi:yi+n]
|
||||
// NB: Different arguments semantic compare to equivalent standard BLAS routine
|
||||
void blasfeo_ref_daxpy(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// z = beta*y + alpha*x
|
||||
void blasfeo_ref_daxpby(int kmax, double alpha, struct blasfeo_dvec *sx, int xi, double beta, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// z = x .* y
|
||||
void blasfeo_ref_dvecmul(int m, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// z += x .* y
|
||||
void blasfeo_ref_dvecmulacc(int m, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// z = x .* y, return sum(z) = x^T * y
|
||||
double blasfeo_ref_dvecmuldot(int m, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// return x^T * y
|
||||
double blasfeo_ref_ddot(int m, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sy, int yi); |
||||
// construct givens plane rotation
|
||||
void blasfeo_ref_drotg(double a, double b, double *c, double *s); |
||||
// apply plane rotation [a b] [c -s; s; c] to the aj0 and aj1 columns of A at row index ai
|
||||
void blasfeo_ref_dcolrot(int m, struct blasfeo_dmat *sA, int ai, int aj0, int aj1, double c, double s); |
||||
// apply plane rotation [c s; -s c] [a; b] to the ai0 and ai1 rows of A at column index aj
|
||||
void blasfeo_ref_drowrot(int m, struct blasfeo_dmat *sA, int ai0, int ai1, int aj, double c, double s); |
||||
|
||||
|
||||
|
||||
//
|
||||
// level 2 BLAS
|
||||
//
|
||||
|
||||
// dense
|
||||
|
||||
// z <= beta * y + alpha * A * x
|
||||
void blasfeo_ref_dgemv_n(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, double beta, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= beta * y + alpha * A' * x
|
||||
void blasfeo_ref_dgemv_t(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, double beta, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A ) * x, A (m)x(n)
|
||||
void blasfeo_ref_dtrsv_lnn_mn(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(n)
|
||||
void blasfeo_ref_dtrsv_ltn_mn(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A ) * x, A (m)x(m) lower, not_transposed, not_unit
|
||||
void blasfeo_ref_dtrsv_lnn(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A ) * x, A (m)x(m) lower, not_transposed, unit
|
||||
void blasfeo_ref_dtrsv_lnu(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(m) lower, transposed, not_unit
|
||||
void blasfeo_ref_dtrsv_ltn(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(m) lower, transposed, unit
|
||||
void blasfeo_ref_dtrsv_ltu(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(m) upper, not_transposed, not_unit
|
||||
void blasfeo_ref_dtrsv_unn(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(m) upper, transposed, not_unit
|
||||
void blasfeo_ref_dtrsv_utn(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= beta * y + alpha * A * x ; A upper triangular
|
||||
void blasfeo_ref_dtrmv_unn(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= A' * x ; A upper triangular
|
||||
void blasfeo_ref_dtrmv_utn(int m, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= A * x ; A lower triangular
|
||||
void blasfeo_ref_dtrmv_lnn(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= A' * x ; A lower triangular
|
||||
void blasfeo_ref_dtrmv_ltn(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= A * x ; A lower triangular, unit diagonal
|
||||
void blasfeo_ref_dtrmv_lnu(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z <= A' * x ; A lower triangular, unit diagonal
|
||||
void blasfeo_ref_dtrmv_ltu(int m, int n, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, struct blasfeo_dvec *sz, int zi); |
||||
// z_n <= beta_n * y_n + alpha_n * A * x_n
|
||||
// z_t <= beta_t * y_t + alpha_t * A' * x_t
|
||||
void blasfeo_ref_dgemv_nt(int m, int n, double alpha_n, double alpha_t, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx_n, int xi_n, struct blasfeo_dvec *sx_t, int xi_t, double beta_n, double beta_t, struct blasfeo_dvec *sy_n, int yi_n, struct blasfeo_dvec *sy_t, int yi_t, struct blasfeo_dvec *sz_n, int zi_n, struct blasfeo_dvec *sz_t, int zi_t); |
||||
// z <= beta * y + alpha * A * x, where A is symmetric and only the lower triangular patr of A is accessed
|
||||
void blasfeo_ref_dsymv_l(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, double beta, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
|
||||
// diagonal
|
||||
|
||||
// z <= beta * y + alpha * A * x, A diagonal
|
||||
void blasfeo_ref_dgemv_d(int m, double alpha, struct blasfeo_dvec *sA, int ai, struct blasfeo_dvec *sx, int xi, double beta, struct blasfeo_dvec *sy, int yi, struct blasfeo_dvec *sz, int zi); |
||||
|
||||
|
||||
|
||||
//
|
||||
// level 3 BLAS
|
||||
//
|
||||
|
||||
// dense
|
||||
|
||||
// D <= beta * C + alpha * A * B
|
||||
void blasfeo_ref_dgemm_nn(int m, int n, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A * B^T
|
||||
void blasfeo_ref_dgemm_nt(int m, int n, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B
|
||||
void blasfeo_ref_dgemm_tn(int m, int n, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B^T
|
||||
void blasfeo_ref_dgemm_tt(int m, int n, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A * B^T ; C, D lower triangular
|
||||
void blasfeo_ref_dsyrk_ln(int m, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
void blasfeo_ref_dsyrk_ln_mn(int m, int n, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B ; C, D lower triangular
|
||||
void blasfeo_ref_dsyrk_lt(int m, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A * B^T ; C, D upper triangular
|
||||
void blasfeo_ref_dsyrk_un(int m, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B ; C, D upper triangular
|
||||
void blasfeo_ref_dsyrk_ut(int m, int k, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A * B ; A lower triangular
|
||||
void blasfeo_ref_dtrmm_llnn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A * B ; A lower triangular
|
||||
void blasfeo_ref_dtrmm_llnu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^T * B ; A lower triangular
|
||||
void blasfeo_ref_dtrmm_lltn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^T * B ; A lower triangular
|
||||
void blasfeo_ref_dtrmm_lltu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A * B ; A upper triangular
|
||||
void blasfeo_ref_dtrmm_lunn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A * B ; A upper triangular
|
||||
void blasfeo_ref_dtrmm_lunu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^T * B ; A upper triangular
|
||||
void blasfeo_ref_dtrmm_lutn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^T * B ; A upper triangular
|
||||
void blasfeo_ref_dtrmm_lutu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A ; A lower triangular
|
||||
void blasfeo_ref_dtrmm_rlnn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A ; A lower triangular
|
||||
void blasfeo_ref_dtrmm_rlnu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^T ; A lower triangular
|
||||
void blasfeo_ref_dtrmm_rltn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^T ; A lower triangular
|
||||
void blasfeo_ref_dtrmm_rltu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A ; A upper triangular
|
||||
void blasfeo_ref_dtrmm_runn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A ; A upper triangular
|
||||
void blasfeo_ref_dtrmm_runu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^T ; A upper triangular
|
||||
void blasfeo_ref_dtrmm_rutn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^T ; A upper triangular
|
||||
void blasfeo_ref_dtrmm_rutu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A lower triangular employint explicit inverse of diagonal
|
||||
void blasfeo_ref_dtrsm_llnn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A lower triangular with unit diagonal
|
||||
void blasfeo_ref_dtrsm_llnu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A lower triangular employint explicit inverse of diagonal
|
||||
void blasfeo_ref_dtrsm_lltn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A lower triangular with unit diagonal
|
||||
void blasfeo_ref_dtrsm_lltu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_ref_dtrsm_lunn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A upper triangular withunit diagonal
|
||||
void blasfeo_ref_dtrsm_lunu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_ref_dtrsm_lutn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A upper triangular withunit diagonal
|
||||
void blasfeo_ref_dtrsm_lutu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A lower triangular employing explicit inverse of diagonal
|
||||
void blasfeo_ref_dtrsm_rlnn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A lower triangular with unit diagonal
|
||||
void blasfeo_ref_dtrsm_rlnu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A lower triangular employing explicit inverse of diagonal
|
||||
void blasfeo_ref_dtrsm_rltn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A lower triangular with unit diagonal
|
||||
void blasfeo_ref_dtrsm_rltu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_ref_dtrsm_runn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A upper triangular with unit diagonal
|
||||
void blasfeo_ref_dtrsm_runu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_ref_dtrsm_rutn(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A upper triangular with unit diagonal
|
||||
void blasfeo_ref_dtrsm_rutu(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sD, int di, int dj); |
||||
|
||||
// diagonal
|
||||
|
||||
// D <= alpha * A * B + beta * C, with A diagonal (stored as strvec)
|
||||
void dgemm_diag_left_lib(int m, int n, double alpha, double *dA, double *pB, int sdb, double beta, double *pC, int sdc, double *pD, int sdd); |
||||
void blasfeo_ref_dgemm_dn(int m, int n, double alpha, struct blasfeo_dvec *sA, int ai, struct blasfeo_dmat *sB, int bi, int bj, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= alpha * A * B + beta * C, with B diagonal (stored as strvec)
|
||||
void blasfeo_ref_dgemm_nd(int m, int n, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sB, int bi, double beta, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
|
||||
|
||||
|
||||
//
|
||||
// LAPACK
|
||||
//
|
||||
|
||||
// D <= chol( C ) ; C, D lower triangular
|
||||
void blasfeo_ref_dpotrf_l(int m, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
void blasfeo_ref_dpotrf_l_mn(int m, int n, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= chol( C ) ; C, D upper triangular
|
||||
void blasfeo_ref_dpotrf_u(int m, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= chol( C + A * B' ) ; C, D lower triangular
|
||||
void blasfeo_ref_dsyrk_dpotrf_ln(int m, int k, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
void blasfeo_ref_dsyrk_dpotrf_ln_mn(int m, int n, int k, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dmat *sB, int bi, int bj, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= lu( C ) ; no pivoting
|
||||
void blasfeo_ref_dgetrf_np(int m, int n, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj); |
||||
// D <= lu( C ) ; row pivoting
|
||||
void blasfeo_ref_dgetrf_rp(int m, int n, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj, int *ipiv); |
||||
// D <= qr( C )
|
||||
int blasfeo_ref_dgeqrf_worksize(int m, int n); // in bytes
|
||||
void blasfeo_ref_dgeqrf(int m, int n, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj, void *work); |
||||
// D <= Q factor, where C is the output of the LQ factorization
|
||||
int blasfeo_ref_dorglq_worksize(int m, int n, int k); // in bytes
|
||||
void blasfeo_ref_dorglq(int m, int n, int k, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj, void *work); |
||||
// D <= lq( C )
|
||||
void blasfeo_ref_dgelqf(int m, int n, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj, void *work); |
||||
int blasfeo_ref_dgelqf_worksize(int m, int n); // in bytes
|
||||
// D <= lq( C ), positive diagonal elements
|
||||
void blasfeo_ref_dgelqf_pd(int m, int n, struct blasfeo_dmat *sC, int ci, int cj, struct blasfeo_dmat *sD, int di, int dj, void *work); |
||||
// [L, A] <= lq( [L, A] ), positive diagonal elements, array of matrices, with
|
||||
// L lower triangular, of size (m)x(m)
|
||||
// A full, of size (m)x(n1)
|
||||
void blasfeo_ref_dgelqf_pd_la(int m, int n1, struct blasfeo_dmat *sL, int li, int lj, struct blasfeo_dmat *sA, int ai, int aj, void *work); |
||||
// [L, L, A] <= lq( [L, L, A] ), positive diagonal elements, array of matrices, with:
|
||||
// L lower triangular, of size (m)x(m)
|
||||
// A full, of size (m)x(n1)
|
||||
void blasfeo_ref_dgelqf_pd_lla(int m, int n1, struct blasfeo_dmat *sL0, int l0i, int l0j, struct blasfeo_dmat *sL1, int l1i, int l1j, struct blasfeo_dmat *sA, int ai, int aj, void *work); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_D_BLASFEO_REF_API_H_
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,69 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_I_AUX_EXT_DEP_H_ |
||||
#define BLASFEO_I_AUX_EXT_DEP_H_ |
||||
|
||||
|
||||
|
||||
#include "blasfeo_target.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
#ifdef EXT_DEP |
||||
|
||||
// i_aux_extern_depend_lib
|
||||
void int_zeros(int **pA, int row, int col); |
||||
void int_zeros_align(int **pA, int row, int col); |
||||
void int_free(int *pA); |
||||
void int_free_align(int *pA); |
||||
void int_print_mat(int row, int col, int *A, int lda); |
||||
int int_print_to_string_mat(char **buf_out, int row, int col, int *A, int lda); |
||||
|
||||
#endif // EXT_DEP
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_I_AUX_EXT_DEP_H_
|
@ -0,0 +1,57 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_M_AUX_H_ |
||||
#define BLASFEO_M_AUX_H_ |
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
void blasfeo_cvt_d2s_vec(int m, struct blasfeo_dvec *vd, int vdi, struct blasfeo_svec *vs, int vsi); |
||||
void blasfeo_cvt_s2d_vec(int m, struct blasfeo_svec *vs, int vsi, struct blasfeo_dvec *vd, int vdi); |
||||
void blasfeo_cvt_d2s_mat(int m, int n, struct blasfeo_dmat *Md, int mid, int nid, struct blasfeo_smat *Ms, int mis, int nis); |
||||
void blasfeo_cvt_s2d_mat(int m, int n, struct blasfeo_smat *Ms, int mis, int nis, struct blasfeo_dmat *Md, int mid, int nid); |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_M_AUX_H_
|
@ -0,0 +1,62 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2020 by Gianluca Frison. * |
||||
* All rights reserved. * |
||||
* * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
#ifndef BLASFEO_MEMORY_H_ |
||||
#define BLASFEO_MEMORY_H_ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
//
|
||||
int blasfeo_is_init(); |
||||
//
|
||||
void blasfeo_init(); |
||||
//
|
||||
void blasfeo_quit(); |
||||
//
|
||||
void *blasfeo_get_buffer(); |
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_MEMORY_H_
|
@ -0,0 +1,77 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
/*
|
||||
* ----------- Naming conventions |
||||
* |
||||
* (precision)(data) |
||||
* |
||||
* 1) d(double) |
||||
* s(single) |
||||
* |
||||
* 2) ge(general) |
||||
* tr(triangular) |
||||
* vec(vector) |
||||
* row(row) |
||||
* col(column) |
||||
* dia(diagonal) |
||||
* |
||||
* 3) se(set) |
||||
* cp(copy) |
||||
* sc(scale) |
||||
* ad(add) |
||||
* tr(transpose) |
||||
* in(insert) |
||||
* ex(extract) |
||||
* pe(premute) |
||||
* sw(swap) |
||||
* |
||||
* f(factorization) |
||||
* |
||||
* lqf(LQ factorization) |
||||
* qrf (factorization) |
||||
* trf (LU factorization using partial pivoting with row interchanges.) |
||||
* |
||||
* 4) _l(lower) / _u(upper) |
||||
* _lib8 (hp implementation, 8 rows kernel) |
||||
* _lib4 (hp implementation, 4 rows kernel) |
||||
* _lib0 (hp interface with reference implentation) |
||||
* _lib (reference implementation) |
||||
* _libref (reference implementation with dedicated namespace) |
||||
* |
||||
* 5) _sp(sparse) |
||||
* _exp(exponential format) |
||||
*/ |
@ -0,0 +1,88 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Ian McInerney * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_PROCESSOR_FEATURES_H_ |
||||
#define BLASFEO_PROCESSOR_FEATURES_H_ |
||||
|
||||
/**
|
||||
* Flags to indicate the different processor features |
||||
*/ |
||||
enum |
||||
{ |
||||
// x86-64 CPU features
|
||||
BLASFEO_PROCESSOR_FEATURE_AVX = 0x0001, /// AVX instruction set
|
||||
BLASFEO_PROCESSOR_FEATURE_AVX2 = 0x0002, /// AVX2 instruction set
|
||||
BLASFEO_PROCESSOR_FEATURE_FMA = 0x0004, /// FMA instruction set
|
||||
BLASFEO_PROCESSOR_FEATURE_SSE3 = 0x0008, /// SSE3 instruction set
|
||||
|
||||
// ARM CPU features
|
||||
BLASFEO_PROCESSOR_FEATURE_VFPv3 = 0x0100, /// VFPv3 instruction set
|
||||
BLASFEO_PROCESSOR_FEATURE_NEON = 0x0100, /// NEON instruction set
|
||||
BLASFEO_PROCESSOR_FEATURE_VFPv4 = 0x0100, /// VFPv4 instruction set
|
||||
BLASFEO_PROCESSOR_FEATURE_NEONv2 = 0x0100, /// NEONv2 instruction set
|
||||
} BLASFEO_PROCESSOR_FEATURES; |
||||
|
||||
/**
|
||||
* Test the features that this processor provides against what the library was compiled with. |
||||
* |
||||
* @param features - Pointer to an integer to store the supported feature set (using the flags in the BLASFEO_PROCESSOR_FEATURES enum) |
||||
* @return 0 if current processor doesn't support all features required for this library, 1 otherwise |
||||
*/ |
||||
int blasfeo_processor_cpu_features( int* features ); |
||||
|
||||
/**
|
||||
* Test the features that this processor provides against what the library was compiled with. |
||||
* |
||||
* @param features - Pointer to an integer to store the supported feature set (using the flags in the BLASFEO_PROCESSOR_FEATURES enum) |
||||
* @return 0 if current processor doesn't support all features required for this library, 1 otherwise |
||||
*/ |
||||
void blasfeo_processor_library_features( int* features ); |
||||
|
||||
/**
|
||||
* Create a string listing the features the current processor supports. |
||||
* |
||||
* @param features - Flags from the BLASFEO_PROCESSOR_FEATURES enum indicating the features supported |
||||
* @param featureString - Character array to store the feature string in |
||||
*/ |
||||
void blasfeo_processor_feature_string( int features, char* featureString ); |
||||
|
||||
/**
|
||||
* Get a string listing the processor features that this library version needs to run. |
||||
* |
||||
* @param featureString - Character array to store the feature string in |
||||
*/ |
||||
void blasfeo_processor_library_string( char* featureString ); |
||||
|
||||
#endif // BLASFEO_PROCESSOR_FEATURES_H_
|
@ -0,0 +1,166 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_S_AUX_H_ |
||||
#define BLASFEO_S_AUX_H_ |
||||
|
||||
|
||||
|
||||
#include <stdlib.h> |
||||
|
||||
#include "blasfeo_s_aux_old.h" |
||||
#include "blasfeo_common.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
/************************************************
|
||||
* d_aux_lib.c |
||||
************************************************/ |
||||
|
||||
// returns the memory size (in bytes) needed for a smat
|
||||
size_t blasfeo_memsize_smat(int m, int n); |
||||
size_t blasfeo_memsize_smat_ps(int ps, int m, int n); |
||||
// returns the memory size (in bytes) needed for the diagonal of a smat
|
||||
size_t blasfeo_memsize_diag_smat(int m, int n); |
||||
// returns the memory size (in bytes) needed for a svec
|
||||
size_t blasfeo_memsize_svec(int m); |
||||
// create a strmat for a matrix of size m*n by using memory passed by a pointer (pointer is not updated)
|
||||
void blasfeo_create_smat(int m, int n, struct blasfeo_smat *sA, void *memory); |
||||
void blasfeo_create_smat_ps(int ps, int m, int n, struct blasfeo_smat *sA, void *memory); |
||||
// create a strvec for a vector of size m by using memory passed by a pointer (pointer is not updated)
|
||||
void blasfeo_create_svec(int m, struct blasfeo_svec *sA, void *memory); |
||||
void blasfeo_pack_smat(int m, int n, float *A, int lda, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_pack_l_smat(int m, int n, float *A, int lda, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_pack_u_smat(int m, int n, float *A, int lda, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_pack_tran_smat(int m, int n, float *A, int lda, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_pack_svec(int m, float *x, int xi, struct blasfeo_svec *sa, int ai); |
||||
void blasfeo_unpack_smat(int m, int n, struct blasfeo_smat *sA, int ai, int aj, float *A, int lda); |
||||
void blasfeo_unpack_tran_smat(int m, int n, struct blasfeo_smat *sA, int ai, int aj, float *A, int lda); |
||||
void blasfeo_unpack_svec(int m, struct blasfeo_svec *sa, int ai, float *x, int xi); |
||||
//void s_cast_mat2strmat(float *A, struct blasfeo_smat *sA);
|
||||
//void s_cast_diag_mat2strmat(float *dA, struct blasfeo_smat *sA);
|
||||
//void s_cast_vec2vecmat(float *a, struct blasfeo_svec *sa);
|
||||
|
||||
// ge
|
||||
void blasfeo_sgese(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_sgecpsc(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_sgecp(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_sgesc(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_sgein1(float a, struct blasfeo_smat *sA, int ai, int aj); |
||||
float blasfeo_sgeex1(struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_sgead(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_sgetr(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
// tr
|
||||
void blasfeo_strcp_l(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_strtr_l(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_strtr_u(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
// dia
|
||||
void blasfeo_sdiare(int kmax, float alpha, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_sdiaex(int kmax, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_sdiain(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_sdiain_sp(int kmax, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_smat *sD, int di, int dj); |
||||
void blasfeo_sdiaex_sp(int kmax, float alpha, int *idx, struct blasfeo_smat *sD, int di, int dj, struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_sdiaad(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_sdiaad_sp(int kmax, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_smat *sD, int di, int dj); |
||||
void blasfeo_sdiaadin_sp(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sy, int yi, int *idx, struct blasfeo_smat *sD, int di, int dj); |
||||
// row
|
||||
void blasfeo_srowin(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_srowex(int kmax, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_srowad(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_srowad_sp(int kmax, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_smat *sD, int di, int dj); |
||||
void blasfeo_srowsw(int kmax, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_srowpe(int kmax, int *ipiv, struct blasfeo_smat *sA); |
||||
void blasfeo_srowpei(int kmax, int *ipiv, struct blasfeo_smat *sA); |
||||
// col
|
||||
void blasfeo_scolex(int kmax, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_scolin(int kmax, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_scolad(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_scolsc(int kmax, float alpha, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_scolsw(int kmax, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_scolpe(int kmax, int *ipiv, struct blasfeo_smat *sA); |
||||
void blasfeo_scolpei(int kmax, int *ipiv, struct blasfeo_smat *sA); |
||||
// vec
|
||||
void blasfeo_svecse(int m, float alpha, struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_sveccp(int m, struct blasfeo_svec *sa, int ai, struct blasfeo_svec *sc, int ci); |
||||
void blasfeo_svecsc(int m, float alpha, struct blasfeo_svec *sa, int ai); |
||||
void blasfeo_sveccpsc(int m, float alpha, struct blasfeo_svec *sa, int ai, struct blasfeo_svec *sc, int ci); |
||||
void blasfeo_svecad(int m, float alpha, struct blasfeo_svec *sa, int ai, struct blasfeo_svec *sc, int ci); |
||||
void blasfeo_svecin1(float a, struct blasfeo_svec *sx, int xi); |
||||
float blasfeo_svecex1(struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_svecad_sp(int m, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_svec *sz, int zi); |
||||
void blasfeo_svecin_sp(int m, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_svec *sz, int zi); |
||||
void blasfeo_svecex_sp(int m, float alpha, int *idx, struct blasfeo_svec *sx, int x, struct blasfeo_svec *sz, int zi); |
||||
void blasfeo_sveccl(int m, struct blasfeo_svec *sxm, int xim, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sxp, int xip, struct blasfeo_svec *sz, int zi); |
||||
void blasfeo_sveccl_mask(int m, struct blasfeo_svec *sxm, int xim, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sxp, int xip, struct blasfeo_svec *sz, int zi, struct blasfeo_svec *sm, int mi); |
||||
void blasfeo_svecze(int m, struct blasfeo_svec *sm, int mi, struct blasfeo_svec *sv, int vi, struct blasfeo_svec *se, int ei); |
||||
void blasfeo_svecnrm_inf(int m, struct blasfeo_svec *sx, int xi, float *ptr_norm); |
||||
void blasfeo_svecnrm_2(int m, struct blasfeo_svec *sx, int xi, float *ptr_norm); |
||||
void blasfeo_svecpe(int kmax, int *ipiv, struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_svecpei(int kmax, int *ipiv, struct blasfeo_svec *sx, int xi); |
||||
|
||||
|
||||
|
||||
/*
|
||||
* Explicitly panel-major matrix format |
||||
*/ |
||||
|
||||
// returns the memory size (in bytes) needed for a dmat
|
||||
size_t blasfeo_pm_memsize_smat(int ps, int m, int n); |
||||
// create a strmat for a matrix of size m*n by using memory passed by a pointer (pointer is not updated)
|
||||
void blasfeo_pm_create_smat(int ps, int m, int n, struct blasfeo_pm_smat *sA, void *memory); |
||||
|
||||
|
||||
|
||||
/*
|
||||
* Explicitly column-major matrix format |
||||
*/ |
||||
|
||||
// returns the memory size (in bytes) needed for a dmat
|
||||
size_t blasfeo_cm_memsize_smat(int m, int n); |
||||
// create a strmat for a matrix of size m*n by using memory passed by a pointer (pointer is not updated)
|
||||
void blasfeo_cm_create_smat(int m, int n, struct blasfeo_pm_smat *sA, void *memory); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_S_AUX_H_
|
@ -0,0 +1,141 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_S_AUX_EXT_DEP_H_ |
||||
#define BLASFEO_S_AUX_EXT_DEP_H_ |
||||
|
||||
|
||||
|
||||
#include <stdio.h> |
||||
|
||||
|
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
#ifdef EXT_DEP |
||||
|
||||
/************************************************
|
||||
* s_aux_extern_depend_lib.c |
||||
************************************************/ |
||||
|
||||
/* column-major matrices */ |
||||
|
||||
// dynamically allocate row*col floats of memory and set accordingly a pointer to float; set allocated memory to zero
|
||||
void s_zeros(float **pA, int row, int col); |
||||
// dynamically allocate row*col floats of memory aligned to 64-byte boundaries and set accordingly a pointer to float; set allocated memory to zero
|
||||
void s_zeros_align(float **pA, int row, int col); |
||||
// dynamically allocate size bytes of memory aligned to 64-byte boundaries and set accordingly a pointer to float; set allocated memory to zero
|
||||
void s_zeros_align_bytes(float **pA, int size); |
||||
// free the memory allocated by d_zeros
|
||||
void s_free(float *pA); |
||||
// free the memory allocated by d_zeros_align or d_zeros_align_bytes
|
||||
void s_free_align(float *pA); |
||||
// print a column-major matrix
|
||||
void s_print_mat(int m, int n, float *A, int lda); |
||||
// print the transposed of a column-major matrix
|
||||
void s_print_tran_mat(int row, int col, float *A, int lda); |
||||
// print to file a column-major matrix
|
||||
void s_print_to_file_mat(FILE *file, int row, int col, float *A, int lda); |
||||
// print to file a column-major matrix in exponential format
|
||||
void s_print_to_file_exp_mat(FILE *file, int row, int col, float *A, int lda); |
||||
// print to string a column-major matrix
|
||||
void s_print_to_string_mat(char **buf_out, int row, int col, float *A, int lda); |
||||
// print to file the transposed of a column-major matrix
|
||||
void s_print_tran_to_file_mat(FILE *file, int row, int col, float *A, int lda); |
||||
// print to file the transposed of a column-major matrix in exponential format
|
||||
void s_print_tran_to_file_exp_mat(FILE *file, int row, int col, float *A, int lda); |
||||
// print in exponential notation a column-major matrix
|
||||
void s_print_exp_mat(int m, int n, float *A, int lda); |
||||
// print in exponential notation the transposed of a column-major matrix
|
||||
void s_print_exp_tran_mat(int row, int col, float *A, int lda); |
||||
|
||||
/* strmat and strvec */ |
||||
|
||||
// create a strmat for a matrix of size m*n by dynamically allocating memory
|
||||
void blasfeo_allocate_smat(int m, int n, struct blasfeo_smat *sA); |
||||
// create a strvec for a vector of size m by dynamically allocating memory
|
||||
void blasfeo_allocate_svec(int m, struct blasfeo_svec *sa); |
||||
// free the memory allocated by blasfeo_allocate_dmat
|
||||
void blasfeo_free_smat(struct blasfeo_smat *sA); |
||||
// free the memory allocated by blasfeo_allocate_dvec
|
||||
void blasfeo_free_svec(struct blasfeo_svec *sa); |
||||
// print a strmat
|
||||
void blasfeo_print_smat(int m, int n, struct blasfeo_smat *sA, int ai, int aj); |
||||
// print in exponential notation a strmat
|
||||
void blasfeo_print_exp_smat(int m, int n, struct blasfeo_smat *sA, int ai, int aj); |
||||
// print to file a strmat
|
||||
void blasfeo_print_to_file_smat(FILE *file, int m, int n, struct blasfeo_smat *sA, int ai, int aj); |
||||
// print to file a strmat in exponential format
|
||||
void blasfeo_print_to_file_exp_smat(FILE *file, int m, int n, struct blasfeo_smat *sA, int ai, int aj); |
||||
// print to string a strmat
|
||||
void blasfeo_print_to_string_smat(char **buf_out, int m, int n, struct blasfeo_smat *sA, int ai, int aj); |
||||
// print the transpose of a strmat
|
||||
void blasfeo_print_tran_smat(int m, int n, struct blasfeo_smat *sA, int ai, int aj); |
||||
// print a strvec
|
||||
void blasfeo_print_svec(int m, struct blasfeo_svec *sa, int ai); |
||||
// print in exponential notation a strvec
|
||||
void blasfeo_print_exp_svec(int m, struct blasfeo_svec *sa, int ai); |
||||
// print to file a strvec
|
||||
void blasfeo_print_to_file_svec(FILE *file, int m, struct blasfeo_svec *sa, int ai); |
||||
// print to string a strvec
|
||||
void blasfeo_print_to_string_svec(char **buf_out, int m, struct blasfeo_svec *sa, int ai); |
||||
// print the transposed of a strvec
|
||||
void blasfeo_print_tran_svec(int m, struct blasfeo_svec *sa, int ai); |
||||
// print in exponential notation the transposed of a strvec
|
||||
void blasfeo_print_exp_tran_svec(int m, struct blasfeo_svec *sa, int ai); |
||||
// print to file the transposed of a strvec
|
||||
void blasfeo_print_to_file_tran_svec(FILE *file, int m, struct blasfeo_svec *sa, int ai); |
||||
// print to string the transposed of a strvec
|
||||
void blasfeo_print_to_string_tran_svec(char **buf_out, int m, struct blasfeo_svec *sa, int ai); |
||||
|
||||
#endif // EXT_DEP
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // BLASFEO_S_AUX_EXT_DEP_H_
|
@ -0,0 +1,82 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_S_AUX_EXT_DEP_REF_H_ |
||||
#define BLASFEO_S_AUX_EXT_DEP_REF_H_ |
||||
|
||||
#if defined(EXT_DEP) |
||||
|
||||
|
||||
|
||||
#include <stdio.h> |
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
// expose reference BLASFEO for testing
|
||||
// see blasfeo_s_aux_exp_dep.h for help
|
||||
|
||||
void blasfeo_print_smat_ref(int m, int n, struct blasfeo_smat_ref *sA, int ai, int aj); |
||||
void blasfeo_allocate_smat_ref(int m, int n, struct blasfeo_smat_ref *sA); |
||||
void blasfeo_allocate_svec_ref(int m, struct blasfeo_svec_ref *sa); |
||||
void blasfeo_free_smat_ref(struct blasfeo_smat_ref *sA); |
||||
void blasfeo_free_svec_ref(struct blasfeo_svec_ref *sa); |
||||
void blasfeo_print_smat_ref(int m, int n, struct blasfeo_smat_ref *sA, int ai, int aj); |
||||
void blasfeo_print_exp_smat_ref(int m, int n, struct blasfeo_smat_ref *sA, int ai, int aj); |
||||
void blasfeo_print_to_file_smat_ref(FILE *file, int m, int n, struct blasfeo_smat_ref *sA, int ai, int aj); |
||||
void blasfeo_print_to_file_exp_smat_ref(FILE *file, int m, int n, struct blasfeo_smat_ref *sA, int ai, int aj); |
||||
void blasfeo_print_to_string_smat_ref(char **buf_out, int m, int n, struct blasfeo_smat_ref *sA, int ai, int aj); |
||||
void blasfeo_print_svec(int m, struct blasfeo_svec *sa, int ai); |
||||
void blasfeo_print_exp_svec(int m, struct blasfeo_svec *sa, int ai); |
||||
void blasfeo_print_to_file_svec(FILE *file, int m, struct blasfeo_svec *sa, int ai); |
||||
void blasfeo_print_to_string_svec(char **buf_out, int m, struct blasfeo_svec *sa, int ai); |
||||
void blasfeo_print_tran_svec(int m, struct blasfeo_svec *sa, int ai); |
||||
void blasfeo_print_exp_tran_svec(int m, struct blasfeo_svec *sa, int ai); |
||||
void blasfeo_print_to_file_tran_svec(FILE *file, int m, struct blasfeo_svec *sa, int ai); |
||||
void blasfeo_print_to_string_tran_svec(char **buf_out, int m, struct blasfeo_svec *sa, int ai); |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // EXT_DEP
|
||||
|
||||
#endif // BLASFEO_S_AUX_EXT_DEP_REF_H_
|
@ -0,0 +1,64 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
// TODO remove
|
||||
//
|
||||
void strcp_l_lib(int m, float alpha, int offsetA, float *A, int sda, int offsetB, float *B, int sdb); |
||||
void sgead_lib(int m, int n, float alpha, int offsetA, float *A, int sda, int offsetB, float *B, int sdb); |
||||
void sgetr_lib(int m, int n, float alpha, int offsetA, float *pA, int sda, int offsetC, float *pC, int sdc); |
||||
void strtr_l_lib(int m, float alpha, int offsetA, float *pA, int sda, int offsetC, float *pC, int sdc); |
||||
void strtr_u_lib(int m, float alpha, int offsetA, float *pA, int sda, int offsetC, float *pC, int sdc); |
||||
void sdiareg_lib(int kmax, float reg, int offset, float *pD, int sdd); |
||||
void sdiain_sqrt_lib(int kmax, float *x, int offset, float *pD, int sdd); |
||||
void sdiaex_lib(int kmax, float alpha, int offset, float *pD, int sdd, float *x); |
||||
void sdiaad_lib(int kmax, float alpha, float *x, int offset, float *pD, int sdd); |
||||
void sdiain_libsp(int kmax, int *idx, float alpha, float *x, float *pD, int sdd); |
||||
void sdiaex_libsp(int kmax, int *idx, float alpha, float *pD, int sdd, float *x); |
||||
void sdiaad_libsp(int kmax, int *idx, float alpha, float *x, float *pD, int sdd); |
||||
void sdiaadin_libsp(int kmax, int *idx, float alpha, float *x, float *y, float *pD, int sdd); |
||||
void srowin_lib(int kmax, float alpha, float *x, float *pD); |
||||
void srowex_lib(int kmax, float alpha, float *pD, float *x); |
||||
void srowad_lib(int kmax, float alpha, float *x, float *pD); |
||||
void srowin_libsp(int kmax, float alpha, int *idx, float *x, float *pD); |
||||
void srowad_libsp(int kmax, int *idx, float alpha, float *x, float *pD); |
||||
void srowadin_libsp(int kmax, int *idx, float alpha, float *x, float *y, float *pD); |
||||
void srowsw_lib(int kmax, float *pA, float *pC); |
||||
void scolin_lib(int kmax, float *x, int offset, float *pD, int sdd); |
||||
void scolad_lib(int kmax, float alpha, float *x, int offset, float *pD, int sdd); |
||||
void scolin_libsp(int kmax, int *idx, float *x, float *pD, int sdd); |
||||
void scolad_libsp(int kmax, float alpha, int *idx, float *x, float *pD, int sdd); |
||||
void scolsw_lib(int kmax, int offsetA, float *pA, int sda, int offsetC, float *pC, int sdc); |
||||
void svecin_libsp(int kmax, int *idx, float *x, float *y); |
||||
void svecad_libsp(int kmax, int *idx, float alpha, float *x, float *y); |
@ -0,0 +1,145 @@ |
||||
|
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_S_AUX_REF_H_ |
||||
#define BLASFEO_S_AUX_REF_H_ |
||||
|
||||
|
||||
|
||||
#include <stdlib.h> |
||||
|
||||
#include "blasfeo_s_aux_old.h" |
||||
#include "blasfeo_common.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
/************************************************
|
||||
* d_aux_lib.c |
||||
************************************************/ |
||||
|
||||
// returns the memory size (in bytes) needed for a smat
|
||||
size_t blasfeo_ref_memsize_smat(int m, int n); |
||||
size_t blasfeo_ref_memsize_smat_ps(int ps, int m, int n); |
||||
// returns the memory size (in bytes) needed for the diagonal of a smat
|
||||
size_t blasfeo_ref_memsize_diag_smat(int m, int n); |
||||
// returns the memory size (in bytes) needed for a svec
|
||||
size_t blasfeo_ref_memsize_svec(int m); |
||||
// create a strmat for a matrix of size m*n by using memory passed by a pointer (pointer is not updated)
|
||||
void blasfeo_ref_create_smat(int m, int n, struct blasfeo_smat *sA, void *memory); |
||||
void blasfeo_ref_create_smat_ps(int ps, int m, int n, struct blasfeo_smat *sA, void *memory); |
||||
// create a strvec for a vector of size m by using memory passed by a pointer (pointer is not updated)
|
||||
void blasfeo_ref_create_svec(int m, struct blasfeo_svec *sA, void *memory); |
||||
void blasfeo_ref_pack_smat(int m, int n, float *A, int lda, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_ref_pack_l_smat(int m, int n, float *A, int lda, struct blasfeo_smat *sB, int bi, int bj); |
||||
void blasfeo_ref_pack_l_smat(int m, int n, float *A, int lda, struct blasfeo_smat *sB, int bi, int bj); |
||||
void blasfeo_ref_pack_tran_smat(int m, int n, float *A, int lda, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_ref_pack_svec(int m, float *x, int xi, struct blasfeo_svec *sa, int ai); |
||||
void blasfeo_ref_unpack_smat(int m, int n, struct blasfeo_smat *sA, int ai, int aj, float *A, int lda); |
||||
void blasfeo_ref_unpack_tran_smat(int m, int n, struct blasfeo_smat *sA, int ai, int aj, float *A, int lda); |
||||
void blasfeo_ref_unpack_svec(int m, struct blasfeo_svec *sa, int ai, float *x, int xi); |
||||
void ref_s_cast_mat2strmat(float *A, struct blasfeo_smat *sA); |
||||
void ref_s_cast_diag_mat2strmat(float *dA, struct blasfeo_smat *sA); |
||||
void ref_s_cast_vec2vecmat(float *a, struct blasfeo_svec *sa); |
||||
|
||||
// ge
|
||||
void blasfeo_ref_sgese(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_ref_sgecpsc(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_ref_sgecp(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_ref_sgesc(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_ref_sgein1(float a, struct blasfeo_smat *sA, int ai, int aj); |
||||
float blasfeo_ref_sgeex1(struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_ref_sgead(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_ref_sgetr(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
// tr
|
||||
void blasfeo_ref_strcp_l(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_ref_strtr_l(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_ref_strtr_u(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
// dia
|
||||
void blasfeo_ref_sdiare(int kmax, float alpha, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_ref_sdiaex(int kmax, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_ref_sdiain(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_ref_sdiain_sp(int kmax, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_smat *sD, int di, int dj); |
||||
void blasfeo_ref_sdiaex_sp(int kmax, float alpha, int *idx, struct blasfeo_smat *sD, int di, int dj, struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_ref_sdiaad(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_ref_sdiaad_sp(int kmax, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_smat *sD, int di, int dj); |
||||
void blasfeo_ref_sdiaadin_sp(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sy, int yi, int *idx, struct blasfeo_smat *sD, int di, int dj); |
||||
// row
|
||||
void blasfeo_ref_srowin(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_ref_srowex(int kmax, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_ref_srowad(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_ref_srowad_sp(int kmax, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_smat *sD, int di, int dj); |
||||
void blasfeo_ref_srowsw(int kmax, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_ref_srowpe(int kmax, int *ipiv, struct blasfeo_smat *sA); |
||||
void blasfeo_ref_srowpei(int kmax, int *ipiv, struct blasfeo_smat *sA); |
||||
// col
|
||||
void blasfeo_ref_scolex(int kmax, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_ref_scolin(int kmax, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_ref_scolad(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_ref_scolsc(int kmax, float alpha, struct blasfeo_smat *sA, int ai, int aj); |
||||
void blasfeo_ref_scolsw(int kmax, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void blasfeo_ref_scolpe(int kmax, int *ipiv, struct blasfeo_smat *sA); |
||||
void blasfeo_ref_scolpei(int kmax, int *ipiv, struct blasfeo_smat *sA); |
||||
// vec
|
||||
void blasfeo_ref_svecse(int m, float alpha, struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_ref_sveccp(int m, struct blasfeo_svec *sa, int ai, struct blasfeo_svec *sc, int ci); |
||||
void blasfeo_ref_svecsc(int m, float alpha, struct blasfeo_svec *sa, int ai); |
||||
void blasfeo_ref_sveccpsc(int m, float alpha, struct blasfeo_svec *sa, int ai, struct blasfeo_svec *sc, int ci); |
||||
void blasfeo_ref_svecad(int m, float alpha, struct blasfeo_svec *sa, int ai, struct blasfeo_svec *sc, int ci); |
||||
void blasfeo_ref_svecin1(float a, struct blasfeo_svec *sx, int xi); |
||||
float blasfeo_ref_svecex1(struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_ref_svecad_sp(int m, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_svec *sz, int zi); |
||||
void blasfeo_ref_svecin_sp(int m, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_svec *sz, int zi); |
||||
void blasfeo_ref_svecex_sp(int m, float alpha, int *idx, struct blasfeo_svec *sx, int x, struct blasfeo_svec *sz, int zi); |
||||
void blasfeo_ref_sveccl(int m, struct blasfeo_svec *sxm, int xim, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sxp, int xip, struct blasfeo_svec *sz, int zi); |
||||
void blasfeo_ref_sveccl_mask(int m, struct blasfeo_svec *sxm, int xim, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sxp, int xip, struct blasfeo_svec *sz, int zi, struct blasfeo_svec *sm, int mi); |
||||
void blasfeo_ref_svecze(int m, struct blasfeo_svec *sm, int mi, struct blasfeo_svec *sv, int vi, struct blasfeo_svec *se, int ei); |
||||
void blasfeo_ref_svecnrm_inf(int m, struct blasfeo_svec *sx, int xi, float *ptr_norm); |
||||
void blasfeo_ref_svecpe(int kmax, int *ipiv, struct blasfeo_svec *sx, int xi); |
||||
void blasfeo_ref_svecpei(int kmax, int *ipiv, struct blasfeo_svec *sx, int xi); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_S_AUX_REF_H_
|
||||
|
@ -0,0 +1,177 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_S_AUX_TEST_H_ |
||||
#define BLASFEO_S_AUX_TEST_H_ |
||||
|
||||
#include <stdio.h> |
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
/************************************************
|
||||
* d_aux_lib.c |
||||
************************************************/ |
||||
|
||||
int test_blasfeo_memsize_smat(int m, int n); |
||||
int test_blasfeo_memsize_diag_smat(int m, int n); |
||||
int test_blasfeo_memsize_svec(int m); |
||||
|
||||
void test_blasfeo_create_smat(int m, int n, struct blasfeo_smat *sA, void *memory); |
||||
void test_blasfeo_create_svec(int m, struct blasfeo_svec *sA, void *memory); |
||||
|
||||
void test_blasfeo_pack_smat(int m, int n, float *A, int lda, struct blasfeo_smat *sA, int ai, int aj); |
||||
void test_blasfeo_pack_svec(int m, float *x, int xi, struct blasfeo_svec *sa, int ai); |
||||
void test_blasfeo_pack_tran_smat(int m, int n, float *A, int lda, struct blasfeo_smat *sA, int ai, int aj); |
||||
void test_blasfeo_unpack_smat(int m, int n, struct blasfeo_smat *sA, int ai, int aj, float *A, int lda); |
||||
void test_blasfeo_unpack_svec(int m, struct blasfeo_svec *sa, int ai, float *x, int xi); |
||||
void test_blasfeo_unpack_tran_smat(int m, int n, struct blasfeo_smat *sA, int ai, int aj, float *A, int lda); |
||||
|
||||
void test_s_cast_mat2strmat(float *A, struct blasfeo_smat *sA); |
||||
void test_s_cast_diag_mat2strmat(float *dA, struct blasfeo_smat *sA); |
||||
void test_s_cast_vec2vecmat(float *a, struct blasfeo_svec *sa); |
||||
// copy and scale
|
||||
void test_blasfeo_sgecpsc(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void test_blasfeo_sgecp(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj); |
||||
void test_blasfeo_sgesc(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj); |
||||
|
||||
// void test_blasfeo_sgein1(float a, struct blasfeo_smat *sA, int ai, int aj);
|
||||
// float test_blasfeo_sgeex1(struct blasfeo_smat *sA, int ai, int aj);
|
||||
// void test_blasfeo_svecin1(float a, struct blasfeo_svec *sx, int xi);
|
||||
// float test_blasfeo_svecex1(struct blasfeo_svec *sx, int xi);
|
||||
|
||||
// // A <= alpha
|
||||
// void test_blasfeo_sgese(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj);
|
||||
// // a <= alpha
|
||||
// void test_blasfeo_svecse(int m, float alpha, struct blasfeo_svec *sx, int xi);
|
||||
|
||||
|
||||
// void test_blasfeo_sveccp(int m, struct blasfeo_svec *sa, int ai, struct blasfeo_svec *sc, int ci);
|
||||
// void test_blasfeo_svecsc(int m, float alpha, struct blasfeo_svec *sa, int ai);
|
||||
|
||||
// void test_strcp_l_lib(int m, float alpha, int offsetA, float *A, int sda, int offsetB, float *B, int sdb);
|
||||
// void test_blasfeo_strcp_l(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj);
|
||||
|
||||
// void test_sgead_lib(int m, int n, float alpha, int offsetA, float *A, int sda, int offsetB, float *B, int sdb);
|
||||
// void test_blasfeo_sgead(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj);
|
||||
// void test_blasfeo_svecad(int m, float alpha, struct blasfeo_svec *sa, int ai, struct blasfeo_svec *sc, int ci);
|
||||
|
||||
// void test_sgetr_lib(int m, int n, float alpha, int offsetA, float *pA, int sda, int offsetC, float *pC, int sdc);
|
||||
// void test_blasfeo_sgetr(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj);
|
||||
|
||||
// void test_strtr_l_lib(int m, float alpha, int offsetA, float *pA, int sda, int offsetC, float *pC, int sdc);
|
||||
// void test_blasfeo_strtr_l(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj);
|
||||
// void test_strtr_u_lib(int m, float alpha, int offsetA, float *pA, int sda, int offsetC, float *pC, int sdc);
|
||||
// void test_blasfeo_strtr_u(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj);
|
||||
|
||||
// void test_sdiareg_lib(int kmax, float reg, int offset, float *pD, int sdd);
|
||||
// void test_blasfeo_sdiaex(int kmax, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi);
|
||||
// void test_blasfeo_sdiain(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj);
|
||||
// void test_sdiain_sqrt_lib(int kmax, float *x, int offset, float *pD, int sdd);
|
||||
// void test_sdiaex_lib(int kmax, float alpha, int offset, float *pD, int sdd, float *x);
|
||||
// void test_sdiaad_lib(int kmax, float alpha, float *x, int offset, float *pD, int sdd);
|
||||
// void test_sdiain_libsp(int kmax, int *idx, float alpha, float *x, float *pD, int sdd);
|
||||
// void test_blasfeo_sdiain_sp(int kmax, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_smat *sD, int di, int dj);
|
||||
// void test_sdiaex_libsp(int kmax, int *idx, float alpha, float *pD, int sdd, float *x);
|
||||
// void test_blasfeo_sdiaex_sp(int kmax, float alpha, int *idx, struct blasfeo_smat *sD, int di, int dj, struct blasfeo_svec *sx, int xi);
|
||||
// void test_blasfeo_sdiaad(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj);
|
||||
// void test_sdiaad_libsp(int kmax, int *idx, float alpha, float *x, float *pD, int sdd);
|
||||
// void test_blasfeo_sdiaad_sp(int kmax, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_smat *sD, int di, int dj);
|
||||
// void test_sdiaadin_libsp(int kmax, int *idx, float alpha, float *x, float *y, float *pD, int sdd);
|
||||
// void test_blasfeo_sdiaadin_sp(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sy, int yi, int *idx, struct blasfeo_smat *sD, int di, int dj);
|
||||
// void test_srowin_lib(int kmax, float alpha, float *x, float *pD);
|
||||
// void test_blasfeo_srowin(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj);
|
||||
// void test_srowex_lib(int kmax, float alpha, float *pD, float *x);
|
||||
// void test_blasfeo_srowex(int kmax, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi);
|
||||
// void test_srowad_lib(int kmax, float alpha, float *x, float *pD);
|
||||
// void test_blasfeo_srowad(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj);
|
||||
// void test_srowin_libsp(int kmax, float alpha, int *idx, float *x, float *pD);
|
||||
// void test_srowad_libsp(int kmax, int *idx, float alpha, float *x, float *pD);
|
||||
// void test_blasfeo_srowad_sp(int kmax, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_smat *sD, int di, int dj);
|
||||
// void test_srowadin_libsp(int kmax, int *idx, float alpha, float *x, float *y, float *pD);
|
||||
// void test_srowsw_lib(int kmax, float *pA, float *pC);
|
||||
// void test_blasfeo_srowsw(int kmax, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj);
|
||||
// void test_blasfeo_srowpe(int kmax, int *ipiv, struct blasfeo_smat *sA);
|
||||
// void test_scolin_lib(int kmax, float *x, int offset, float *pD, int sdd);
|
||||
// void test_blasfeo_scolin(int kmax, struct blasfeo_svec *sx, int xi, struct blasfeo_smat *sA, int ai, int aj);
|
||||
// void test_scolad_lib(int kmax, float alpha, float *x, int offset, float *pD, int sdd);
|
||||
// void test_scolin_libsp(int kmax, int *idx, float *x, float *pD, int sdd);
|
||||
// void test_scolad_libsp(int kmax, float alpha, int *idx, float *x, float *pD, int sdd);
|
||||
// void test_scolsw_lib(int kmax, int offsetA, float *pA, int sda, int offsetC, float *pC, int sdc);
|
||||
// void test_blasfeo_scolsw(int kmax, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sC, int ci, int cj);
|
||||
// void test_blasfeo_scolpe(int kmax, int *ipiv, struct blasfeo_smat *sA);
|
||||
// void test_svecin_libsp(int kmax, int *idx, float *x, float *y);
|
||||
// void test_svecad_libsp(int kmax, int *idx, float alpha, float *x, float *y);
|
||||
// void test_blasfeo_svecad_sp(int m, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_svec *sz, int zi);
|
||||
// void test_blasfeo_svecin_sp(int m, float alpha, struct blasfeo_svec *sx, int xi, int *idx, struct blasfeo_svec *sz, int zi);
|
||||
// void test_blasfeo_svecex_sp(int m, float alpha, int *idx, struct blasfeo_svec *sx, int x, struct blasfeo_svec *sz, int zi);
|
||||
// void test_blasfeo_sveccl(int m, struct blasfeo_svec *sxm, int xim, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sxp, int xip, struct blasfeo_svec *sz, int zi);
|
||||
// void test_blasfeo_sveccl_mask(int m, struct blasfeo_svec *sxm, int xim, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sxp, int xip, struct blasfeo_svec *sz, int zi, struct blasfeo_svec *sm, int mi);
|
||||
// void test_blasfeo_svecze(int m, struct blasfeo_svec *sm, int mi, struct blasfeo_svec *sv, int vi, struct blasfeo_svec *se, int ei);
|
||||
// void test_blasfeo_svecnrm_inf(int m, struct blasfeo_svec *sx, int xi, float *ptr_norm);
|
||||
// void test_blasfeo_svecpe(int kmax, int *ipiv, struct blasfeo_svec *sx, int xi);
|
||||
|
||||
|
||||
// ext_dep
|
||||
|
||||
void test_blasfeo_allocate_smat(int m, int n, struct blasfeo_smat *sA); |
||||
void test_blasfeo_allocate_svec(int m, struct blasfeo_svec *sa); |
||||
|
||||
void test_blasfeo_free_smat(struct blasfeo_smat *sA); |
||||
void test_blasfeo_free_svec(struct blasfeo_svec *sa); |
||||
|
||||
void test_blasfeo_print_smat(int m, int n, struct blasfeo_smat *sA, int ai, int aj); |
||||
void test_blasfeo_print_svec(int m, struct blasfeo_svec *sa, int ai); |
||||
void test_blasfeo_print_tran_svec(int m, struct blasfeo_svec *sa, int ai); |
||||
|
||||
void test_blasfeo_print_to_file_smat(FILE *file, int m, int n, struct blasfeo_smat *sA, int ai, int aj); |
||||
void test_blasfeo_print_to_file_svec(FILE *file, int m, struct blasfeo_svec *sa, int ai); |
||||
void test_blasfeo_print_to_file_tran_svec(FILE *file, int m, struct blasfeo_svec *sa, int ai); |
||||
|
||||
void test_blasfeo_print_exp_smat(int m, int n, struct blasfeo_smat *sA, int ai, int aj); |
||||
void test_blasfeo_print_exp_svec(int m, struct blasfeo_svec *sa, int ai); |
||||
void test_blasfeo_print_exp_tran_svec(int m, struct blasfeo_svec *sa, int ai); |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_S_AUX_TEST_H_
|
@ -0,0 +1,46 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_S_BLAS_H_ |
||||
#define BLASFEO_S_BLAS_H_ |
||||
|
||||
|
||||
|
||||
#include "blasfeo_s_blasfeo_api.h" |
||||
#include "blasfeo_s_blas_api.h" |
||||
|
||||
|
||||
|
||||
#endif // BLASFEO_S_BLAS_H_
|
@ -0,0 +1,117 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef BLASFEO_S_BLAS_API_H_ |
||||
#define BLASFEO_S_BLAS_API_H_ |
||||
|
||||
|
||||
|
||||
#include "blasfeo_target.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
#ifdef BLAS_API |
||||
|
||||
|
||||
|
||||
#ifdef FORTRAN_BLAS_API |
||||
|
||||
|
||||
|
||||
// BLAS 1
|
||||
//
|
||||
void saxpy_(int *n, float *alpha, float *x, int *incx, float *y, int *incy); |
||||
//
|
||||
float sdot_(int *n, float *x, int *incx, float *y, int *incy); |
||||
|
||||
// BLAS 3
|
||||
//
|
||||
void sgemm_(char *ta, char *tb, int *m, int *n, int *k, float *alpha, float *A, int *lda, float *B, int *ldb, float *beta, float *C, int *ldc); |
||||
//
|
||||
void strsm_(char *side, char *uplo, char *transa, char *diag, int *m, int *n, float *alpha, float *A, int *lda, float *B, int *ldb); |
||||
|
||||
|
||||
|
||||
// LAPACK
|
||||
//
|
||||
void spotrf_(char *uplo, int *m, float *A, int *lda, int *info); |
||||
|
||||
|
||||
|
||||
#else // BLASFEO_API
|
||||
|
||||
|
||||
|
||||
// BLAS 1
|
||||
//
|
||||
void blas_saxpy(int *n, float *alpha, float *x, int *incx, float *y, int *incy); |
||||
//
|
||||
float blas_sdot(int *n, float *x, int *incx, float *y, int *incy); |
||||
|
||||
// BLAS 3
|
||||
//
|
||||
void blas_sgemm(char *ta, char *tb, int *m, int *n, int *k, float *alpha, float *A, int *lda, float *B, int *ldb, float *beta, float *C, int *ldc); |
||||
//
|
||||
void blas_strsm(char *side, char *uplo, char *transa, char *diag, int *m, int *n, float *alpha, float *A, int *lda, float *B, int *ldb); |
||||
|
||||
|
||||
|
||||
// LAPACK
|
||||
//
|
||||
void blas_spotrf(char *uplo, int *m, float *A, int *lda, int *info); |
||||
|
||||
|
||||
|
||||
#endif // BLASFEO_API
|
||||
|
||||
|
||||
|
||||
#endif // BLAS_API
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_S_BLAS_API_H_
|
@ -0,0 +1,268 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_S_BLASFEO_API_H_ |
||||
#define BLASFEO_S_BLASFEO_API_H_ |
||||
|
||||
|
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
//
|
||||
// level 1 BLAS
|
||||
//
|
||||
|
||||
// z = y + alpha*x
|
||||
void blasfeo_saxpy(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// z = beta*y + alpha*x
|
||||
void blasfeo_saxpby(int kmax, float alpha, struct blasfeo_svec *sx, int xi, float beta, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// z = x .* y
|
||||
void blasfeo_svecmul(int m, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// z += x .* y
|
||||
void blasfeo_svecmulacc(int m, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// z = x .* y, return sum(z) = x^T * y
|
||||
float blasfeo_svecmuldot(int m, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// return x^T * y
|
||||
float blasfeo_sdot(int m, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sy, int yi); |
||||
// construct givens plane rotation
|
||||
void blasfeo_srotg(float a, float b, float *c, float *s); |
||||
// apply plane rotation [a b] [c -s; s; c] to the aj0 and aj1 columns of A at row index ai
|
||||
void blasfeo_scolrot(int m, struct blasfeo_smat *sA, int ai, int aj0, int aj1, float c, float s); |
||||
// apply plane rotation [c s; -s c] [a; b] to the ai0 and ai1 rows of A at column index aj
|
||||
void blasfeo_srowrot(int m, struct blasfeo_smat *sA, int ai0, int ai1, int aj, float c, float s); |
||||
|
||||
|
||||
|
||||
//
|
||||
// level 2 BLAS
|
||||
//
|
||||
|
||||
// dense
|
||||
|
||||
// z <= beta * y + alpha * A * x
|
||||
void blasfeo_sgemv_n(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, float beta, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// z <= beta * y + alpha * A' * x
|
||||
void blasfeo_sgemv_t(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, float beta, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A ) * x, A (m)x(n)
|
||||
void blasfeo_strsv_lnn_mn(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(n)
|
||||
void blasfeo_strsv_ltn_mn(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A ) * x, A (m)x(m) lower, not_transposed, not_unit
|
||||
void blasfeo_strsv_lnn(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A ) * x, A (m)x(m) lower, not_transposed, unit
|
||||
void blasfeo_strsv_lnu(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(m) lower, transposed, not_unit
|
||||
void blasfeo_strsv_ltn(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(m) lower, transposed, unit
|
||||
void blasfeo_strsv_ltu(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(m) upper, not_transposed, not_unit
|
||||
void blasfeo_strsv_unn(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(m) upper, transposed, not_unit
|
||||
void blasfeo_strsv_utn(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= beta * y + alpha * A * x ; A upper triangular
|
||||
void blasfeo_strmv_unn(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= A' * x ; A upper triangular
|
||||
void blasfeo_strmv_utn(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= A * x ; A lower triangular
|
||||
void blasfeo_strmv_lnn(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= A' * x ; A lower triangular
|
||||
void blasfeo_strmv_ltn(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z_n <= beta_n * y_n + alpha_n * A * x_n
|
||||
// z_t <= beta_t * y_t + alpha_t * A' * x_t
|
||||
void blasfeo_sgemv_nt(int m, int n, float alpha_n, float alpha_t, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx_n, int xi_n, struct blasfeo_svec *sx_t, int xi_t, float beta_n, float beta_t, struct blasfeo_svec *sy_n, int yi_n, struct blasfeo_svec *sy_t, int yi_t, struct blasfeo_svec *sz_n, int zi_n, struct blasfeo_svec *sz_t, int zi_t); |
||||
// z <= beta * y + alpha * A * x, where A is symmetric and only the lower triangular patr of A is accessed
|
||||
void blasfeo_ssymv_l(int m, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, float beta, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
void blasfeo_ssymv_l_mn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, float beta, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
|
||||
// diagonal
|
||||
|
||||
// z <= beta * y + alpha * A * x, A diagonal
|
||||
void blasfeo_sgemv_d(int m, float alpha, struct blasfeo_svec *sA, int ai, struct blasfeo_svec *sx, int xi, float beta, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
|
||||
|
||||
|
||||
//
|
||||
// level 3 BLAS
|
||||
//
|
||||
|
||||
// dense
|
||||
|
||||
// D <= beta * C + alpha * A * B
|
||||
void blasfeo_sgemm_nn(int m, int n, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A * B^T
|
||||
void blasfeo_sgemm_nt(int m, int n, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B
|
||||
void blasfeo_sgemm_tn(int m, int n, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B
|
||||
void blasfeo_sgemm_tt(int m, int n, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A * B^T ; C, D lower triangular
|
||||
void blasfeo_ssyrk_ln(int m, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
void blasfeo_ssyrk_ln_mn(int m, int n, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B ; C, D lower triangular
|
||||
void blasfeo_ssyrk_lt(int m, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A * B^T ; C, D upper triangular
|
||||
void blasfeo_ssyrk_un(int m, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B ; C, D upper triangular
|
||||
void blasfeo_ssyrk_ut(int m, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^T ; B upper triangular
|
||||
void blasfeo_strmm_rutn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A ; A lower triangular
|
||||
void blasfeo_strmm_rlnn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A lower triangular employint explicit inverse of diagonal
|
||||
void blasfeo_strsm_llnn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A lower triangular with unit diagonal
|
||||
void blasfeo_strsm_llnu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A lower triangular employint explicit inverse of diagonal
|
||||
void blasfeo_strsm_lltn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A lower triangular with unit diagonal
|
||||
void blasfeo_strsm_lltu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_strsm_lunn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A upper triangular withunit diagonal
|
||||
void blasfeo_strsm_lunu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_strsm_lutn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A upper triangular withunit diagonal
|
||||
void blasfeo_strsm_lutu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A lower triangular employing explicit inverse of diagonal
|
||||
void blasfeo_strsm_rlnn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A lower triangular with unit diagonal
|
||||
void blasfeo_strsm_rlnu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A lower triangular employing explicit inverse of diagonal
|
||||
void blasfeo_strsm_rltn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A lower triangular with unit diagonal
|
||||
void blasfeo_strsm_rltu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_strsm_runn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A upper triangular with unit diagonal
|
||||
void blasfeo_strsm_runu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_strsm_rutn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A upper triangular with unit diagonal
|
||||
void blasfeo_strsm_rutu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
|
||||
// diagonal
|
||||
|
||||
// D <= alpha * A * B + beta * C, with A diagonal (stored as strvec)
|
||||
void sgemm_diag_left_ib(int m, int n, float alpha, float *dA, float *pB, int sdb, float beta, float *pC, int sdc, float *pD, int sdd); |
||||
void blasfeo_sgemm_dn(int m, int n, float alpha, struct blasfeo_svec *sA, int ai, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A * B + beta * C, with B diagonal (stored as strvec)
|
||||
void blasfeo_sgemm_nd(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sB, int bi, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
|
||||
|
||||
|
||||
//
|
||||
// LAPACK
|
||||
//
|
||||
|
||||
// D <= chol( C ) ; C, D lower triangular
|
||||
void blasfeo_spotrf_l(int m, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
void blasfeo_spotrf_l_mn(int m, int n, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= chol( C ) ; C, D upper triangular
|
||||
void blasfeo_spotrf_u(int m, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= chol( C + A * B' ) ; C, D lower triangular
|
||||
void blasfeo_ssyrk_spotrf_ln(int m, int k, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
void blasfeo_ssyrk_spotrf_ln_mn(int m, int n, int k, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= lu( C ) ; no pivoting
|
||||
void blasfeo_sgetrf_np(int m, int n, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= lu( C ) ; row pivoting
|
||||
void blasfeo_sgetrf_rp(int m, int n, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj, int *ipiv); |
||||
// D <= qr( C )
|
||||
void blasfeo_sgeqrf(int m, int n, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj, void *work); |
||||
int blasfeo_sgeqrf_worksize(int m, int n); // in bytes
|
||||
// D <= Q factor, where C is the output of the LQ factorization
|
||||
int blasfeo_sorglq_worksize(int m, int n, int k); // in bytes
|
||||
void blasfeo_sorglq(int m, int n, int k, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj, void *work); |
||||
// D <= lq( C )
|
||||
void blasfeo_sgelqf(int m, int n, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj, void *work); |
||||
int blasfeo_sgelqf_worksize(int m, int n); // in bytes
|
||||
// D <= lq( C ), positive diagonal elements
|
||||
void blasfeo_sgelqf_pd(int m, int n, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj, void *work); |
||||
// [L, A] <= lq( [L, A] ), positive diagonal elements, array of matrices, with
|
||||
// L lower triangular, of size (m)x(m)
|
||||
// A full, of size (m)x(n1)
|
||||
void blasfeo_sgelqf_pd_la(int m, int n1, struct blasfeo_smat *sL, int li, int lj, struct blasfeo_smat *sA, int ai, int aj, void *work); |
||||
// [L, L, A] <= lq( [L, L, A] ), positive diagonal elements, array of matrices, with:
|
||||
// L lower triangular, of size (m)x(m)
|
||||
// A full, of size (m)x(n1)
|
||||
void blasfeo_sgelqf_pd_lla(int m, int n1, struct blasfeo_smat *sL0, int l0i, int l0j, struct blasfeo_smat *sL1, int l1i, int l1j, struct blasfeo_smat *sA, int ai, int aj, void *work); |
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// BLAS API helper functions
|
||||
//
|
||||
|
||||
#if ( defined(BLAS_API) & defined(MF_PANELMAJ) ) |
||||
// BLAS 3
|
||||
void blasfeo_cm_sgemm_nn(int m, int n, int k, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, float beta, struct blasfeo_cm_smat *sC, int ci, int cj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_sgemm_nt(int m, int n, int k, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, float beta, struct blasfeo_cm_smat *sC, int ci, int cj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_sgemm_tn(int m, int n, int k, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, float beta, struct blasfeo_cm_smat *sC, int ci, int cj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_sgemm_tt(int m, int n, int k, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, float beta, struct blasfeo_cm_smat *sC, int ci, int cj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_llnn(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_llnu(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_lltn(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_lltu(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_lunn(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_lunu(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_lutn(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_lutu(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_rlnn(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_rlnu(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_rltn(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_rltu(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_runn(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_runu(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_rutn(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_strsm_rutu(int m, int n, float alpha, struct blasfeo_cm_smat *sA, int ai, int aj, struct blasfeo_cm_smat *sB, int bi, int bj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
// LAPACK
|
||||
void blasfeo_cm_spotrf_l(int m, struct blasfeo_cm_smat *sC, int ci, int cj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
void blasfeo_cm_spotrf_u(int m, struct blasfeo_cm_smat *sC, int ci, int cj, struct blasfeo_cm_smat *sD, int di, int dj); |
||||
#endif |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_S_BLASFEO_API_H_
|
@ -0,0 +1,135 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_S_BLASFEO_API_REF_H_ |
||||
#define BLASFEO_S_BLASFEO_API_REF_H_ |
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
// expose reference BLASFEO for testing
|
||||
|
||||
// --- level 1
|
||||
|
||||
void blasfeo_saxpy_ref(int kmax, float alpha, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sy, int yi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_saxpby_ref(int kmax, float alpha, struct blasfeo_svec_ref *sx, int xi, float beta, struct blasfeo_svec_ref *sy, int yi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_svecmul_ref(int m, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sy, int yi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_svecmulacc_ref(int m, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sy, int yi, struct blasfeo_svec_ref *sz, int zi); |
||||
float blasfeo_svecmuldot_ref(int m, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sy, int yi, struct blasfeo_svec_ref *sz, int zi); |
||||
float blasfeo_sdot_ref(int m, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sy, int yi); |
||||
void blasfeo_srotg_ref(float a, float b, float *c, float *s); |
||||
void blasfeo_scolrot_ref(int m, struct blasfeo_smat_ref *sA, int ai, int aj0, int aj1, float c, float s); |
||||
void blasfeo_srowrot_ref(int m, struct blasfeo_smat_ref *sA, int ai0, int ai1, int aj, float c, float s); |
||||
|
||||
|
||||
// --- level 2
|
||||
|
||||
// dense
|
||||
void blasfeo_sgemv_n_ref(int m, int n, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, float beta, struct blasfeo_svec_ref *sy, int yi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_sgemv_t_ref(int m, int n, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, float beta, struct blasfeo_svec_ref *sy, int yi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strsv_lnn_mn_ref(int m, int n, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strsv_ltn_mn_ref(int m, int n, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strsv_lnn_ref(int m, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strsv_lnu_ref(int m, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strsv_ltn_ref(int m, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strsv_ltu_ref(int m, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strsv_unn_ref(int m, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strsv_utn_ref(int m, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strmv_unn_ref(int m, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strmv_utn_ref(int m, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strmv_lnn_ref(int m, int n, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strmv_ltn_ref(int m, int n, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strmv_lnu_ref(int m, int n, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_strmv_ltu_ref(int m, int n, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, struct blasfeo_svec_ref *sz, int zi); |
||||
void blasfeo_sgemv_nt_ref(int m, int n, float alpha_n, float alpha_t, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx_n, int xi_n, struct blasfeo_svec_ref *sx_t, int xi_t, float beta_n, float beta_t, struct blasfeo_svec_ref *sy_n, int yi_n, struct blasfeo_svec_ref *sy_t, int yi_t, struct blasfeo_svec_ref *sz_n, int zi_n, struct blasfeo_svec_ref *sz_t, int zi_t); |
||||
void blasfeo_ssymv_l_ref(int m, int n, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sx, int xi, float beta, struct blasfeo_svec_ref *sy, int yi, struct blasfeo_svec_ref *sz, int zi); |
||||
|
||||
// diagonal
|
||||
void blasfeo_sgemv_d_ref(int m, float alpha, struct blasfeo_svec_ref *sA, int ai, struct blasfeo_svec_ref *sx, int xi, float beta, struct blasfeo_svec_ref *sy, int yi, struct blasfeo_svec_ref *sz, int zi); |
||||
|
||||
|
||||
// --- level 3
|
||||
|
||||
// dense
|
||||
void blasfeo_sgemm_nn_ref( int m, int n, int k, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, float beta, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_sgemm_nt_ref( int m, int n, int k, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, float beta, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_sgemm_tn_ref(int m, int n, int k, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, float beta, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_sgemm_tt_ref(int m, int n, int k, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, float beta, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
|
||||
void blasfeo_ssyrk_ln_mn_ref( int m, int n, int k, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, float beta, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_ssyrk_ln_ref( int m, int k, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, float beta, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_ssyrk_lt_ref( int m, int k, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, float beta, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_ssyrk_un_ref( int m, int k, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, float beta, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_ssyrk_ut_ref( int m, int k, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, float beta, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
|
||||
void blasfeo_strmm_rutn_ref( int m, int n, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_strmm_rlnn_ref( int m, int n, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_strsm_rltn_ref( int m, int n, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_strsm_rltu_ref( int m, int n, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_strsm_rutn_ref( int m, int n, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_strsm_llnu_ref( int m, int n, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_strsm_lunn_ref( int m, int n, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
|
||||
// diagonal
|
||||
void dgemm_diag_left_lib_ref(int m, int n, float alpha, float *dA, float *pB, int sdb, float beta, float *pC, int sdc, float *pD, int sdd); |
||||
void blasfeo_sgemm_dn_ref(int m, int n, float alpha, struct blasfeo_svec_ref *sA, int ai, struct blasfeo_smat_ref *sB, int bi, int bj, float beta, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_sgemm_nd_ref(int m, int n, float alpha, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_svec_ref *sB, int bi, float beta, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
|
||||
// --- lapack
|
||||
|
||||
void blasfeo_sgetrf_nopivot_ref(int m, int n, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_sgetrf_rowpivot_ref(int m, int n, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj, int *ipiv); |
||||
void blasfeo_spotrf_l_ref(int m, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_spotrf_l_mn_ref(int m, int n, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_ssyrk_dpotrf_ln_ref(int m, int k, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_ssyrk_dpotrf_ln_mn_ref(int m, int n, int k, struct blasfeo_smat_ref *sA, int ai, int aj, struct blasfeo_smat_ref *sB, int bi, int bj, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_sgetrf_nopivot_ref(int m, int n, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj); |
||||
void blasfeo_sgetrf_rowpivot_ref(int m, int n, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj, int *ipiv); |
||||
void blasfeo_sgeqrf_ref(int m, int n, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj, void *work); |
||||
void blasfeo_sgelqf_ref(int m, int n, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj, void *work); |
||||
void blasfeo_sgelqf_pd_ref(int m, int n, struct blasfeo_smat_ref *sC, int ci, int cj, struct blasfeo_smat_ref *sD, int di, int dj, void *work); |
||||
void blasfeo_sgelqf_pd_la_ref(int m, int n1, struct blasfeo_smat_ref *sL, int li, int lj, struct blasfeo_smat_ref *sA, int ai, int aj, void *work); |
||||
void blasfeo_sgelqf_pd_lla_ref(int m, int n1, struct blasfeo_smat_ref *sL0, int l0i, int l0j, struct blasfeo_smat_ref *sL1, int l1i, int l1j, struct blasfeo_smat_ref *sA, int ai, int aj, void *work); |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_S_BLASFEO_API_REF_H_
|
@ -0,0 +1,235 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_S_BLASFEO_REF_API_H_ |
||||
#define BLASFEO_S_BLASFEO_REF_API_H_ |
||||
|
||||
|
||||
|
||||
#include "blasfeo_common.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
//
|
||||
// level 1 BLAS
|
||||
//
|
||||
|
||||
// z = y + alpha*x
|
||||
void blasfeo_ref_saxpy(int kmax, float alpha, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// z = beta*y + alpha*x
|
||||
void blasfeo_ref_saxpby(int kmax, float alpha, struct blasfeo_svec *sx, int xi, float beta, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// z = x .* y
|
||||
void blasfeo_ref_svecmul(int m, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// z += x .* y
|
||||
void blasfeo_ref_svecmulacc(int m, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// z = x .* y, return sum(z) = x^T * y
|
||||
float blasfeo_ref_svecmuldot(int m, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// return x^T * y
|
||||
float blasfeo_ref_sdot(int m, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sy, int yi); |
||||
// construct givens plane rotation
|
||||
void blasfeo_ref_srotg(float a, float b, float *c, float *s); |
||||
// apply plane rotation [a b] [c -s; s; c] to the aj0 and aj1 columns of A at row index ai
|
||||
void blasfeo_ref_scolrot(int m, struct blasfeo_smat *sA, int ai, int aj0, int aj1, float c, float s); |
||||
// apply plane rotation [c s; -s c] [a; b] to the ai0 and ai1 rows of A at column index aj
|
||||
void blasfeo_ref_srowrot(int m, struct blasfeo_smat *sA, int ai0, int ai1, int aj, float c, float s); |
||||
|
||||
|
||||
|
||||
//
|
||||
// level 2 BLAS
|
||||
//
|
||||
|
||||
// dense
|
||||
|
||||
// z <= beta * y + alpha * A * x
|
||||
void blasfeo_ref_sgemv_n(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, float beta, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// z <= beta * y + alpha * A' * x
|
||||
void blasfeo_ref_sgemv_t(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, float beta, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A ) * x, A (m)x(n)
|
||||
void blasfeo_ref_strsv_lnn_mn(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(n)
|
||||
void blasfeo_ref_strsv_ltn_mn(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A ) * x, A (m)x(m) lower, not_transposed, not_unit
|
||||
void blasfeo_ref_strsv_lnn(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A ) * x, A (m)x(m) lower, not_transposed, unit
|
||||
void blasfeo_ref_strsv_lnu(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(m) lower, transposed, not_unit
|
||||
void blasfeo_ref_strsv_ltn(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(m) lower, transposed, unit
|
||||
void blasfeo_ref_strsv_ltu(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(m) upper, not_transposed, not_unit
|
||||
void blasfeo_ref_strsv_unn(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= inv( A' ) * x, A (m)x(m) upper, transposed, not_unit
|
||||
void blasfeo_ref_strsv_utn(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= beta * y + alpha * A * x ; A upper triangular
|
||||
void blasfeo_ref_strmv_unn(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= A' * x ; A upper triangular
|
||||
void blasfeo_ref_strmv_utn(int m, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= A * x ; A lower triangular
|
||||
void blasfeo_ref_strmv_lnn(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z <= A' * x ; A lower triangular
|
||||
void blasfeo_ref_strmv_ltn(int m, int n, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, struct blasfeo_svec *sz, int zi); |
||||
// z_n <= beta_n * y_n + alpha_n * A * x_n
|
||||
// z_t <= beta_t * y_t + alpha_t * A' * x_t
|
||||
void blasfeo_ref_sgemv_nt(int m, int n, float alpha_n, float alpha_t, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx_n, int xi_n, struct blasfeo_svec *sx_t, int xi_t, float beta_n, float beta_t, struct blasfeo_svec *sy_n, int yi_n, struct blasfeo_svec *sy_t, int yi_t, struct blasfeo_svec *sz_n, int zi_n, struct blasfeo_svec *sz_t, int zi_t); |
||||
// z <= beta * y + alpha * A * x, where A is symmetric and only the lower triangular patr of A is accessed
|
||||
void blasfeo_ref_ssymv_l(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sx, int xi, float beta, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
|
||||
// diagonal
|
||||
|
||||
// z <= beta * y + alpha * A * x, A diagonal
|
||||
void blasfeo_ref_sgemv_d(int m, float alpha, struct blasfeo_svec *sA, int ai, struct blasfeo_svec *sx, int xi, float beta, struct blasfeo_svec *sy, int yi, struct blasfeo_svec *sz, int zi); |
||||
|
||||
|
||||
|
||||
//
|
||||
// level 3 BLAS
|
||||
//
|
||||
|
||||
// dense
|
||||
|
||||
// D <= beta * C + alpha * A * B
|
||||
void blasfeo_ref_sgemm_nn(int m, int n, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A * B^T
|
||||
void blasfeo_ref_sgemm_nt(int m, int n, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B
|
||||
void blasfeo_ref_sgemm_tn(int m, int n, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B
|
||||
void blasfeo_ref_sgemm_tt(int m, int n, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A * B^T ; C, D lower triangular
|
||||
void blasfeo_ref_ssyrk_ln(int m, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
void blasfeo_ref_ssyrk_ln_mn(int m, int n, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B ; C, D lower triangular
|
||||
void blasfeo_ref_ssyrk_lt(int m, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A * B^T ; C, D upper triangular
|
||||
void blasfeo_ref_ssyrk_un(int m, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= beta * C + alpha * A^T * B ; C, D upper triangular
|
||||
void blasfeo_ref_ssyrk_ut(int m, int k, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^T ; B upper triangular
|
||||
void blasfeo_ref_strmm_rutn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A ; A lower triangular
|
||||
void blasfeo_ref_strmm_rlnn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A lower triangular employint explicit inverse of diagonal
|
||||
void blasfeo_ref_strsm_llnn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A lower triangular with unit diagonal
|
||||
void blasfeo_ref_strsm_llnu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A lower triangular employint explicit inverse of diagonal
|
||||
void blasfeo_ref_strsm_lltn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A lower triangular with unit diagonal
|
||||
void blasfeo_ref_strsm_lltu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_ref_strsm_lunn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-1} * B , with A upper triangular withunit diagonal
|
||||
void blasfeo_ref_strsm_lunu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_ref_strsm_lutn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A^{-T} * B , with A upper triangular withunit diagonal
|
||||
void blasfeo_ref_strsm_lutu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A lower triangular employing explicit inverse of diagonal
|
||||
void blasfeo_ref_strsm_rlnn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A lower triangular with unit diagonal
|
||||
void blasfeo_ref_strsm_rlnu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A lower triangular employing explicit inverse of diagonal
|
||||
void blasfeo_ref_strsm_rltn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A lower triangular with unit diagonal
|
||||
void blasfeo_ref_strsm_rltu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_ref_strsm_runn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-1} , with A upper triangular with unit diagonal
|
||||
void blasfeo_ref_strsm_runu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A upper triangular employing explicit inverse of diagonal
|
||||
void blasfeo_ref_strsm_rutn(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * B * A^{-T} , with A upper triangular with unit diagonal
|
||||
void blasfeo_ref_strsm_rutu(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sD, int di, int dj); |
||||
|
||||
// diagonal
|
||||
|
||||
// D <= alpha * A * B + beta * C, with A diagonal (stored as strvec)
|
||||
void sgemm_diag_left_ib(int m, int n, float alpha, float *dA, float *pB, int sdb, float beta, float *pC, int sdc, float *pD, int sdd); |
||||
void blasfeo_ref_sgemm_dn(int m, int n, float alpha, struct blasfeo_svec *sA, int ai, struct blasfeo_smat *sB, int bi, int bj, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= alpha * A * B + beta * C, with B diagonal (stored as strvec)
|
||||
void blasfeo_ref_sgemm_nd(int m, int n, float alpha, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_svec *sB, int bi, float beta, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
|
||||
|
||||
|
||||
//
|
||||
// LAPACK
|
||||
//
|
||||
|
||||
// D <= chol( C ) ; C, D lower triangular
|
||||
void blasfeo_ref_spotrf_l(int m, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
void blasfeo_ref_spotrf_l_mn(int m, int n, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= chol( C ) ; C, D upper triangular
|
||||
void blasfeo_ref_spotrf_u(int m, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= chol( C + A * B' ) ; C, D lower triangular
|
||||
void blasfeo_ref_ssyrk_spotrf_ln(int m, int k, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
void blasfeo_ref_ssyrk_spotrf_ln_mn(int m, int n, int k, struct blasfeo_smat *sA, int ai, int aj, struct blasfeo_smat *sB, int bi, int bj, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= lu( C ) ; no pivoting
|
||||
void blasfeo_ref_sgetrf_np(int m, int n, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj); |
||||
// D <= lu( C ) ; row pivoting
|
||||
void blasfeo_ref_sgetrf_rp(int m, int n, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj, int *ipiv); |
||||
// D <= qr( C )
|
||||
void blasfeo_ref_sgeqrf(int m, int n, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj, void *work); |
||||
int blasfeo_ref_sgeqrf_worksize(int m, int n); // in bytes
|
||||
// D <= Q factor, where C is the output of the LQ factorization
|
||||
int blasfeo_ref_sorglq_worksize(int m, int n, int k); // in bytes
|
||||
void blasfeo_ref_sorglq(int m, int n, int k, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj, void *work); |
||||
// D <= lq( C )
|
||||
void blasfeo_ref_sgelqf(int m, int n, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj, void *work); |
||||
int blasfeo_ref_sgelqf_worksize(int m, int n); // in bytes
|
||||
// D <= lq( C ), positive diagonal elements
|
||||
void blasfeo_ref_sgelqf_pd(int m, int n, struct blasfeo_smat *sC, int ci, int cj, struct blasfeo_smat *sD, int di, int dj, void *work); |
||||
// [L, A] <= lq( [L, A] ), positive diagonal elements, array of matrices, with
|
||||
// L lower triangular, of size (m)x(m)
|
||||
// A full, of size (m)x(n1)
|
||||
void blasfeo_ref_sgelqf_pd_la(int m, int n1, struct blasfeo_smat *sL, int li, int lj, struct blasfeo_smat *sA, int ai, int aj, void *work); |
||||
// [L, L, A] <= lq( [L, L, A] ), positive diagonal elements, array of matrices, with:
|
||||
// L lower triangular, of size (m)x(m)
|
||||
// A full, of size (m)x(n1)
|
||||
void blasfeo_ref_sgelqf_pd_lla(int m, int n1, struct blasfeo_smat *sL0, int l0i, int l0j, struct blasfeo_smat *sL1, int l1i, int l1j, struct blasfeo_smat *sA, int ai, int aj, void *work); |
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_S_BLASFEO_REF_API_H_
|
||||
|
@ -0,0 +1,682 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_S_KERNEL_H_ |
||||
#define BLASFEO_S_KERNEL_H_ |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
// utils
|
||||
void blasfeo_align_2MB(void *ptr, void **ptr_align); |
||||
void blasfeo_align_4096_byte(void *ptr, void **ptr_align); |
||||
void blasfeo_align_64_byte(void *ptr, void **ptr_align); |
||||
|
||||
|
||||
|
||||
//
|
||||
// lib8
|
||||
//
|
||||
|
||||
// 24x4
|
||||
void kernel_sgemm_nt_24x4_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); |
||||
void kernel_sgemm_nt_24x4_vs_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, int km, int kn); |
||||
void kernel_sgemm_nt_24x4_gen_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, int offsetC, float *C, int sdc, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); |
||||
void kernel_sgemm_nn_24x4_lib8(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *beta, float *C, int sdc, float *D, int sdd); |
||||
void kernel_sgemm_nn_24x4_vs_lib8(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *beta, float *C, int sdc, float *D, int sdd, int km, int kn); |
||||
void kernel_sgemm_nn_24x4_gen_lib8(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *beta, int offsetC, float *C, int sdc, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); |
||||
void kernel_ssyrk_nt_l_24x4_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); |
||||
void kernel_ssyrk_nt_l_24x4_vs_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, int km, int kn); |
||||
void kernel_ssyrk_nt_l_20x4_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); |
||||
void kernel_ssyrk_nt_l_20x4_vs_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, int km, int kn); |
||||
void kernel_spotrf_nt_l_24x4_lib8(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D); |
||||
void kernel_spotrf_nt_l_24x4_vs_lib8(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D, int km, int kn); |
||||
void kernel_spotrf_nt_l_20x4_lib8(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D); |
||||
void kernel_spotrf_nt_l_20x4_vs_lib8(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D, int km, int kn); |
||||
void kernel_strsm_nt_rl_inv_24x4_lib8(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E); |
||||
void kernel_strsm_nt_rl_inv_24x4_vs_lib8(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E, int km, int kn); |
||||
void kernel_sgemm_strsm_nt_rl_inv_24x4_lib8(int kp, float *Ap, int sdap, float *Bp, int km_, float *Am, int sdam, float *Bm, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E); |
||||
void kernel_sgemm_strsm_nt_rl_inv_24x4_vs_lib8(int kp, float *Ap, int sdap, float *Bp, int km_, float *Am, int sdam, float *Bm, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E, int km, int kn); |
||||
void kernel_ssyrk_spotrf_nt_l_20x4_vs_lib8(int kp, float *Ap, int sdap, float *Bp, int km_, float *Am, int sdam, float *Bm, float *C, int sdc, float *D, int sdd, float *inv_diag_D, int km, int kn); |
||||
void kernel_ssyrk_spotrf_nt_l_20x4_lib8(int kp, float *Ap, int sdap, float *Bp, int km_, float *Am, int sdam, float *Bm, float *C, int sdc, float *D, int sdd, float *inv_diag_D); |
||||
void kernel_ssyrk_spotrf_nt_l_24x4_vs_lib8(int kp, float *Ap, int sdap, float *Bp, int km_, float *Am, int sdam, float *Bm, float *C, int sdc, float *D, int sdd, float *inv_diag_D, int km, int kn); |
||||
void kernel_ssyrk_spotrf_nt_l_24x4_lib8(int kp, float *Ap, int sdap, float *Bp, int km_, float *Am, int sdam, float *Bm, float *C, int sdc, float *D, int sdd, float *inv_diag_D); |
||||
void kernel_strmm_nn_rl_24x4_lib8(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *D, int sdd); |
||||
void kernel_strmm_nn_rl_24x4_vs_lib8(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *D, int sdd, int km, int kn); |
||||
|
||||
// 16x8
|
||||
void kernel_sgemm_nt_16x8_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, float *spil); |
||||
|
||||
// 16x4
|
||||
void kernel_sgemm_nt_16x4_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); |
||||
void kernel_sgemm_nt_16x4_vs_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, int km, int kn); |
||||
void kernel_sgemm_nt_16x4_gen_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, int offsetC, float *C, int sdc, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); |
||||
void kernel_sgemm_nn_16x4_lib8(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *beta, float *C, int sdc, float *D, int sdd); |
||||
void kernel_sgemm_nn_16x4_vs_lib8(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *beta, float *C, int sdc, float *D, int sdd, int km, int kn); |
||||
void kernel_sgemm_nn_16x4_gen_lib8(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *beta, int offsetC, float *C, int sdc, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); |
||||
void kernel_ssyrk_nt_l_16x4_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); |
||||
void kernel_ssyrk_nt_l_16x4_vs_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, int km, int kn); |
||||
void kernel_ssyrk_nt_l_12x4_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); |
||||
void kernel_ssyrk_nt_l_12x4_vs_lib8(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, int km, int kn); |
||||
void kernel_spotrf_nt_l_16x4_lib8(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D); |
||||
void kernel_spotrf_nt_l_16x4_vs_lib8(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D, int km, int kn); |
||||
void kernel_spotrf_nt_l_12x4_lib8(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D); |
||||
void kernel_spotrf_nt_l_12x4_vs_lib8(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D, int km, int kn); |
||||
void kernel_strsm_nt_rl_inv_16x4_lib8(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E); |
||||
void kernel_strsm_nt_rl_inv_16x4_vs_lib8(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E, int km, int kn); |
||||
void kernel_sgemm_strsm_nt_rl_inv_16x4_lib8(int kp, float *Ap, int sdap, float *Bp, int km_, float *Am, int sdam, float *Bm, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E); |
||||
void kernel_sgemm_strsm_nt_rl_inv_16x4_vs_lib8(int kp, float *Ap, int sdap, float *Bp, int km_, float *Am, int sdam, float *Bm, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E, int km, int kn); |
||||
void kernel_ssyrk_spotrf_nt_l_12x4_vs_lib8(int kp, float *Ap, int sdap, float *Bp, int km_, float *Am, int sdam, float *Bm, float *C, int sdc, float *D, int sdd, float *inv_diag_D, int km, int kn); |
||||
void kernel_ssyrk_spotrf_nt_l_12x4_lib8(int kp, float *Ap, int sdap, float *Bp, int km_, float *Am, int sdam, float *Bm, float *C, int sdc, float *D, int sdd, float *inv_diag_D); |
||||
void kernel_ssyrk_spotrf_nt_l_16x4_vs_lib8(int kp, float *Ap, int sdap, float *Bp, int km_, float *Am, int sdam, float *Bm, float *C, int sdc, float *D, int sdd, float *inv_diag_D, int km, int kn); |
||||
void kernel_ssyrk_spotrf_nt_l_16x4_lib8(int kp, float *Ap, int sdap, float *Bp, int km_, float *Am, int sdam, float *Bm, float *C, int sdc, float *D, int sdd, float *inv_diag_D); |
||||
void kernel_strmm_nn_rl_16x4_lib8(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *D, int sdd); |
||||
void kernel_strmm_nn_rl_16x4_vs_lib8(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *D, int sdd, int km, int kn); |
||||
void kernel_strmm_nn_rl_16x4_gen_lib8(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); |
||||
|
||||
// 8x8
|
||||
void kernel_sgemm_nt_8x8_lib8(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D); |
||||
void kernel_sgemm_nt_8x8_vs_lib8(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D, int km, int kn); |
||||
void kernel_sgemm_nt_8x8_gen_lib8(int k, float *alpha, float *A, float *B, float *beta, int offsetC, float *C, int sdc, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); |
||||
void kernel_sgemm_nn_8x8_lib8(int k, float *alpha, float *A, int offsetB, float *B, int sdb, float *beta, float *C, float *D); |
||||
void kernel_sgemm_nn_8x8_vs_lib8(int k, float *alpha, float *A, int offsetB, float *B, int sdb, float *beta, float *C, float *D, int km, int kn); |
||||
void kernel_sgemm_nn_8x8_gen_lib8(int k, float *alpha, float *A, int offsetB, float *B, int sdb, float *beta, int offsetC, float *C, int sdc, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); |
||||
void kernel_ssyrk_nt_l_8x8_lib8(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D); |
||||
void kernel_ssyrk_nt_l_8x8_vs_lib8(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D, int km, int kn); |
||||
void kernel_spotrf_nt_l_8x8_lib8(int k, float *A, float *B, float *C, float *D, float *inv_diag_D); |
||||
void kernel_spotrf_nt_l_8x8_vs_lib8(int k, float *A, float *B, float *C, float *D, float *inv_diag_D, int km, int kn); |
||||
void kernel_strsm_nt_rl_inv_8x8_lib8(int k, float *A, float *B, float *C, float *D, float *E, float *inv_diag_E); |
||||
void kernel_strsm_nt_rl_inv_8x8_vs_lib8(int k, float *A, float *B, float *C, float *D, float *E, float *inv_diag_E, int km, int kn); |
||||
void kernel_sgemm_strsm_nt_rl_inv_8x8_lib8(int kp, float *Ap, float *Bp, int km_, float *Am, float *Bm, float *C, float *D, float *E, float *inv_diag_E); |
||||
void kernel_sgemm_strsm_nt_rl_inv_8x8_vs_lib8(int kp, float *Ap, float *Bp, int km_, float *Am, float *Bm, float *C, float *D, float *E, float *inv_diag_E, int km, int kn); |
||||
void kernel_ssyrk_spotrf_nt_l_8x8_vs_lib8(int kp, float *Ap, float *Bp, int km_, float *Am, float *Bm, float *C, float *D, float *inv_diag_D, int km, int kn); |
||||
void kernel_ssyrk_spotrf_nt_l_8x8_lib8(int kp, float *Ap, float *Bp, int km_, float *Am, float *Bm, float *C, float *D, float *inv_diag_D); |
||||
|
||||
// 8x4
|
||||
void kernel_sgemm_nt_8x4_lib8(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D); |
||||
void kernel_sgemm_nt_8x4_vs_lib8(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D, int km, int kn); |
||||
void kernel_sgemm_nt_8x4_gen_lib8(int k, float *alpha, float *A, float *B, float *beta, int offsetC, float *C, int sdc, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); |
||||
void kernel_sgemm_nn_8x4_lib8(int k, float *alpha, float *A, int offsetB, float *B, int sdb, float *beta, float *C, float *D); |
||||
void kernel_sgemm_nn_8x4_vs_lib8(int k, float *alpha, float *A, int offsetB, float *B, int sdb, float *beta, float *C, float *D, int km, int kn); |
||||
void kernel_sgemm_nn_8x4_gen_lib8(int k, float *alpha, float *A, int offsetB, float *B, int sdb, float *beta, int offsetC, float *C, int sdc, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); |
||||
//void kernel_ssyrk_nt_l_8x4_lib8(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D);
|
||||
void kernel_ssyrk_nt_l_8x4_vs_lib8(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D, int km, int kn); |
||||
void kernel_spotrf_nt_l_8x4_lib8(int k, float *A, float *B, float *C, float *D, float *inv_diag_D); |
||||
void kernel_spotrf_nt_l_8x4_vs_lib8(int k, float *A, float *B, float *C, float *D, float *inv_diag_D, int km, int kn); |
||||
void kernel_strsm_nt_rl_inv_8x4_lib8(int k, float *A, float *B, float *C, float *D, float *E, float *inv_diag_E); |
||||
void kernel_strsm_nt_rl_inv_8x4_vs_lib8(int k, float *A, float *B, float *C, float *D, float *E, float *inv_diag_E, int km, int kn); |
||||
void kernel_sgemm_strsm_nt_rl_inv_8x4_lib8(int kp, float *Ap, float *Bp, int km_, float *Am, float *Bm, float *C, float *D, float *E, float *inv_diag_E); |
||||
void kernel_sgemm_strsm_nt_rl_inv_8x4_vs_lib8(int kp, float *Ap, float *Bp, int km_, float *Am, float *Bm, float *C, float *D, float *E, float *inv_diag_E, int km, int kn); |
||||
void kernel_ssyrk_spotrf_nt_l_8x4_vs_lib8(int kp, float *Ap, float *Bp, int km_, float *Am, float *Bm, float *C, float *D, float *inv_diag_D, int km, int kn); |
||||
void kernel_ssyrk_spotrf_nt_l_8x4_lib8(int kp, float *Ap, float *Bp, int km_, float *Am, float *Bm, float *C, float *D, float *inv_diag_D); |
||||
void kernel_strmm_nn_rl_8x4_lib8(int k, float *alpha, float *A, int offsetB, float *B, int sdb, float *D); |
||||
void kernel_strmm_nn_rl_8x4_vs_lib8(int k, float *alpha, float *A, int offsetB, float *B, int sdb, float *D, int km, int kn); |
||||
void kernel_strmm_nn_rl_8x4_gen_lib8(int k, float *alpha, float *A, int offsetB, float *B, int sdb, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); |
||||
void kernel_strmm_nt_ru_8x4_lib8(int k, float *alpha, float *A, float *B, float *D); |
||||
void kernel_strmm_nt_ru_8x4_vs_lib8(int k, float *alpha, float *A, float *B, float *D, int km, int kn); |
||||
|
||||
// 4x8
|
||||
void kernel_sgemm_nt_4x8_lib8(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D); |
||||
void kernel_sgemm_nt_4x8_vs_lib8(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D, int km, int kn); |
||||
void kernel_sgemm_nt_4x8_gen_lib8(int k, float *alpha, float *A, float *B, float *beta, int offsetC, float *C, int sdc, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); |
||||
void kernel_strsm_nt_rl_inv_4x8_lib8(int k, float *A, float *B, float *C, float *D, float *E, float *inv_diag_E); |
||||
void kernel_strsm_nt_rl_inv_4x8_vs_lib8(int k, float *A, float *B, float *C, float *D, float *E, float *inv_diag_E, int km, int kn); |
||||
|
||||
// 8
|
||||
void kernel_sgemv_n_8_lib8(int k, float *alpha, float *A, float *x, float *beta, float *y, float *z); |
||||
void kernel_sgemv_n_8_vs_lib8(int k, float *alpha, float *A, float *x, float *beta, float *y, float *z, int k1); |
||||
void kernel_sgemv_n_8_gen_lib8(int kmax, float *alpha, float *A, float *x, float *beta, float *y, float *z, int k0, int k1); |
||||
void kernel_sgemv_t_8_lib8(int k, float *alpha, int offsetA, float *A, int sda, float *x, float *beta, float *y, float *z); |
||||
void kernel_sgemv_t_8_vs_lib8(int k, float *alpha, int offsetA, float *A, int sda, float *x, float *beta, float *y, float *z, int k1); |
||||
void kernel_sgemv_t_4_lib8(int k, float *alpha, int offsetA, float *A, int sda, float *x, float *beta, float *y, float *z); |
||||
void kernel_sgemv_t_4_vs_lib8(int k, float *alpha, int offsetA, float *A, int sda, float *x, float *beta, float *y, float *z, int k1); |
||||
void kernel_strsv_ln_inv_8_lib8(int k, float *A, float *inv_diag_A, float *x, float *y, float *z); |
||||
void kernel_strsv_ln_inv_8_vs_lib8(int k, float *A, float *inv_diag_A, float *x, float *y, float *z, int km, int kn); |
||||
void kernel_strsv_lt_inv_8_lib8(int k, float *A, int sda, float *inv_diag_A, float *x, float *y, float *z); |
||||
void kernel_strsv_lt_inv_8_vs_lib8(int k, float *A, int sda, float *inv_diag_A, float *x, float *y, float *z, int km, int kn); |
||||
void kernel_sgemv_nt_4_lib8(int kmax, float *alpha_n, float *alpha_t, float *A, int sda, float *x_n, float *x_t, float *beta_t, float *y_t, float *z_n, float *z_t); |
||||
void kernel_sgemv_nt_4_vs_lib8(int kmax, float *alpha_n, float *alpha_t, float *A, int sda, float *x_n, float *x_t, float *beta_t, float *y_t, float *z_n, float *z_t, int km); |
||||
void kernel_ssymv_l_4l_lib8(int kmax, float *alpha, float *A, int sda, float *x, float *z); |
||||
void kernel_ssymv_l_4r_lib8(int kmax, float *alpha, float *A, int sda, float *x, float *z); |
||||
void kernel_ssymv_l_4l_gen_lib8(int kmax, float *alpha, int offA, float *A, int sda, float *x, float *z, int km); |
||||
void kernel_ssymv_l_4r_gen_lib8(int kmax, float *alpha, int offA, float *A, int sda, float *x, float *z, int km); |
||||
|
||||
// -------- aux
|
||||
|
||||
// ---- copy
|
||||
|
||||
// lib4
|
||||
//
|
||||
void kernel_sgecpsc_4_0_lib4(int kmax, float *alpha, float *A, float *B); |
||||
void kernel_sgecp_4_0_lib4(int kmax, float *A, float *B); |
||||
|
||||
void kernel_sgecpsc_4_1_lib4(int kmax, float *alpha, float *A0, int sda, float *B); |
||||
void kernel_sgecp_4_1_lib4(int kmax, float *A0, int sda, float *B); |
||||
void kernel_sgecpsc_4_2_lib4(int kmax, float *alpha, float *A0, int sda, float *B); |
||||
void kernel_sgecp_4_2_lib4(int kmax, float *A0, int sda, float *B); |
||||
void kernel_sgecpsc_4_3_lib4(int kmax, float *alpha, float *A0, int sda, float *B); |
||||
void kernel_sgecp_4_3_lib4(int kmax, float *A0, int sda, float *B); |
||||
|
||||
void kernel_sgecpsc_3_0_lib4(int kmax, float *alpha, float *A, float *B); |
||||
void kernel_sgecp_3_0_lib4(int kmax, float *A, float *B); |
||||
void kernel_sgecpsc_3_2_lib4(int kmax, float *alpha, float *A0, int sda, float *B); |
||||
void kernel_sgecp_3_2_lib4(int kmax, float *A0, int sda, float *B); |
||||
void kernel_sgecpsc_3_3_lib4(int kmax, float *alpha, float *A0, int sda, float *B); |
||||
void kernel_sgecp_3_3_lib4(int kmax, float *A0, int sda, float *B); |
||||
|
||||
void kernel_sgecpsc_2_0_lib4(int kmax, float *alpha, float *A, float *B); |
||||
void kernel_sgecp_2_0_lib4(int kmax, float *A, float *B); |
||||
void kernel_sgecpsc_2_3_lib4(int kmax, float *alpha, float *A0, int sda, float *B); |
||||
void kernel_sgecp_2_3_lib4(int kmax, float *A0, int sda, float *B); |
||||
|
||||
void kernel_sgecpsc_1_0_lib4(int kmax, float *alpha, float *A, float *B); |
||||
void kernel_sgecp_1_0_lib4(int kmax, float *A, float *B); |
||||
|
||||
// lib8
|
||||
//
|
||||
void kernel_sgecp_8_0_lib8(int m, float *A, float *B); |
||||
void kernel_sgecp_8_0_gen_lib8(int m, float *A, float *B, int m1); |
||||
void kernel_sgecp_8_0_gen_u_lib8(int m, float *A, float *B, int m1); |
||||
|
||||
void kernel_sgesc_8_0_lib8(int m, float *alpha, float *A); |
||||
void kernel_sgesc_8_0_gen_lib8(int m, float *alpha, float *A, int m1); |
||||
void kernel_sgesc_8_0_gen_u_lib8(int m, float *alpha, float *A, int m1); |
||||
|
||||
void kernel_sgecpsc_8_0_lib8(int m, float *alpha, float *A, float *B); |
||||
void kernel_sgecpsc_8_0_gen_lib8(int m, float *alpha, float *A, float *B, int m1); |
||||
void kernel_sgecpsc_8_0_gen_u_lib8(int m, float *alpha, float *A, float *B, int m1); |
||||
|
||||
void kernel_sgecp_8_1_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgecp_8_1_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgecpsc_8_1_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgecpsc_8_1_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
|
||||
void kernel_sgecp_8_2_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgecp_8_2_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgecpsc_8_2_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgecpsc_8_2_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
|
||||
void kernel_sgecp_8_3_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgecp_8_3_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgecpsc_8_3_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgecpsc_8_3_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
|
||||
void kernel_sgecp_8_4_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgecp_8_4_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgecpsc_8_4_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgecpsc_8_4_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
|
||||
void kernel_sgecp_8_5_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgecp_8_5_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgecpsc_8_5_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgecpsc_8_5_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
|
||||
void kernel_sgecp_8_6_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgecp_8_6_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgecpsc_8_6_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgecpsc_8_6_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
|
||||
void kernel_sgecp_8_7_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgecp_8_7_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgecpsc_8_7_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgecpsc_8_7_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
|
||||
// transpose
|
||||
//
|
||||
void kernel_sgetr_8_0_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgetr_8_0_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgetr_8_1_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgetr_8_1_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgetr_8_2_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgetr_8_2_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgetr_8_3_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgetr_8_3_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgetr_8_4_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgetr_8_4_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgetr_8_5_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgetr_8_5_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgetr_8_6_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgetr_8_6_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
void kernel_sgetr_8_7_lib8(int m, float *A, int sda, float *B); |
||||
void kernel_sgetr_8_7_gen_lib8(int m, float *A, int sda, float *B, int m1); |
||||
|
||||
// add
|
||||
//
|
||||
void kernel_sgead_8_0_lib8(int m, float *alpha, float *A, float *B); |
||||
void kernel_sgead_8_0_gen_lib8(int m, float *alpha, float *A, float *B, int m1); |
||||
void kernel_sgead_8_1_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgead_8_1_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
void kernel_sgead_8_2_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgead_8_2_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
void kernel_sgead_8_3_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgead_8_3_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
void kernel_sgead_8_4_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgead_8_4_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
void kernel_sgead_8_5_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgead_8_5_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
void kernel_sgead_8_6_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgead_8_6_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
void kernel_sgead_8_7_lib8(int m, float *alpha, float *A, int sda, float *B); |
||||
void kernel_sgead_8_7_gen_lib8(int m, float *alpha, float *A, int sda, float *B, int m1); |
||||
|
||||
|
||||
//
|
||||
// lib4
|
||||
//
|
||||
|
||||
|
||||
|
||||
// level 2 BLAS
|
||||
// 4
|
||||
void kernel_sgemv_n_4_lib4(int k, float *alpha, float *A, float *x, float *beta, float *y, float *z); |
||||
void kernel_sgemv_n_4_vs_lib4(int k, float *alpha, float *A, float *x, float *beta, float *y, float *z, int k1); |
||||
void kernel_sgemv_n_4_gen_lib4(int kmax, float *alpha, float *A, float *x, float *beta, float *y, float *z, int k0, int k1); |
||||
void kernel_sgemv_t_4_lib4(int k, float *alpha, int offsetA, float *A, int sda, float *x, float *beta, float *y, float *z); |
||||
void kernel_sgemv_t_4_vs_lib4(int k, float *alpha, int offsetA, float *A, int sda, float *x, float *beta, float *y, float *z, int k1); |
||||
void kernel_strsv_ln_inv_4_lib4(int k, float *A, float *inv_diag_A, float *x, float *y, float *z); |
||||
void kernel_strsv_ln_inv_4_vs_lib4(int k, float *A, float *inv_diag_A, float *x, float *y, float *z, int km, int kn); |
||||
void kernel_strsv_lt_inv_4_lib4(int k, float *A, int sda, float *inv_diag_A, float *x, float *y, float *z); |
||||
void kernel_strsv_lt_inv_3_lib4(int k, float *A, int sda, float *inv_diag_A, float *x, float *y, float *z); |
||||
void kernel_strsv_lt_inv_2_lib4(int k, float *A, int sda, float *inv_diag_A, float *x, float *y, float *z); |
||||
void kernel_strsv_lt_inv_1_lib4(int k, float *A, int sda, float *inv_diag_A, float *x, float *y, float *z); |
||||
void kernel_strmv_un_4_lib4(int k, float *A, float *x, float *z); |
||||
void kernel_strmv_ut_4_lib4(int k, float *A, int sda, float *x, float *z); |
||||
void kernel_strmv_ut_4_vs_lib4(int k, float *A, int sda, float *x, float *z, int km); |
||||
void kernel_sgemv_nt_6_lib4(int kmax, float *alpha_n, float *alpha_t, float *A, int sda, float *x_n, float *x_t, float *beta_t, float *y_t, float *z_n, float *z_t); |
||||
void kernel_sgemv_nt_4_lib4(int kmax, float *alpha_n, float *alpha_t, float *A, int sda, float *x_n, float *x_t, float *beta_t, float *y_t, float *z_n, float *z_t); |
||||
void kernel_sgemv_nt_4_vs_lib4(int kmax, float *alpha_n, float *alpha_t, float *A, int sda, float *x_n, float *x_t, float *beta_t, float *y_t, float *z_n, float *z_t, int km); |
||||
void kernel_ssymv_l_4_lib4(int kmax, float *alpha, float *A, int sda, float *x_n, float *z_n); |
||||
void kernel_ssymv_l_4_gen_lib4(int kmax, float *alpha, int offA, float *A, int sda, float *x_n, float *z_n, int km); |
||||
|
||||
|
||||
|
||||
// level 3 BLAS
|
||||
// 12x4
|
||||
void kernel_sgemm_nt_16x4_lib4(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); //
|
||||
void kernel_sgemm_nt_16x4_vs_lib4(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, int m1, int n1); //
|
||||
void kernel_strsm_nt_rl_inv_16x4_lib4(int k, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E); |
||||
void kernel_strsm_nt_rl_inv_16x4_vs_lib4(int k, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E, int m1, int n1); |
||||
// 12x4
|
||||
void kernel_sgemm_nt_12x4_lib4(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); //
|
||||
void kernel_sgemm_nt_12x4_vs_lib4(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, int m1, int n1); //
|
||||
void kernel_strsm_nt_rl_inv_12x4_lib4(int k, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E); |
||||
void kernel_strsm_nt_rl_inv_12x4_vs_lib4(int k, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E, int m1, int n1); |
||||
// 8x8
|
||||
void kernel_sgemm_nt_8x8_lib4(int k, float *alpha, float *A, int sda, float *B, int sdb, float *beta, float *C, int sdc, float *D, int sdd); //
|
||||
void kernel_sgemm_nt_8x8_vs_lib4(int k, float *alpha, float *A, int sda, float *B, int sdb, float *beta, float *C, int sdc, float *D, int sdd, int m1, int n1); //
|
||||
void kernel_sgemm_nn_8x8_lib4(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *beta, float *C, int sdc, float *D, int sdd); //
|
||||
void kernel_sgemm_nn_8x8_vs_lib4(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *beta, float *C, int sdc, float *D, int sdd, int m1, int n1); //
|
||||
// 8x4
|
||||
void kernel_sgemm_nt_8x4_lib4(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); //
|
||||
void kernel_sgemm_nt_8x4_vs_lib4(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, int m1, int n1); //
|
||||
void kernel_sgemm_nn_8x4_lib4(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *beta, float *C, int sdc, float *D, int sdd); //
|
||||
void kernel_sgemm_nn_8x4_vs_lib4(int k, float *alpha, float *A, int sda, int offsetB, float *B, int sdb, float *beta, float *C, int sdc, float *D, int sdd, int m1, int n1); //
|
||||
void kernel_ssyrk_nt_l_8x4_lib4(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); //
|
||||
void kernel_ssyrk_nt_l_8x4_vs_lib4(int k, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, int km, int kn); //
|
||||
void kernel_strsm_nt_rl_inv_8x4_lib4(int k, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E); |
||||
void kernel_strsm_nt_rl_inv_8x4_vs_lib4(int k, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd, float *E, float *inv_diag_E, int m1, int n1); |
||||
// 4x4
|
||||
void kernel_sgemm_nt_4x4_lib4(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D); //
|
||||
void kernel_sgemm_nt_4x4_vs_lib4(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D, int km, int kn); //
|
||||
void kernel_sgemm_nt_4x4_gen_lib4(int k, float *alpha, float *A, float *B, float *beta, int offsetC, float *C, int sdc, int offsetD, float *D, int sdd, int m0, int m1, int k0, int k1); |
||||
void kernel_sgemm_nn_4x4_lib4(int k, float *alpha, float *A, int offsetB, float *B, int sdb, float *beta, float *C, float *D); //
|
||||
void kernel_sgemm_nn_4x4_vs_lib4(int k, float *alpha, float *A, int offsetB, float *B, int sdb, float *beta, float *C, float *D, int km, int kn); //
|
||||
void kernel_sgemm_nn_4x4_gen_lib4(int k, float *alpha, float *A, int offsetB, float *B, int sdb, float *beta, int offsetC, float *C, int sdc, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); //
|
||||
void kernel_ssyrk_nt_l_4x4_lib4(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D); //
|
||||
void kernel_ssyrk_nt_l_4x4_vs_lib4(int k, float *alpha, float *A, float *B, float *beta, float *C, float *D, int km, int kn); //
|
||||
void kernel_ssyrk_nt_l_4x4_gen_lib4(int k, float *alpha, float *A, float *B, float *beta, int offsetC, float *C, int sdc, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); |
||||
void kernel_strmm_nt_ru_4x4_lib4(int k, float *alpha, float *A, float *B, float *D); //
|
||||
void kernel_strmm_nt_ru_4x4_vs_lib4(int k, float *alpha, float *A, float *B, float *D, int km, int kn); //
|
||||
void kernel_strmm_nn_rl_4x4_lib4(int k, float *alpha, float *A, int offsetB, float *B, int sdb, float *D); |
||||
void kernel_strmm_nn_rl_4x4_gen_lib4(int k, float *alpha, float *A, int offsetB, float *B, int sdb, int offsetD, float *D, int sdd, int m0, int m1, int n0, int n1); |
||||
void kernel_strsm_nt_rl_inv_4x4_lib4(int k, float *A, float *B, float *beta, float *C, float *D, float *E, float *inv_diag_E); |
||||
void kernel_strsm_nt_rl_inv_4x4_vs_lib4(int k, float *A, float *B, float *beta, float *C, float *D, float *E, float *inv_diag_E, int km, int kn); |
||||
void kernel_strsm_nt_rl_one_4x4_lib4(int k, float *A, float *B, float *beta, float *C, float *D, float *E); |
||||
void kernel_strsm_nt_rl_one_4x4_vs_lib4(int k, float *A, float *B, float *beta, float *C, float *D, float *E, int km, int kn); |
||||
void kernel_strsm_nt_ru_inv_4x4_lib4(int k, float *A, float *B, float *beta, float *C, float *D, float *E, float *inv_diag_E); |
||||
void kernel_strsm_nt_ru_inv_4x4_vs_lib4(int k, float *A, float *B, float *beta, float *C, float *D, float *E, float *inv_diag_E, int km, int kn); |
||||
void kernel_strsm_nt_ru_one_4x4_lib4(int k, float *A, float *B, float *beta, float *C, float *D, float *E); |
||||
void kernel_strsm_nt_ru_one_4x4_vs_lib4(int k, float *A, float *B, float *beta, float *C, float *D, float *E, int km, int kn); |
||||
void kernel_strsm_nn_ru_inv_4x4_lib4(int k, float *A, float *B, int sdb, float *beta, float *C, float *D, float *E, float *inv_diag_E); |
||||
void kernel_strsm_nn_ru_inv_4x4_vs_lib4(int k, float *A, float *B, int sdb, float *beta, float *C, float *D, float *E, float *inv_diag_E, int km, int kn); |
||||
void kernel_strsm_nn_ll_one_4x4_lib4(int k, float *A, float *B, int sdb, float *C, float *D, float *E); |
||||
void kernel_strsm_nn_ll_one_4x4_vs_lib4(int k, float *A, float *B, int sdb, float *C, float *D, float *E, int km, int kn); |
||||
void kernel_strsm_nn_lu_inv_4x4_lib4(int kmax, float *A, float *B, int sdb, float *C, float *D, float *E, float *inv_diag_E); |
||||
void kernel_strsm_nn_lu_inv_4x4_vs_lib4(int kmax, float *A, float *B, int sdb, float *C, float *D, float *E, float *inv_diag_E, int km, int kn); |
||||
// diag
|
||||
void kernel_sgemm_diag_right_4_a0_lib4(int kmax, float *alpha, float *A, int sda, float *B, float *D, int sdd); |
||||
void kernel_sgemm_diag_right_4_lib4(int kmax, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); |
||||
void kernel_sgemm_diag_right_3_lib4(int kmax, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); |
||||
void kernel_sgemm_diag_right_2_lib4(int kmax, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); |
||||
void kernel_sgemm_diag_right_1_lib4(int kmax, float *alpha, float *A, int sda, float *B, float *beta, float *C, int sdc, float *D, int sdd); |
||||
void kernel_sgemm_diag_left_4_a0_lib4(int kmax, float *alpha, float *A, float *B, float *D); |
||||
void kernel_sgemm_diag_left_4_lib4(int kmax, float *alpha, float *A, float *B, float *beta, float *C, float *D); |
||||
void kernel_sgemm_diag_left_3_lib4(int kmax, float *alpha, float *A, float *B, float *beta, float *C, float *D); |
||||
void kernel_sgemm_diag_left_2_lib4(int kmax, float *alpha, float *A, float *B, float *beta, float *C, float *D); |
||||
void kernel_sgemm_diag_left_1_lib4(int kmax, float *alpha, float *A, float *B, float *beta, float *C, float *D); |
||||
|
||||
|
||||
|
||||
// LAPACK
|
||||
// 16x4
|
||||
void kernel_spotrf_nt_l_16x4_lib4(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D); |
||||
void kernel_spotrf_nt_l_16x4_vs_lib4(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D, int m1, int n1); |
||||
// 12x4
|
||||
void kernel_spotrf_nt_l_12x4_lib4(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D); |
||||
void kernel_spotrf_nt_l_12x4_vs_lib4(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D, int m1, int n1); |
||||
// 8x4
|
||||
void kernel_spotrf_nt_l_8x4_lib4(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D); |
||||
void kernel_spotrf_nt_l_8x4_vs_lib4(int k, float *A, int sda, float *B, float *C, int sdc, float *D, int sdd, float *inv_diag_D, int m1, int n1); |
||||
// 4x4
|
||||
void kernel_spotrf_nt_l_4x4_lib4(int k, float *A, float *B, float *C, float *D, float *inv_diag_D); |
||||
void kernel_spotrf_nt_l_4x4_vs_lib4(int k, float *A, float *B, float *C, float *D, float *inv_diag_D, int km, int kn); |
||||
void kernel_sgetrf_nn_4x4_lib4(int k, float *A, float *B, int sdb, float *C, float *D, float *inv_diag_D); |
||||
void kernel_sgetrf_nn_4x4_vs_lib4(int k, float *A, float *B, int sdb, float *C, float *D, float *inv_diag_D, int km, int kn); |
||||
void kernel_sgetrf_pivot_4_lib4(int m, float *pA, int sda, float *inv_diag_A, int* ipiv); |
||||
void kernel_sgetrf_pivot_4_vs_lib4(int m, int n, float *pA, int sda, float *inv_diag_A, int* ipiv); |
||||
|
||||
|
||||
|
||||
// merged routines
|
||||
// 4x4
|
||||
void kernel_sgemm_strsm_nt_rl_inv_4x4_lib4(int kp, float *Ap, float *Bp, int km_, float *Am, float *Bm, float *C, float *D, float *E, float *inv_diag_E); |
||||
void kernel_sgemm_strsm_nt_rl_inv_4x4_vs_lib4(int kp, float *Ap, float *Bp, int km_, float *Am, float *Bm, float *C, float *D, float *E, float *inv_diag_E, int km, int kn); |
||||
void kernel_ssyrk_spotrf_nt_l_4x4_vs_lib4(int kp, float *Ap, float *Bp, int km_, float *Am, float *Bm, float *C, float *D, float *inv_diag_D, int km, int kn); |
||||
void kernel_ssyrk_spotrf_nt_l_4x4_lib4(int kp, float *Ap, float *Bp, int km_, float *Am, float *Bm, float *C, float *D, float *inv_diag_D); |
||||
|
||||
|
||||
|
||||
// auxiliary routines
|
||||
void kernel_strcp_l_4_0_lib4(int kmax, float *A, float *B); |
||||
void kernel_strcp_l_4_1_lib4(int kmax, float *A0, int sda, float *B); |
||||
void kernel_strcp_l_4_2_lib4(int kmax, float *A0, int sda, float *B); |
||||
void kernel_strcp_l_4_3_lib4(int kmax, float *A0, int sda, float *B); |
||||
void kernel_strcp_l_3_0_lib4(int kmax, float *A, float *B); |
||||
void kernel_strcp_l_3_2_lib4(int kmax, float *A0, int sda, float *B); |
||||
void kernel_strcp_l_3_3_lib4(int kmax, float *A0, int sda, float *B); |
||||
void kernel_strcp_l_2_0_lib4(int kmax, float *A, float *B); |
||||
void kernel_strcp_l_2_3_lib4(int kmax, float *A0, int sda, float *B); |
||||
void kernel_strcp_l_1_0_lib4(int kmax, float *A, float *B); |
||||
void kernel_sgead_4_0_lib4(int kmax, float *alpha, float *A, float *B); |
||||
void kernel_sgead_4_1_lib4(int kmax, float *alpha, float *A0, int sda, float *B); |
||||
void kernel_sgead_4_2_lib4(int kmax, float *alpha, float *A0, int sda, float *B); |
||||
void kernel_sgead_4_3_lib4(int kmax, float *alpha, float *A0, int sda, float *B); |
||||
void kernel_sgead_3_0_lib4(int kmax, float *alpha, float *A, float *B); |
||||
void kernel_sgead_3_2_lib4(int kmax, float *alpha, float *A0, int sda, float *B); |
||||
void kernel_sgead_3_3_lib4(int kmax, float *alpha, float *A0, int sda, float *B); |
||||
void kernel_sgead_2_0_lib4(int kmax, float *alpha, float *A, float *B); |
||||
void kernel_sgead_2_3_lib4(int kmax, float *alpha, float *A0, int sda, float *B); |
||||
void kernel_sgead_1_0_lib4(int kmax, float *alpha, float *A, float *B); |
||||
// TODO
|
||||
void kernel_sgeset_4_lib4(int kmax, float alpha, float *A); |
||||
void kernel_strset_4_lib4(int kmax, float alpha, float *A); |
||||
void kernel_sgetr_4_lib4(int tri, int kmax, int kna, float alpha, float *A, float *C, int sdc); |
||||
void kernel_sgetr_3_lib4(int tri, int kmax, int kna, float alpha, float *A, float *C, int sdc); |
||||
void kernel_sgetr_2_lib4(int tri, int kmax, int kna, float alpha, float *A, float *C, int sdc); |
||||
void kernel_sgetr_1_lib4(int tri, int kmax, int kna, float alpha, float *A, float *C, int sdc); |
||||
|
||||
|
||||
|
||||
// pack
|
||||
// 24 lib 8
|
||||
void kernel_spack_nn_24_lib8(int kmax, float *A, int lda, float *B, int sdb); |
||||
void kernel_spack_nn_24_vs_lib8(int kmax, float *A, int lda, float *B, int sdb, int m1); |
||||
// 16 lib 8
|
||||
void kernel_spack_nn_16_lib8(int kmax, float *A, int lda, float *B, int sdb); |
||||
void kernel_spack_nn_16_vs_lib8(int kmax, float *A, int lda, float *B, int sdb, int m1); |
||||
// 8 lib 8
|
||||
void kernel_spack_nn_8_lib8(int kmax, float *A, int lda, float *B); |
||||
void kernel_spack_nn_8_vs_lib8(int kmax, float *A, int lda, float *B, int m1); |
||||
void kernel_spack_tn_8_lib8(int kmax, float *A, int lda, float *B); |
||||
void kernel_spack_tn_8_vs_lib8(int kmax, float *A, int lda, float *B, int m1); |
||||
void kernel_spack_tt_8_lib8(int kmax, float *A, int lda, float *B, int sdb); |
||||
void kernel_spack_tt_8_vs_lib8(int kmax, float *A, int lda, float *B, int sdb, int m1); |
||||
// 8 lib 4
|
||||
void kernel_spack_nn_8_lib4(int kmax, float *A, int lda, float *B, int sdb); |
||||
void kernel_spack_nn_8_vs_lib4(int kmax, float *A, int lda, float *B, int sdb, int m1); |
||||
//void kernel_spack_tt_8_lib4(int kmax, float *A, int lda, float *B, int sdb);
|
||||
// 4
|
||||
void kernel_spack_nn_4_lib4(int kmax, float *A, int lda, float *B); |
||||
void kernel_spack_nn_4_vs_lib4(int kmax, float *A, int lda, float *B, int m1); |
||||
void kernel_spack_tn_4_lib4(int kmax, float *A, int lda, float *B); |
||||
void kernel_spack_tn_4_vs_lib4(int kmax, float *A, int lda, float *B, int m1); |
||||
void kernel_spack_tt_4_lib4(int kmax, float *A, int lda, float *B, int sdb); |
||||
void kernel_spack_tt_4_vs_lib4(int kmax, float *A, int lda, float *B, int sdb, int m1); |
||||
// unpack
|
||||
// 8
|
||||
void kernel_sunpack_nn_8_lib4(int kmax, float *A, int sda, float *B, int ldb); |
||||
void kernel_sunpack_nn_8_vs_lib4(int kmax, float *A, int sda, float *B, int ldb, int m1); |
||||
//void kernel_sunpack_tt_8_lib4(int kmax, float *A, int sda, float *B, int ldb);
|
||||
// 4
|
||||
void kernel_sunpack_nn_4_lib4(int kmax, float *A, float *B, int ldb); |
||||
void kernel_sunpack_nn_4_vs_lib4(int kmax, float *A, float *B, int ldb, int m1); |
||||
void kernel_sunpack_nt_4_lib4(int kmax, float *A, float *B, int ldb); |
||||
void kernel_sunpack_nt_4_vs_lib4(int kmax, float *A, float *B, int ldb, int m1); |
||||
void kernel_sunpack_tt_4_lib4(int kmax, float *A, int sda, float *B, int ldb); |
||||
|
||||
// panel copy
|
||||
// 4
|
||||
void kernel_spacp_nt_4_lib4(int kmax, float *A, int offsetB, float *B, int sdb); |
||||
void kernel_spacp_tn_4_lib4(int kmax, int offsetA, float *A, int sda, float *B); |
||||
void kernel_spacp_nn_4_lib4(int kmax, int offsetA, float *A, int sda, float *B); |
||||
void kernel_spacp_nn_4_vs_lib4(int kmax, int offsetA, float *A, int sda, float *B, int m1); |
||||
|
||||
|
||||
|
||||
/************************************************
|
||||
* BLAS API kernels |
||||
************************************************/ |
||||
|
||||
//#if defined(BLAS_API)
|
||||
|
||||
// A, B panel-major bs=8; C, D column-major
|
||||
// 24x4
|
||||
void kernel_sgemm_nt_24x4_lib88cc(int kmax, float *alpha, float *A, int sda, float *B, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_24x4_vs_lib88cc(int kmax, float *alpha, float *A, int sda, float *B, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
// 16x4
|
||||
void kernel_sgemm_nt_16x4_lib88cc(int kmax, float *alpha, float *A, int sda, float *B, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_16x4_vs_lib88cc(int kmax, float *alpha, float *A, int sda, float *B, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
// 8x8
|
||||
void kernel_sgemm_nt_8x8_lib88cc(int kmax, float *alpha, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_8x8_vs_lib88cc(int kmax, float *alpha, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_spotrf_nt_l_8x8_lib88cc(int kmax, float *A, float *B, float *C, int ldc, float *D, int ldd, float *dD); |
||||
void kernel_spotrf_nt_l_8x8_vs_lib88cc(int kmax, float *A, float *B, float *C, int ldc, float *D, int ldd, float *dD, int m1, int n1); |
||||
void kernel_strsm_nt_rl_inv_8x8_lib88ccc(int kmax, float *A, float *B, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE); |
||||
void kernel_strsm_nt_rl_inv_8x8_vs_lib88ccc(int kmax, float *A, float *B, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE, int m1, int n1); |
||||
// 8x4
|
||||
void kernel_sgemm_nt_8x4_lib88cc(int kmax, float *alpha, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_8x4_vs_lib88cc(int kmax, float *alpha, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
|
||||
// A, B panel-major bs=4; C, D column-major
|
||||
// 8x8
|
||||
void kernel_sgemm_nt_8x8_lib44cc(int kmax, float *alpha, float *A, int sda, float *B, int sdb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
// 8x4
|
||||
void kernel_sgemm_nt_8x4_lib44cc(int kmax, float *alpha, float *A, int sda, float *B, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_8x4_vs_lib44cc(int kmax, float *alpha, float *A, int sda, float *B, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_spotrf_nt_l_8x4_lib44cc(int kmax, float *A, int sda, float *B, float *C, int ldc, float *D, int ldd, float *dD); |
||||
void kernel_strsm_nt_rl_inv_8x4_lib44ccc(int kmax, float *A, int sda, float *B, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE); |
||||
void kernel_strsm_nt_rl_inv_8x4_vs_lib44ccc(int kmax, float *A, int sda, float *B, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE, int m1, int n1); |
||||
// 4x4
|
||||
void kernel_sgemm_nt_4x4_lib44cc(int kmax, float *alpha, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_4x4_vs_lib44cc(int kmax, float *alpha, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_strsm_nt_rl_inv_4x4_lib44cc4(int kmax, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd, float *E, float *dE); |
||||
void kernel_strsm_nt_rl_inv_4x4_vs_lib44cc4(int kmax, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd, float *E, float *dE, int m1, int n1); |
||||
void kernel_strsm_nt_rl_inv_4x4_lib44ccc(int kmax, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE); |
||||
void kernel_strsm_nt_rl_inv_4x4_vs_lib44ccc(int kmax, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE, int m1, int n1); |
||||
void kernel_strsm_nt_rl_one_4x4_lib44cc4(int kmax, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd, float *E); |
||||
void kernel_strsm_nt_rl_one_4x4_vs_lib44cc4(int kmax, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd, float *E, int m1, int n1); |
||||
void kernel_strsm_nt_ru_inv_4x4_lib44cc4(int kmax, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd, float *E, float *dE); |
||||
void kernel_strsm_nt_ru_inv_4x4_vs_lib44cc4(int kmax, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd, float *E, float *dE, int m1, int n1); |
||||
void kernel_strsm_nt_ru_one_4x4_lib44cc4(int kmax, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd, float *E); |
||||
void kernel_strsm_nt_ru_one_4x4_vs_lib44cc4(int kmax, float *A, float *B, float *beta, float *C, int ldc, float *D, int ldd, float *E, int m1, int n1); |
||||
void kernel_spotrf_nt_l_4x4_lib44cc(int kmax, float *A, float *B, float *C, int ldc, float *D, int ldd, float *dD); |
||||
void kernel_spotrf_nt_l_4x4_vs_lib44cc(int kmax, float *A, float *B, float *C, int ldc, float *D, int ldd, float *dD, int m1, int n1); |
||||
|
||||
// B panel-major bs=8; A, C, D column-major
|
||||
// 8x8
|
||||
void kernel_sgemm_nt_8x8_libc8cc(int kmax, float *alpha, float *A, int lda, float *B, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_8x8_vs_libc8cc(int kmax, float *alpha, float *A, int lda, float *B, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_sgemm_tt_8x8_libc8cc(int kmax, float *alpha, float *A, int lda, float *B, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_tt_8x8_vs_libc8cc(int kmax, float *alpha, float *A, int lda, float *B, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
// 4x8
|
||||
void kernel_sgemm_nt_4x8_libc8cc(int kmax, float *alpha, float *A, int lda, float *B, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_4x8_vs_libc8cc(int kmax, float *alpha, float *A, int lda, float *B, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_sgemm_tt_4x8_libc8cc(int kmax, float *alpha, float *A, int lda, float *B, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_tt_4x8_vs_libc8cc(int kmax, float *alpha, float *A, int lda, float *B, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
|
||||
// B panel-major bs=4; A, C, D column-major
|
||||
// 8x8
|
||||
void kernel_sgemm_nt_8x8_libc4cc(int kmax, float *alpha, float *A, int lda, float *B, int sdb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_8x8_vs_libc4cc(int kmax, float *alpha, float *A, int lda, float *B, int sdb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_sgemm_tt_8x8_libc4cc(int kmax, float *alpha, float *A, int lda, float *B, int sdb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_tt_8x8_vs_libc4cc(int kmax, float *alpha, float *A, int lda, float *B, int sdb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
// 4x8
|
||||
void kernel_sgemm_nt_4x8_libc4cc(int kmax, float *alpha, float *A, int lda, float *B, int sdb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_4x8_vs_libc4cc(int kmax, float *alpha, float *A, int lda, float *B, int sdb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_sgemm_tt_4x8_libc4cc(int kmax, float *alpha, float *A, int lda, float *B, int sdb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_tt_4x8_vs_libc4cc(int kmax, float *alpha, float *A, int lda, float *B, int sdb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
// 4x4
|
||||
void kernel_sgemm_nt_4x4_libc4cc(int kmax, float *alpha, float *A, int lda, float *B, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_4x4_vs_libc4cc(int kmax, float *alpha, float *A, int lda, float *B, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_sgemm_tt_4x4_libc4cc(int kmax, float *alpha, float *A, int lda, float *B, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_tt_4x4_vs_libc4cc(int kmax, float *alpha, float *A, int lda, float *B, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
|
||||
// A panel-major bs=8; B, C, D column-major
|
||||
// 24x4
|
||||
void kernel_sgemm_nn_24x4_lib8ccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nn_24x4_vs_lib8ccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_sgemm_nt_24x4_lib8ccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_24x4_vs_lib8ccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
// 16x4
|
||||
void kernel_sgemm_nn_16x4_lib8ccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nn_16x4_vs_lib8ccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_sgemm_nt_16x4_lib8ccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_16x4_vs_lib8ccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
// 8x8
|
||||
void kernel_sgemm_nn_8x8_lib8ccc(int kmax, float *alpha, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nn_8x8_vs_lib8ccc(int kmax, float *alpha, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_sgemm_nt_8x8_lib8ccc(int kmax, float *alpha, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_8x8_vs_lib8ccc(int kmax, float *alpha, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
// 8x4
|
||||
void kernel_sgemm_nn_8x4_lib8ccc(int kmax, float *alpha, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nn_8x4_vs_lib8ccc(int kmax, float *alpha, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_sgemm_nt_8x4_lib8ccc(int kmax, float *alpha, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_8x4_vs_lib8ccc(int kmax, float *alpha, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
|
||||
// A panel-major bs=4; B, C, D column-major
|
||||
// 8x8
|
||||
void kernel_sgemm_nn_8x8_lib4ccc(int kmax, float *alpha, float *A, int sda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_8x8_lib4ccc(int kmax, float *alpha, float *A, int sda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
// 8x4
|
||||
void kernel_sgemm_nn_8x4_lib4ccc(int kmax, float *alpha, float *A, int sda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nn_8x4_vs_lib4ccc(int kmax, float *alpha, float *A, int sda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_sgemm_nt_8x4_lib4ccc(int kmax, float *alpha, float *A, int sda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_8x4_vs_lib4ccc(int kmax, float *alpha, float *A, int sda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
// 4x4
|
||||
void kernel_sgemm_nn_4x4_lib4ccc(int kmax, float *alpha, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nn_4x4_vs_lib4ccc(int kmax, float *alpha, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_sgemm_nt_4x4_lib4ccc(int kmax, float *alpha, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_4x4_vs_lib4ccc(int kmax, float *alpha, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_strsm_nn_rl_inv_4x4_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE); |
||||
void kernel_strsm_nn_rl_inv_4x4_vs_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE, int m1, int n1); |
||||
void kernel_strsm_nn_rl_one_4x4_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde); |
||||
void kernel_strsm_nn_rl_one_4x4_vs_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, int m1, int n1); |
||||
void kernel_strsm_nt_rl_inv_4x4_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE); |
||||
void kernel_strsm_nt_rl_inv_4x4_vs_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE, int m1, int n1); |
||||
void kernel_strsm_nt_rl_one_4x4_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde); |
||||
void kernel_strsm_nt_rl_one_4x4_vs_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, int m1, int n1); |
||||
void kernel_strsm_nn_ru_inv_4x4_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE); |
||||
void kernel_strsm_nn_ru_inv_4x4_vs_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE, int m1, int n1); |
||||
void kernel_strsm_nn_ru_one_4x4_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde); |
||||
void kernel_strsm_nn_ru_one_4x4_vs_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, int m1, int n1); |
||||
void kernel_strsm_nt_ru_inv_4x4_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE); |
||||
void kernel_strsm_nt_ru_inv_4x4_vs_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, float *dE, int m1, int n1); |
||||
void kernel_strsm_nt_ru_one_4x4_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde); |
||||
void kernel_strsm_nt_ru_one_4x4_vs_lib4cccc(int kmax, float *A, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, float *E, int lde, int m1, int n1); |
||||
|
||||
// A, C, D panel-major; B, E column-major
|
||||
// TODO merge with above
|
||||
// 4x4
|
||||
void kernel_strsm_nn_rl_inv_4x4_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde, float *dE); |
||||
void kernel_strsm_nn_rl_inv_4x4_vs_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde, float *dE, int m1, int n1); |
||||
void kernel_strsm_nn_rl_one_4x4_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde); |
||||
void kernel_strsm_nn_rl_one_4x4_vs_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde, int m1, int n1); |
||||
void kernel_strsm_nn_ru_inv_4x4_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde, float *dE); |
||||
void kernel_strsm_nn_ru_inv_4x4_vs_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde, float *dE, int m1, int n1); |
||||
void kernel_strsm_nn_ru_one_4x4_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde); |
||||
void kernel_strsm_nn_ru_one_4x4_vs_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde, int m1, int n1); |
||||
void kernel_strsm_nt_rl_inv_4x4_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde, float *dE); |
||||
void kernel_strsm_nt_rl_inv_4x4_vs_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde, float *dE, int m1, int n1); |
||||
void kernel_strsm_nt_rl_one_4x4_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde); |
||||
void kernel_strsm_nt_rl_one_4x4_vs_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde, int m1, int n1); |
||||
void kernel_strsm_nt_ru_inv_4x4_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde, float *dE); |
||||
void kernel_strsm_nt_ru_inv_4x4_vs_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde, float *dE, int m1, int n1); |
||||
void kernel_strsm_nt_ru_one_4x4_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde); |
||||
void kernel_strsm_nt_ru_one_4x4_vs_lib4c44c(int kmax, float *A, float *B, int ldb, float *beta, float *C, float *D, float *E, int lde, int m1, int n1); |
||||
|
||||
// A, B, C, D column-major
|
||||
void kernel_sgemm_nn_4x4_libcccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nn_4x4_vs_libcccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_sgemm_nt_4x4_libcccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_nt_4x4_vs_libcccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
void kernel_sgemm_tt_4x4_libcccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd); |
||||
void kernel_sgemm_tt_4x4_vs_libcccc(int kmax, float *alpha, float *A, int lda, float *B, int ldb, float *beta, float *C, int ldc, float *D, int ldd, int m1, int n1); |
||||
|
||||
// vector
|
||||
void kernel_sdot_11_lib(int n, float *x, float *y, float *res); |
||||
void kernel_saxpy_11_lib(int n, float *alpha, float *x, float *y); |
||||
|
||||
|
||||
//#endif // BLAS_API
|
||||
|
||||
|
||||
|
||||
// larger kernels
|
||||
// 24
|
||||
void kernel_sgemm_nt_24xn_p0_lib88cc(int n, int k, float *alpha, float *A, int sda, float *B, int sdb, float *beta, float *C, int ldc, float *D, int ldd, float *A_p, float *B_p); |
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_S_KERNEL_H_
|
@ -0,0 +1,62 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_STDLIB_H_ |
||||
#define BLASFEO_STDLIB_H_ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
#include <stdlib.h> |
||||
|
||||
//
|
||||
void blasfeo_malloc(void **ptr, size_t size); |
||||
//
|
||||
void blasfeo_malloc_align(void **ptr, size_t size); |
||||
//
|
||||
void blasfeo_free(void *ptr); |
||||
//
|
||||
void blasfeo_free_align(void *ptr); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif // BLASFEO_STDLIB_H_
|
@ -0,0 +1,73 @@ |
||||
#ifndef TARGET_X64_INTEL_HASWELL |
||||
#define TARGET_X64_INTEL_HASWELL |
||||
#endif |
||||
|
||||
#ifndef TARGET_NEED_FEATURE_AVX2 |
||||
#define TARGET_NEED_FEATURE_AVX2 1 |
||||
#endif |
||||
|
||||
#ifndef TARGET_NEED_FEATURE_FMA |
||||
#define TARGET_NEED_FEATURE_FMA 1 |
||||
#endif |
||||
|
||||
#ifndef TARGET_NEED_FEATURE_SSE3 |
||||
/* #undef TARGET_NEED_FEATURE_SSE3 */ |
||||
#endif |
||||
|
||||
#ifndef TARGET_NEED_FEATURE_AVX |
||||
/* #undef TARGET_NEED_FEATURE_AVX */ |
||||
#endif |
||||
|
||||
#ifndef TARGET_NEED_FEATURE_VFPv3 |
||||
/* #undef TARGET_NEED_FEATURE_VFPv3 */ |
||||
#endif |
||||
|
||||
#ifndef TARGET_NEED_FEATURE_NEON |
||||
/* #undef TARGET_NEED_FEATURE_NEON */ |
||||
#endif |
||||
|
||||
#ifndef TARGET_NEED_FEATURE_VFPv4 |
||||
/* #undef TARGET_NEED_FEATURE_VFPv4 */ |
||||
#endif |
||||
|
||||
#ifndef TARGET_NEED_FEATURE_NEONv2 |
||||
/* #undef TARGET_NEED_FEATURE_NEONv2 */ |
||||
#endif |
||||
|
||||
#ifndef LA_HIGH_PERFORMANCE |
||||
#define LA_HIGH_PERFORMANCE |
||||
#endif |
||||
|
||||
#ifndef MF_PANELMAJ |
||||
#define MF_PANELMAJ |
||||
#endif |
||||
|
||||
#ifndef EXT_DEP |
||||
#define ON 1 |
||||
#define OFF 0 |
||||
#if ON==ON |
||||
#define EXT_DEP |
||||
#endif |
||||
#undef ON |
||||
#undef OFF |
||||
#endif |
||||
|
||||
#ifndef BLAS_API |
||||
#define ON 1 |
||||
#define OFF 0 |
||||
#if OFF==ON |
||||
#define BLAS_API |
||||
#endif |
||||
#undef ON |
||||
#undef OFF |
||||
#endif |
||||
|
||||
#ifndef FORTRAN_BLAS_API |
||||
#define ON 1 |
||||
#define OFF 0 |
||||
#if OFF==ON |
||||
#define FORTRAN_BLAS_API |
||||
#endif |
||||
#undef ON |
||||
#undef OFF |
||||
#endif |
@ -0,0 +1,114 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_TIMING_H_ |
||||
#define BLASFEO_TIMING_H_ |
||||
|
||||
//#include <stdbool.h>
|
||||
|
||||
#if (defined _WIN32 || defined _WIN64) && !(defined __MINGW32__ || defined __MINGW64__) |
||||
|
||||
/* Use Windows QueryPerformanceCounter for timing. */ |
||||
#include <Windows.h> |
||||
|
||||
/** A structure for keeping internal timer data. */ |
||||
typedef struct blasfeo_timer_ { |
||||
LARGE_INTEGER tic; |
||||
LARGE_INTEGER toc; |
||||
LARGE_INTEGER freq; |
||||
} blasfeo_timer; |
||||
|
||||
#elif(defined __APPLE__) |
||||
|
||||
#include <mach/mach_time.h> |
||||
|
||||
/** A structure for keeping internal timer data. */ |
||||
typedef struct blasfeo_timer_ { |
||||
uint64_t tic; |
||||
uint64_t toc; |
||||
mach_timebase_info_data_t tinfo; |
||||
} blasfeo_timer; |
||||
|
||||
#elif(defined __DSPACE__) |
||||
|
||||
#include <brtenv.h> |
||||
|
||||
typedef struct blasfeo_timer_ { |
||||
double time; |
||||
} blasfeo_timer; |
||||
|
||||
#elif(defined __XILINX_NONE_ELF__ || defined __XILINX_ULTRASCALE_NONE_ELF_JAILHOUSE__) |
||||
|
||||
#include "xtime_l.h" |
||||
|
||||
typedef struct blasfeo_timer_ { |
||||
uint64_t tic; |
||||
uint64_t toc; |
||||
} blasfeo_timer; |
||||
|
||||
#else |
||||
|
||||
/* Use POSIX clock_gettime() for timing on non-Windows machines. */ |
||||
#include <time.h> |
||||
|
||||
#if __STDC_VERSION__ >= 199901L // C99 Mode
|
||||
|
||||
#include <sys/stat.h> |
||||
#include <sys/time.h> |
||||
|
||||
typedef struct blasfeo_timer_ { |
||||
struct timeval tic; |
||||
struct timeval toc; |
||||
} blasfeo_timer; |
||||
|
||||
#else // ANSI C Mode
|
||||
|
||||
/** A structure for keeping internal timer data. */ |
||||
typedef struct blasfeo_timer_ { |
||||
struct timespec tic; |
||||
struct timespec toc; |
||||
} blasfeo_timer; |
||||
|
||||
#endif // __STDC_VERSION__ >= 199901L
|
||||
|
||||
#endif // (defined _WIN32 || defined _WIN64)
|
||||
|
||||
/** A function for measurement of the current time. */ |
||||
void blasfeo_tic(blasfeo_timer* t); |
||||
|
||||
/** A function which returns the elapsed time. */ |
||||
double blasfeo_toc(blasfeo_timer* t); |
||||
|
||||
#endif // BLASFEO_TIMING_H_
|
@ -0,0 +1,83 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef BLASFEO_V_AUX_EXT_DEP_H_ |
||||
#define BLASFEO_V_AUX_EXT_DEP_H_ |
||||
|
||||
|
||||
|
||||
#include "blasfeo_target.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
/************************************************
|
||||
* d_aux_extern_depend_lib.c |
||||
************************************************/ |
||||
|
||||
#ifdef EXT_DEP |
||||
|
||||
void v_zeros(void **ptrA, int size); |
||||
// dynamically allocate size bytes of memory aligned to 64-byte boundaries and set accordingly a pointer to void; set allocated memory to zero
|
||||
void v_zeros_align(void **ptrA, int size); |
||||
// free the memory allocated by v_zeros
|
||||
void v_free(void *ptrA); |
||||
// free the memory allocated by v_zeros_aligned
|
||||
void v_free_align(void *ptrA); |
||||
// dynamically allocate size bytes of memory and set accordingly a pointer to char; set allocated memory to zero
|
||||
void c_zeros(char **ptrA, int size); |
||||
// dynamically allocate size bytes of memory aligned to 64-byte boundaries and set accordingly a pointer to char; set allocated memory to zero
|
||||
void c_zeros_align(char **ptrA, int size); |
||||
// free the memory allocated by c_zeros
|
||||
void c_free(char *ptrA); |
||||
// free the memory allocated by c_zeros_aligned
|
||||
void c_free_align(char *ptrA); |
||||
|
||||
#endif // EXT_DEP
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // BLASFEO_V_AUX_EXT_DEP_H_
|
@ -0,0 +1,77 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
// headers to reference BLAS and LAPACK routines employed in BLASFEO WR
|
||||
|
||||
// level 1
|
||||
double ddot_(int *m, double *x, int *incx, double *y, int *incy); |
||||
void dcopy_(int *m, double *x, int *incx, double *y, int *incy); |
||||
void daxpy_(int *m, double *alpha, double *x, int *incx, double *y, int *incy); |
||||
void dscal_(int *m, double *alpha, double *x, int *incx); |
||||
void drot_(int *m, double *x, int *incx, double *y, int *incy, double *c, double *s); |
||||
void drotg_(double *a, double *b, double *c, double *s); |
||||
|
||||
// level 2
|
||||
void dgemv_(char *ta, int *m, int *n, double *alpha, double *A, int *lda, double *x, int *incx, double *beta, double *y, int *incy); |
||||
void dsymv_(char *uplo, int *m, double *alpha, double *A, int *lda, double *x, int *incx, double *beta, double *y, int *incy); |
||||
void dtrmv_(char *uplo, char *trans, char *diag, int *n, double *A, int *lda, double *x, int *incx); |
||||
void dtrsv_(char *uplo, char *trans, char *diag, int *n, double *A, int *lda, double *x, int *incx); |
||||
void dger_(int *m, int *n, double *alpha, double *x, int *incx, double *y, int *incy, double *A, int *lda); |
||||
|
||||
// level 3
|
||||
void dgemm_(char *ta, char *tb, int *m, int *n, int *k, double *alpha, double *A, int *lda, double *B, int *ldb, double *beta, double *C, int *ldc); |
||||
void dsyrk_(char *uplo, char *trans, int *n, int *k, double *alpha, double *A, int *lda, double *beta, double *C, int *ldc); |
||||
void dtrmm_(char *side, char *uplo, char *trans, char *diag, int *m, int *n, double *alpha, double *A, int *lda, double *B, int *ldb); |
||||
void dtrsm_(char *side, char *uplo, char *trans, char *diag, int *m, int *n, double *alpha, double *A, int *lda, double *B, int *ldb); |
||||
|
||||
// lapack
|
||||
void dpotrf_(char *uplo, int *m, double *A, int *lda, int *info); |
||||
void dgetrf_(int *m, int *n, double *A, int *lda, int *ipiv, int *info); |
||||
void dgeqrf_(int *m, int *n, double *A, int *lda, double *tau, double *work, int *lwork, int *info); |
||||
void dgeqr2_(int *m, int *n, double *A, int *lda, double *tau, double *work, int *info); |
||||
void dgelqf_(int *m, int *n, double *A, int *lda, double *tau, double *work, int *lwork, int *info); |
||||
void dorglq_(int *m, int *n, int *k, double *A, int *lda, double *tau, double *work, int *lwork, int *info); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
@ -0,0 +1,73 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
// headers to reference BLAS and LAPACK routines employed in BLASFEO WR
|
||||
|
||||
// level 1
|
||||
double ddot_(long long *m, double *x, long long *incx, double *y, long long *incy); |
||||
void dcopy_(long long *m, double *x, long long *incx, double *y, long long *incy); |
||||
void daxpy_(long long *m, double *alpha, double *x, long long *incx, double *y, long long *incy); |
||||
void dscal_(long long *m, double *alpha, double *x, long long *incx); |
||||
|
||||
// level 2
|
||||
void dgemv_(char *ta, long long *m, long long *n, double *alpha, double *A, long long *lda, double *x, long long *incx, double *beta, double *y, long long *incy); |
||||
void dsymv_(char *uplo, long long *m, double *alpha, double *A, long long *lda, double *x, long long *incx, double *beta, double *y, long long *incy); |
||||
void dtrmv_(char *uplo, char *trans, char *diag, long long *n, double *A, long long *lda, double *x, long long *incx); |
||||
void dtrsv_(char *uplo, char *trans, char *diag, long long *n, double *A, long long *lda, double *x, long long *incx); |
||||
void dger_(long long *m, long long *n, double *alpha, double *x, long long *incx, double *y, long long *incy, double *A, long long *lda); |
||||
|
||||
// level 3
|
||||
void dgemm_(char *ta, char *tb, long long *m, long long *n, long long *k, double *alpha, double *A, long long *lda, double *B, long long *ldb, double *beta, double *C, long long *ldc); |
||||
void dsyrk_(char *uplo, char *trans, long long *n, long long *k, double *alpha, double *A, long long *lda, double *beta, double *C, long long *ldc); |
||||
void dtrmm_(char *side, char *uplo, char *trans, char *diag, long long *m, long long *n, double *alpha, double *A, long long *lda, double *B, long long *ldb); |
||||
void dtrsm_(char *side, char *uplo, char *trans, char *diag, long long *m, long long *n, double *alpha, double *A, long long *lda, double *B, long long *ldb); |
||||
|
||||
// lapack
|
||||
void dpotrf_(char *uplo, long long *m, double *A, long long *lda, long long *info); |
||||
void dgetrf_(long long *m, long long *n, double *A, long long *lda, long long *ipiv, long long *info); |
||||
void dgeqrf_(long long *m, long long *n, double *A, long long *lda, double *tau, double *work, long long *lwork, long long *info); |
||||
void dgeqr2_(long long *m, long long *n, double *A, long long *lda, double *tau, double *work, long long *info); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
@ -0,0 +1,77 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
// headers to reference BLAS and LAPACK routines employed in BLASFEO WR
|
||||
|
||||
// level 1
|
||||
float sdot_(int *m, float *x, int *incx, float *y, int *incy); |
||||
void scopy_(int *m, float *x, int *incx, float *y, int *incy); |
||||
void saxpy_(int *m, float *alpha, float *x, int *incx, float *y, int *incy); |
||||
void sscal_(int *m, float *alpha, float *x, int *incx); |
||||
void srot_(int *m, float *x, int *incx, float *y, int *incy, float *c, float *s); |
||||
void srotg_(float *a, float *b, float *c, float *s); |
||||
|
||||
// level 2
|
||||
void sgemv_(char *ta, int *m, int *n, float *alpha, float *A, int *lda, float *x, int *incx, float *beta, float *y, int *incy); |
||||
void ssymv_(char *uplo, int *m, float *alpha, float *A, int *lda, float *x, int *incx, float *beta, float *y, int *incy); |
||||
void strmv_(char *uplo, char *trans, char *diag, int *n, float *A, int *lda, float *x, int *incx); |
||||
void strsv_(char *uplo, char *trans, char *diag, int *n, float *A, int *lda, float *x, int *incx); |
||||
void sger_(int *m, int *n, float *alpha, float *x, int *incx, float *y, int *incy, float *A, int *lda); |
||||
|
||||
// level 3
|
||||
void sgemm_(char *ta, char *tb, int *m, int *n, int *k, float *alpha, float *A, int *lda, float *B, int *ldb, float *beta, float *C, int *ldc); |
||||
void ssyrk_(char *uplo, char *trans, int *n, int *k, float *alpha, float *A, int *lda, float *beta, float *C, int *ldc); |
||||
void strmm_(char *side, char *uplo, char *transa, char *diag, int *m, int *n, float *alpha, float *A, int *lda, float *B, int *ldb); |
||||
void strsm_(char *side, char *uplo, char *transa, char *diag, int *m, int *n, float *alpha, float *A, int *lda, float *B, int *ldb); |
||||
|
||||
// lapack
|
||||
void spotrf_(char *uplo, int *m, float *A, int *lda, int *info); |
||||
void sgetrf_(int *m, int *n, float *A, int *lda, int *ipiv, int *info); |
||||
void sgeqrf_(int *m, int *n, float *A, int *lda, float *tau, float *work, int *lwork, int *info); |
||||
void sgeqr2_(int *m, int *n, float *A, int *lda, float *tau, float *work, int *info); |
||||
void sgelqf_(int *m, int *n, float *A, int *lda, float *tau, float *work, int *lwork, int *info); |
||||
void sorglq_(int *m, int *n, int *k, float *A, int *lda, float *tau, float *work, int *lwork, int *info); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
@ -0,0 +1,73 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of BLASFEO. * |
||||
* * |
||||
* BLASFEO -- BLAS For Embedded Optimization. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
// headers to reference BLAS and LAPACK routines employed in BLASFEO WR
|
||||
|
||||
// level 1
|
||||
float sdot_(long long *m, float *x, long long *incx, float *y, long long *incy); |
||||
void scopy_(long long *m, float *x, long long *incx, float *y, long long *incy); |
||||
void saxpy_(long long *m, float *alpha, float *x, long long *incx, float *y, long long *incy); |
||||
void sscal_(long long *m, float *alpha, float *x, long long *incx); |
||||
|
||||
// level 2
|
||||
void sgemv_(char *ta, long long *m, long long *n, float *alpha, float *A, long long *lda, float *x, long long *incx, float *beta, float *y, long long *incy); |
||||
void ssymv_(char *uplo, long long *m, float *alpha, float *A, long long *lda, float *x, long long *incx, float *beta, float *y, long long *incy); |
||||
void strmv_(char *uplo, char *trans, char *diag, long long *n, float *A, long long *lda, float *x, long long *incx); |
||||
void strsv_(char *uplo, char *trans, char *diag, long long *n, float *A, long long *lda, float *x, long long *incx); |
||||
void sger_(long long *m, long long *n, float *alpha, float *x, long long *incx, float *y, long long *incy, float *A, long long *lda); |
||||
|
||||
// level 3
|
||||
void sgemm_(char *ta, char *tb, long long *m, long long *n, long long *k, float *alpha, float *A, long long *lda, float *B, long long *ldb, float *beta, float *C, long long *ldc); |
||||
void ssyrk_(char *uplo, char *trans, long long *n, long long *k, float *alpha, float *A, long long *lda, float *beta, float *C, long long *ldc); |
||||
void strmm_(char *side, char *uplo, char *transa, char *diag, long long *m, long long *n, float *alpha, float *A, long long *lda, float *B, long long *ldb); |
||||
void strsm_(char *side, char *uplo, char *transa, char *diag, long long *m, long long *n, float *alpha, float *A, long long *lda, float *B, long long *ldb); |
||||
|
||||
// lapack
|
||||
void spotrf_(char *uplo, long long *m, float *A, long long *lda, long long *info); |
||||
void sgetrf_(long long *m, long long *n, float *A, long long *lda, long long *ipiv, long long *info); |
||||
void sgeqrf_(long long *m, long long *n, float *A, long long *lda, float *tau, float *work, long long *lwork, long long *info); |
||||
void sgeqr2_(long long *m, long long *n, float *A, long long *lda, float *tau, float *work, long long *info); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
@ -0,0 +1,52 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_AUX_MEM_H_ |
||||
#define HPIPM_AUX_MEM_H_ |
||||
|
||||
#include "hpipm_common.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
void hpipm_zero_memset(hpipm_size_t memsize, void *mem); |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif // HPIPM_AUX_MEM_H_
|
||||
|
@ -0,0 +1,50 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_AUX_STRING_H_ |
||||
#define HPIPM_AUX_STRING_H_ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
#define MAX_STR_LEN 5 |
||||
int hpipm_strcmp(char *str1, char *str2); |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif // HPIPM_AUX_STRING_H_
|
@ -0,0 +1,76 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_COMMON_H_ |
||||
#define HPIPM_COMMON_H_ |
||||
|
||||
#include <stddef.h> |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
typedef size_t hpipm_size_t; |
||||
|
||||
enum hpipm_mode |
||||
{ |
||||
SPEED_ABS, // focus on speed, absolute IPM formulation
|
||||
SPEED, // focus on speed, relative IPM formulation
|
||||
BALANCE, // balanced mode, relative IPM formulation
|
||||
ROBUST, // focus on robustness, relative IPM formulation
|
||||
}; |
||||
|
||||
enum hpipm_status |
||||
{ |
||||
SUCCESS, // found solution satisfying accuracy tolerance
|
||||
MAX_ITER, // maximum iteration number reached
|
||||
MIN_STEP, // minimum step length reached
|
||||
NAN_SOL, // NaN in solution detected
|
||||
INCONS_EQ, // unconsistent equality constraints
|
||||
}; |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_COMMON_H_
|
||||
|
||||
|
@ -0,0 +1,71 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_D_CAST_QCQP_H_ |
||||
#define HPIPM_D_CAST_QCQP_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_dense_qcqp.h" |
||||
#include "hpipm_d_dense_qcqp_sol.h" |
||||
#include "hpipm_d_ocp_qcqp.h" |
||||
#include "hpipm_d_ocp_qcqp_dim.h" |
||||
#include "hpipm_d_ocp_qcqp_sol.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
//
|
||||
void d_cast_qcqp_compute_dim(struct d_ocp_qcqp_dim *ocp_dim, struct d_dense_qcqp_dim *dense_dim); |
||||
//
|
||||
void d_cast_qcqp_cond(struct d_ocp_qcqp *ocp_qp, struct d_dense_qcqp *dense_qp); |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_CAST_QCQP_H_
|
||||
|
@ -0,0 +1,135 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_D_COND_H_ |
||||
#define HPIPM_D_COND_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_dense_qp.h" |
||||
#include "hpipm_d_dense_qp_sol.h" |
||||
#include "hpipm_d_ocp_qp.h" |
||||
#include "hpipm_d_ocp_qp_dim.h" |
||||
#include "hpipm_d_ocp_qp_sol.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_cond_qp_arg |
||||
{ |
||||
int cond_last_stage; // condense last stage
|
||||
int cond_alg; // condensing algorithm: 0 N2-nx3, 1 N3-nx2
|
||||
int comp_prim_sol; // primal solution (v)
|
||||
int comp_dual_sol_eq; // dual solution equality constr (pi)
|
||||
int comp_dual_sol_ineq; // dual solution inequality constr (lam t)
|
||||
int square_root_alg; // square root algorithm (faster but requires RSQ>0)
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_cond_qp_ws |
||||
{ |
||||
struct blasfeo_dmat *Gamma; |
||||
struct blasfeo_dmat *GammaQ; |
||||
struct blasfeo_dmat *L; |
||||
struct blasfeo_dmat *Lx; |
||||
struct blasfeo_dmat *AL; |
||||
struct blasfeo_dvec *Gammab; |
||||
struct blasfeo_dvec *l; |
||||
struct blasfeo_dvec *tmp_nbgM; |
||||
struct blasfeo_dvec *tmp_nuxM; |
||||
int bs; // block size
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_cond_qp_arg_memsize(); |
||||
//
|
||||
void d_cond_qp_arg_create(struct d_cond_qp_arg *cond_arg, void *mem); |
||||
//
|
||||
void d_cond_qp_arg_set_default(struct d_cond_qp_arg *cond_arg); |
||||
// condensing algorithm: 0 N2-nx3, 1 N3-nx2
|
||||
void d_cond_qp_arg_set_cond_alg(int cond_alg, struct d_cond_qp_arg *cond_arg); |
||||
// set riccati-like algorithm: 0 classical, 1 square-root
|
||||
void d_cond_qp_arg_set_ric_alg(int ric_alg, struct d_cond_qp_arg *cond_arg); |
||||
// condense last stage: 0 last stage disregarded, 1 last stage condensed too
|
||||
void d_cond_qp_arg_set_cond_last_stage(int cond_last_stage, struct d_cond_qp_arg *cond_arg); |
||||
//
|
||||
void d_cond_qp_arg_set_comp_prim_sol(int value, struct d_cond_qp_arg *cond_arg); |
||||
//
|
||||
void d_cond_qp_arg_set_comp_dual_sol_eq(int value, struct d_cond_qp_arg *cond_arg); |
||||
//
|
||||
void d_cond_qp_arg_set_comp_dual_sol_ineq(int value, struct d_cond_qp_arg *cond_arg); |
||||
|
||||
//
|
||||
void d_cond_qp_compute_dim(struct d_ocp_qp_dim *ocp_dim, struct d_dense_qp_dim *dense_dim); |
||||
//
|
||||
hpipm_size_t d_cond_qp_ws_memsize(struct d_ocp_qp_dim *ocp_dim, struct d_cond_qp_arg *cond_arg); |
||||
//
|
||||
void d_cond_qp_ws_create(struct d_ocp_qp_dim *ocp_dim, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws, void *mem); |
||||
//
|
||||
void d_cond_qp_cond(struct d_ocp_qp *ocp_qp, struct d_dense_qp *dense_qp, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_cond_qp_cond_lhs(struct d_ocp_qp *ocp_qp, struct d_dense_qp *dense_qp, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_cond_qp_cond_rhs(struct d_ocp_qp *ocp_qp, struct d_dense_qp *dense_qp, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_cond_qp_expand_sol(struct d_ocp_qp *ocp_qp, struct d_dense_qp_sol *dense_qp_sol, struct d_ocp_qp_sol *ocp_qp_sol, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
// TODO remove
|
||||
void d_cond_qp_expand_primal_sol(struct d_ocp_qp *ocp_qp, struct d_dense_qp_sol *dense_qp_sol, struct d_ocp_qp_sol *ocp_qp_sol, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
|
||||
//
|
||||
void d_cond_qp_update(int *idxc, struct d_ocp_qp *ocp_qp, struct d_dense_qp *dense_qp, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_COND_H_
|
@ -0,0 +1,92 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_D_COND_AUX_H_ |
||||
#define HPIPM_D_COND_AUX_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
//
|
||||
void d_cond_BAbt(struct d_ocp_qp *ocp_qp, struct blasfeo_dmat *BAbt2, struct blasfeo_dvec *b, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_cond_BAt(struct d_ocp_qp *ocp_qp, struct blasfeo_dmat *BAbt2, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_cond_b(struct d_ocp_qp *ocp_qp, struct blasfeo_dvec *b, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_cond_RSQrq(struct d_ocp_qp *ocp_qp, struct blasfeo_dmat *RSQrq2, struct blasfeo_dvec *rq, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_cond_RSQ(struct d_ocp_qp *ocp_qp, struct blasfeo_dmat *RSQrq2, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_cond_rq(struct d_ocp_qp *ocp_qp, struct blasfeo_dvec *rq, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_cond_DCtd(struct d_ocp_qp *ocp_qp, int *idxb2, struct blasfeo_dmat *DCt2, struct blasfeo_dvec *d2, struct blasfeo_dvec *d_mask2, int *idxs_rev2, struct blasfeo_dvec *Z2, struct blasfeo_dvec *z, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_cond_DCt(struct d_ocp_qp *ocp_qp, int *idxb2, struct blasfeo_dmat *DCt2, int *idxs_rev2, struct blasfeo_dvec *Z2, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_cond_d(struct d_ocp_qp *ocp_qp, struct blasfeo_dvec *d2, struct blasfeo_dvec *d_mask2, struct blasfeo_dvec *z, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_expand_sol(struct d_ocp_qp *ocp_qp, struct d_dense_qp_sol *dense_qp_sol, struct d_ocp_qp_sol *ocp_qp_so, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_expand_primal_sol(struct d_ocp_qp *ocp_qp, struct d_dense_qp_sol *dense_qp_sol, struct d_ocp_qp_sol *ocp_qp_so, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
|
||||
//
|
||||
void d_update_cond_BAbt(int *idxc, struct d_ocp_qp *ocp_qp, struct blasfeo_dmat *BAbt2, struct blasfeo_dvec *b, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_update_cond_RSQrq_N2nx3(int *idxc, struct d_ocp_qp *ocp_qp, struct blasfeo_dmat *RSQrq2, struct blasfeo_dvec *rq, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_update_cond_DCtd(int *idxc, struct d_ocp_qp *ocp_qp, int *idxb2, struct blasfeo_dmat *DCt2, struct blasfeo_dvec *d2, int *idxs2, struct blasfeo_dvec *Z2, struct blasfeo_dvec *z, struct d_cond_qp_arg *cond_arg, struct d_cond_qp_ws *cond_ws); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_COND_AUX_H_
|
@ -0,0 +1,129 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_D_COND_QCQP_H_ |
||||
#define HPIPM_D_COND_QCQP_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_dense_qcqp.h" |
||||
#include "hpipm_d_dense_qcqp_sol.h" |
||||
#include "hpipm_d_ocp_qcqp.h" |
||||
#include "hpipm_d_ocp_qcqp_dim.h" |
||||
#include "hpipm_d_ocp_qcqp_sol.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_cond_qcqp_arg |
||||
{ |
||||
struct d_cond_qp_arg *qp_arg; |
||||
int cond_last_stage; // condense last stage
|
||||
// int cond_variant; // TODO
|
||||
int comp_prim_sol; // primal solution (v)
|
||||
int comp_dual_sol_eq; // dual solution equality constr (pi)
|
||||
int comp_dual_sol_ineq; // dual solution equality constr (lam t)
|
||||
int square_root_alg; // square root algorithm (faster but requires RSQ>0)
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_cond_qcqp_ws |
||||
{ |
||||
struct d_cond_qp_ws *qp_ws; |
||||
struct blasfeo_dmat *hess_array; // TODO remove
|
||||
struct blasfeo_dmat *zero_hess; // TODO remove
|
||||
struct blasfeo_dvec *grad_array; // TODO remove
|
||||
struct blasfeo_dvec *zero_grad; // TODO remove
|
||||
struct blasfeo_dvec *tmp_nvc; |
||||
struct blasfeo_dvec *tmp_nuxM; |
||||
struct blasfeo_dmat *GammaQ; |
||||
struct blasfeo_dmat *tmp_DCt; |
||||
struct blasfeo_dmat *tmp_nuM_nxM; |
||||
// struct blasfeo_dvec *d_qp;
|
||||
// struct blasfeo_dvec *d_mask_qp;
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_cond_qcqp_arg_memsize(); |
||||
//
|
||||
void d_cond_qcqp_arg_create(struct d_cond_qcqp_arg *cond_arg, void *mem); |
||||
//
|
||||
void d_cond_qcqp_arg_set_default(struct d_cond_qcqp_arg *cond_arg); |
||||
// set riccati-like algorithm: 0 classical, 1 square-root
|
||||
void d_cond_qcqp_arg_set_ric_alg(int ric_alg, struct d_cond_qcqp_arg *cond_arg); |
||||
// condense last stage: 0 last stage disregarded, 1 last stage condensed too
|
||||
void d_cond_qcqp_arg_set_cond_last_stage(int cond_last_stage, struct d_cond_qcqp_arg *cond_arg); |
||||
|
||||
//
|
||||
void d_cond_qcqp_compute_dim(struct d_ocp_qcqp_dim *ocp_dim, struct d_dense_qcqp_dim *dense_dim); |
||||
//
|
||||
hpipm_size_t d_cond_qcqp_ws_memsize(struct d_ocp_qcqp_dim *ocp_dim, struct d_cond_qcqp_arg *cond_arg); |
||||
//
|
||||
void d_cond_qcqp_ws_create(struct d_ocp_qcqp_dim *ocp_dim, struct d_cond_qcqp_arg *cond_arg, struct d_cond_qcqp_ws *cond_ws, void *mem); |
||||
//
|
||||
void d_cond_qcqp_qc(struct d_ocp_qcqp *ocp_qp, struct blasfeo_dmat *Hq2, int *Hq_nzero2, struct blasfeo_dmat *Ct2, struct blasfeo_dvec *d2, struct d_cond_qcqp_arg *cond_arg, struct d_cond_qcqp_ws *cond_ws); |
||||
//
|
||||
void d_cond_qcqp_qc_lhs(struct d_ocp_qcqp *ocp_qp, struct blasfeo_dmat *Hq2, int *Hq_nzero2, struct blasfeo_dmat *Ct2, struct d_cond_qcqp_arg *cond_arg, struct d_cond_qcqp_ws *cond_ws); |
||||
//
|
||||
void d_cond_qcqp_qc_rhs(struct d_ocp_qcqp *ocp_qp, struct blasfeo_dvec *d2, struct d_cond_qcqp_arg *cond_arg, struct d_cond_qcqp_ws *cond_ws); |
||||
//
|
||||
void d_cond_qcqp_cond(struct d_ocp_qcqp *ocp_qp, struct d_dense_qcqp *dense_qp, struct d_cond_qcqp_arg *cond_arg, struct d_cond_qcqp_ws *cond_ws); |
||||
//
|
||||
void d_cond_qcqp_cond_rhs(struct d_ocp_qcqp *ocp_qp, struct d_dense_qcqp *dense_qp, struct d_cond_qcqp_arg *cond_arg, struct d_cond_qcqp_ws *cond_ws); |
||||
//
|
||||
void d_cond_qcqp_cond_lhs(struct d_ocp_qcqp *ocp_qp, struct d_dense_qcqp *dense_qp, struct d_cond_qcqp_arg *cond_arg, struct d_cond_qcqp_ws *cond_ws); |
||||
//
|
||||
void d_cond_qcqp_expand_sol(struct d_ocp_qcqp *ocp_qp, struct d_dense_qcqp_sol *dense_qp_sol, struct d_ocp_qcqp_sol *ocp_qp_sol, struct d_cond_qcqp_arg *cond_arg, struct d_cond_qcqp_ws *cond_ws); |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_COND_QCQP_H_
|
@ -0,0 +1,101 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_CORE_QP_IPM_ |
||||
#define HPIPM_D_CORE_QP_IPM_ |
||||
|
||||
#include "hpipm_common.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
struct d_core_qp_ipm_workspace |
||||
{ |
||||
double *v; // primal variables
|
||||
double *pi; // equality constraints multipliers
|
||||
double *lam; // inequality constraints multipliers
|
||||
double *t; // inequality constraints slacks
|
||||
double *t_inv; // inverse of t
|
||||
double *v_bkp; // backup of primal variables
|
||||
double *pi_bkp; // backup of equality constraints multipliers
|
||||
double *lam_bkp; // backup of inequality constraints multipliers
|
||||
double *t_bkp; // backup of inequality constraints slacks
|
||||
double *dv; // step in v
|
||||
double *dpi; // step in pi
|
||||
double *dlam; // step in lam
|
||||
double *dt; // step in t
|
||||
double *res_g; // q-residuals
|
||||
double *res_b; // b-residuals
|
||||
double *res_d; // d-residuals
|
||||
double *res_m; // m-residuals
|
||||
double *res_m_bkp; // m-residuals
|
||||
double *Gamma; // Hessian update
|
||||
double *gamma; // gradient update
|
||||
double alpha; // step length
|
||||
double alpha_prim; // step length
|
||||
double alpha_dual; // step length
|
||||
double sigma; // centering XXX
|
||||
double mu; // duality measuere
|
||||
double mu_aff; // affine duality measuere
|
||||
double nc_inv; // 1.0/nc, where nc is the total number of inequality constraints
|
||||
double nc_mask_inv; // 1.0/nc_mask
|
||||
double lam_min; // min value in lam vector
|
||||
double t_min; // min value in t vector
|
||||
double t_min_inv; // inverse of min value in t vector
|
||||
double tau_min; // min value of barrier parameter
|
||||
int nv; // number of primal variables
|
||||
int ne; // number of equality constraints
|
||||
int nc; // (twice the) number of (two-sided) inequality constraints
|
||||
int nc_mask; // total number of ineq constr after masking
|
||||
int split_step; // use different step for primal and dual variables
|
||||
int t_lam_min; // clip t and lam also in solution, or only in Gamma computation
|
||||
hpipm_size_t memsize; // memory size (in bytes) of workspace
|
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_memsize_core_qp_ipm(int nv, int ne, int nc); |
||||
//
|
||||
void d_create_core_qp_ipm(int nv, int ne, int nc, struct d_core_qp_ipm_workspace *workspace, void *mem); |
||||
//
|
||||
void d_core_qp_ipm(struct d_core_qp_ipm_workspace *workspace); |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif // HPIPM_D_CORE_QP_IPM_
|
@ -0,0 +1,68 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_S_CORE_QP_IPM_AUX_ |
||||
#define HPIPM_S_CORE_QP_IPM_AUX_ |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
//
|
||||
void d_compute_Gamma_gamma_qp(double *res_d, double *res_m, struct d_core_qp_ipm_workspace *rws); |
||||
//
|
||||
void d_compute_gamma_qp(double *res_d, double *res_m, struct d_core_qp_ipm_workspace *rws); |
||||
//
|
||||
void d_compute_lam_t_qp(double *res_d, double *res_m, double *dlam, double *dt, struct d_core_qp_ipm_workspace *rws); |
||||
//
|
||||
void d_compute_alpha_qp(struct d_core_qp_ipm_workspace *rws); |
||||
//
|
||||
void d_update_var_qp(struct d_core_qp_ipm_workspace *rws); |
||||
//
|
||||
void d_compute_mu_aff_qp(struct d_core_qp_ipm_workspace *rws); |
||||
//
|
||||
void d_backup_res_m(struct d_core_qp_ipm_workspace *rws); |
||||
//
|
||||
void d_compute_centering_correction_qp(struct d_core_qp_ipm_workspace *rws); |
||||
//
|
||||
void d_compute_centering_qp(struct d_core_qp_ipm_workspace *rws); |
||||
//
|
||||
void d_compute_tau_min_qp(struct d_core_qp_ipm_workspace *rws); |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif // HPIPM_S_CORE_QP_IPM_AUX_
|
@ -0,0 +1,199 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_D_DENSE_QCQP_H_ |
||||
#define HPIPM_D_DENSE_QCQP_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_dense_qcqp_dim.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_dense_qcqp |
||||
{ |
||||
struct d_dense_qcqp_dim *dim; |
||||
struct blasfeo_dmat *Hv; // hessian of cost & vector work space
|
||||
struct blasfeo_dmat *A; // equality constraint matrix
|
||||
struct blasfeo_dmat *Ct; // inequality constraints matrix
|
||||
struct blasfeo_dmat *Hq; // hessians of quadratic constraints
|
||||
struct blasfeo_dvec *gz; // gradient of cost & gradient of slacks
|
||||
struct blasfeo_dvec *b; // equality constraint vector
|
||||
struct blasfeo_dvec *d; // inequality constraints vector
|
||||
struct blasfeo_dvec *d_mask; // inequality constraints mask vector
|
||||
struct blasfeo_dvec *m; // rhs of complementarity condition
|
||||
struct blasfeo_dvec *Z; // (diagonal) hessian of slacks
|
||||
int *idxb; // indices of box constrained variables within [u; x]
|
||||
int *idxs_rev; // index of soft constraints (reverse storage)
|
||||
int *Hq_nzero; // for each int, the last 3 bits ...abc, {a,b,c}=0 => {R,S,Q}=0
|
||||
hpipm_size_t memsize; // memory size in bytes
|
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_dense_qcqp_memsize(struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_create(struct d_dense_qcqp_dim *dim, struct d_dense_qcqp *qp, void *memory); |
||||
|
||||
//
|
||||
void d_dense_qcqp_set(char *field, void *value, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_H(double *H, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_g(double *g, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_A(double *A, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_b(double *b, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_idxb(int *idxb, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_lb(double *lb, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_lb_mask(double *lb, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_ub(double *ub, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_ub_mask(double *ub, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_C(double *C, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_lg(double *lg, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_lg_mask(double *lg, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_ug(double *ug, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_ug_mask(double *ug, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_Hq(double *Hq, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_gq(double *gq, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_uq(double *uq, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_uq_mask(double *uq, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_idxs(int *idxs, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_idxs_rev(int *idxs_rev, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_Zl(double *Zl, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_Zu(double *Zu, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_zl(double *zl, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_zu(double *zu, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_ls(double *ls, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_ls_mask(double *ls, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_us(double *us, struct d_dense_qcqp *qp); |
||||
//
|
||||
void d_dense_qcqp_set_us_mask(double *us, struct d_dense_qcqp *qp); |
||||
|
||||
// getters (COLMAJ)
|
||||
|
||||
void d_dense_qcqp_get_H(struct d_dense_qcqp *qp, double *H); |
||||
//
|
||||
void d_dense_qcqp_get_g(struct d_dense_qcqp *qp, double *g); |
||||
//
|
||||
void d_dense_qcqp_get_A(struct d_dense_qcqp *qp, double *A); |
||||
//
|
||||
void d_dense_qcqp_get_b(struct d_dense_qcqp *qp, double *b); |
||||
//
|
||||
void d_dense_qcqp_get_idxb(struct d_dense_qcqp *qp, int *idxb); |
||||
//
|
||||
void d_dense_qcqp_get_lb(struct d_dense_qcqp *qp, double *lb); |
||||
//
|
||||
void d_dense_qcqp_get_lb_mask(struct d_dense_qcqp *qp, double *lb); |
||||
//
|
||||
void d_dense_qcqp_get_ub(struct d_dense_qcqp *qp, double *ub); |
||||
//
|
||||
void d_dense_qcqp_get_ub_mask(struct d_dense_qcqp *qp, double *ub); |
||||
//
|
||||
void d_dense_qcqp_get_C(struct d_dense_qcqp *qp, double *C); |
||||
//
|
||||
void d_dense_qcqp_get_lg(struct d_dense_qcqp *qp, double *lg); |
||||
//
|
||||
void d_dense_qcqp_get_lg_mask(struct d_dense_qcqp *qp, double *lg); |
||||
//
|
||||
void d_dense_qcqp_get_ug(struct d_dense_qcqp *qp, double *ug); |
||||
//
|
||||
void d_dense_qcqp_get_ug_mask(struct d_dense_qcqp *qp, double *ug); |
||||
//
|
||||
void d_dense_qcqp_get_idxs(struct d_dense_qcqp *qp, int *idxs); |
||||
//
|
||||
void d_dense_qcqp_get_idxs_rev(struct d_dense_qcqp *qp, int *idxs_rev); |
||||
//
|
||||
void d_dense_qcqp_get_Zl(struct d_dense_qcqp *qp, double *Zl); |
||||
//
|
||||
void d_dense_qcqp_get_Zu(struct d_dense_qcqp *qp, double *Zu); |
||||
//
|
||||
void d_dense_qcqp_get_zl(struct d_dense_qcqp *qp, double *zl); |
||||
//
|
||||
void d_dense_qcqp_get_zu(struct d_dense_qcqp *qp, double *zu); |
||||
//
|
||||
void d_dense_qcqp_get_ls(struct d_dense_qcqp *qp, double *ls); |
||||
//
|
||||
void d_dense_qcqp_get_ls_mask(struct d_dense_qcqp *qp, double *ls); |
||||
//
|
||||
void d_dense_qcqp_get_us(struct d_dense_qcqp *qp, double *us); |
||||
//
|
||||
void d_dense_qcqp_get_us_mask(struct d_dense_qcqp *qp, double *us); |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_DENSE_QCQP_H_
|
||||
|
@ -0,0 +1,98 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_DENSE_QCQP_DIM_H_ |
||||
#define HPIPM_D_DENSE_QCQP_DIM_H_ |
||||
|
||||
#include "hpipm_common.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_dense_qcqp_dim |
||||
{ |
||||
struct d_dense_qp_dim *qp_dim; // dim of qp approximation
|
||||
int nv; // number of variables
|
||||
int ne; // number of equality constraints
|
||||
int nb; // number of box constraints
|
||||
int ng; // number of general constraints
|
||||
int nq; // number of quadratic constraints
|
||||
int nsb; // number of softened box constraints
|
||||
int nsg; // number of softened general constraints
|
||||
int nsq; // number of softened quadratic constraints
|
||||
int ns; // number of softened constraints (nsb+nsg+nsq) TODO number of slacks
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_dense_qcqp_dim_memsize(); |
||||
//
|
||||
void d_dense_qcqp_dim_create(struct d_dense_qcqp_dim *dim, void *memory); |
||||
//
|
||||
void d_dense_qcqp_dim_set(char *field_name, int value, struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_dim_set_nv(int value, struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_dim_set_ne(int value, struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_dim_set_nb(int value, struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_dim_set_ng(int value, struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_dim_set_nq(int value, struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_dim_set_nsb(int value, struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_dim_set_nsg(int value, struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_dim_set_nsq(int value, struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_dim_set_ns(int value, struct d_dense_qcqp_dim *dim); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_DENSE_QCQP_DIM_H_
|
||||
|
@ -0,0 +1,193 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_D_DENSE_QCQP_IPM_H_ |
||||
#define HPIPM_D_DENSE_QCQP_IPM_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include <hpipm_common.h> |
||||
#include <hpipm_d_dense_qcqp_dim.h> |
||||
#include <hpipm_d_dense_qcqp.h> |
||||
#include <hpipm_d_dense_qcqp_res.h> |
||||
#include <hpipm_d_dense_qcqp_sol.h> |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_dense_qcqp_ipm_arg |
||||
{ |
||||
struct d_dense_qp_ipm_arg *qp_arg; |
||||
double mu0; // initial value for duality measure
|
||||
double alpha_min; // exit cond on step length
|
||||
double res_g_max; // exit cond on inf norm of residuals
|
||||
double res_b_max; // exit cond on inf norm of residuals
|
||||
double res_d_max; // exit cond on inf norm of residuals
|
||||
double res_m_max; // exit cond on inf norm of residuals
|
||||
double reg_prim; // reg of primal hessian
|
||||
double reg_dual; // reg of dual hessian
|
||||
double lam_min; // min value in lam vector
|
||||
double t_min; // min value in t vector
|
||||
int iter_max; // exit cond in iter number
|
||||
int stat_max; // iterations saved in stat
|
||||
int pred_corr; // Mehrotra's predictor-corrector IPM algirthm
|
||||
int cond_pred_corr; // conditional Mehrotra's predictor-corrector
|
||||
int scale; // scale hessian
|
||||
int itref_pred_max; // max number of iterative refinement steps for predictor step
|
||||
int itref_corr_max; // max number of iterative refinement steps for corrector step
|
||||
int warm_start; // 0 no warm start, 1 warm start primal sol, 2 warm start primal and dual sol
|
||||
int lq_fact; // 0 syrk+potrf, 1 mix, 2 lq
|
||||
int abs_form; // absolute IPM formulation
|
||||
int comp_res_exit; // compute residuals on exit (only for abs_form==1)
|
||||
int comp_res_pred; // compute residuals of prediction
|
||||
int split_step; // use different step for primal and dual variables
|
||||
int t_lam_min; // clip t and lam: 0 no, 1 in Gamma computation, 2 in solution
|
||||
int mode; |
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_dense_qcqp_ipm_ws |
||||
{ |
||||
struct d_dense_qp_ipm_ws *qp_ws; |
||||
struct d_dense_qp *qp; |
||||
struct d_dense_qp_sol *qp_sol; |
||||
struct d_dense_qcqp_res_ws *qcqp_res_ws; |
||||
struct d_dense_qcqp_res *qcqp_res; |
||||
struct blasfeo_dvec *tmp_nv; |
||||
int iter; // iteration number
|
||||
int status; |
||||
hpipm_size_t memsize; // memory size (in bytes) of workspace
|
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_dense_qcqp_ipm_arg_memsize(struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_create(struct d_dense_qcqp_dim *dim, struct d_dense_qcqp_ipm_arg *arg, void *mem); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_default(enum hpipm_mode mode, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set(char *field, void *value, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_iter_max(int *iter_max, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_alpha_min(double *alpha_min, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_mu0(double *mu0, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_tol_stat(double *tol_stat, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_tol_eq(double *tol_eq, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_tol_ineq(double *tol_ineq, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_tol_comp(double *tol_comp, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_reg_prim(double *reg, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_reg_dual(double *reg, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_warm_start(int *warm_start, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_pred_corr(int *pred_corr, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_cond_pred_corr(int *cond_pred_corr, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_comp_res_pred(int *comp_res_pred, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_comp_res_exit(int *comp_res_exit, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_lam_min(double *value, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_t_min(double *value, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_split_step(int *value, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_arg_set_t_lam_min(int *value, struct d_dense_qcqp_ipm_arg *arg); |
||||
|
||||
//
|
||||
hpipm_size_t d_dense_qcqp_ipm_ws_memsize(struct d_dense_qcqp_dim *qp_dim, struct d_dense_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qcqp_ipm_ws_create(struct d_dense_qcqp_dim *qp_dim, struct d_dense_qcqp_ipm_arg *arg, struct d_dense_qcqp_ipm_ws *ws, void *mem); |
||||
//
|
||||
void d_dense_qcqp_ipm_get(char *field, struct d_dense_qcqp_ipm_ws *ws, void *value); |
||||
//
|
||||
void d_dense_qcqp_ipm_get_status(struct d_dense_qcqp_ipm_ws *ws, int *status); |
||||
//
|
||||
void d_dense_qcqp_ipm_get_iter(struct d_dense_qcqp_ipm_ws *ws, int *iter); |
||||
//
|
||||
void d_dense_qcqp_ipm_get_max_res_stat(struct d_dense_qcqp_ipm_ws *ws, double *res_stat); |
||||
//
|
||||
void d_dense_qcqp_ipm_get_max_res_eq(struct d_dense_qcqp_ipm_ws *ws, double *res_eq); |
||||
//
|
||||
void d_dense_qcqp_ipm_get_max_res_ineq(struct d_dense_qcqp_ipm_ws *ws, double *res_ineq); |
||||
//
|
||||
void d_dense_qcqp_ipm_get_max_res_comp(struct d_dense_qcqp_ipm_ws *ws, double *res_comp); |
||||
//
|
||||
void d_dense_qcqp_ipm_get_stat(struct d_dense_qcqp_ipm_ws *ws, double **stat); |
||||
//
|
||||
void d_dense_qcqp_ipm_get_stat_m(struct d_dense_qcqp_ipm_ws *ws, int *stat_m); |
||||
//
|
||||
void d_dense_qcqp_init_var(struct d_dense_qcqp *qp, struct d_dense_qcqp_sol *qp_sol, struct d_dense_qcqp_ipm_arg *arg, struct d_dense_qcqp_ipm_ws *ws); |
||||
//
|
||||
void d_dense_qcqp_ipm_solve(struct d_dense_qcqp *qp, struct d_dense_qcqp_sol *qp_sol, struct d_dense_qcqp_ipm_arg *arg, struct d_dense_qcqp_ipm_ws *ws); |
||||
#if 0 |
||||
//
|
||||
void d_dense_qcqp_ipm_predict(struct d_dense_qcqp *qp, struct d_dense_qcqp_sol *qp_sol, struct d_dense_qcqp_ipm_arg *arg, struct d_dense_qcqp_ipm_ws *ws); |
||||
//
|
||||
void d_dense_qcqp_ipm_sens(struct d_dense_qcqp *qp, struct d_dense_qcqp_sol *qp_sol, struct d_dense_qcqp_ipm_arg *arg, struct d_dense_qcqp_ipm_ws *ws); |
||||
#endif |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_DENSE_QCQP_IPM_H_
|
||||
|
@ -0,0 +1,107 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_DENSE_QCQP_RES_H_ |
||||
#define HPIPM_D_DENSE_QCQP_RES_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include <hpipm_d_dense_qcqp_dim.h> |
||||
#include <hpipm_d_dense_qcqp.h> |
||||
#include <hpipm_d_dense_qcqp_sol.h> |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_dense_qcqp_res |
||||
{ |
||||
struct d_dense_qcqp_dim *dim; |
||||
struct blasfeo_dvec *res_g; // q-residuals
|
||||
struct blasfeo_dvec *res_b; // b-residuals
|
||||
struct blasfeo_dvec *res_d; // d-residuals
|
||||
struct blasfeo_dvec *res_m; // m-residuals
|
||||
double res_max[4]; // infinity norm of residuals
|
||||
double res_mu; // mu-residual
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_dense_qcqp_res_ws |
||||
{ |
||||
struct blasfeo_dvec *tmp_nv; // work space of size nv
|
||||
struct blasfeo_dvec *tmp_nbgq; // work space of size nbM+ngM+nqM
|
||||
struct blasfeo_dvec *tmp_ns; // work space of size nsM
|
||||
struct blasfeo_dvec *q_fun; // value for evaluation of quadr constr
|
||||
struct blasfeo_dvec *q_adj; // value for adjoint of quadr constr
|
||||
int use_q_fun; // reuse cached value for evaluation of quadr constr
|
||||
int use_q_adj; // reuse cached value for adjoint of quadr constr
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_dense_qcqp_res_memsize(struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_res_create(struct d_dense_qcqp_dim *dim, struct d_dense_qcqp_res *res, void *mem); |
||||
//
|
||||
hpipm_size_t d_dense_qcqp_res_ws_memsize(struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_res_ws_create(struct d_dense_qcqp_dim *dim, struct d_dense_qcqp_res_ws *workspace, void *mem); |
||||
//
|
||||
void d_dense_qcqp_res_compute(struct d_dense_qcqp *qp, struct d_dense_qcqp_sol *qp_sol, struct d_dense_qcqp_res *res, struct d_dense_qcqp_res_ws *ws); |
||||
//
|
||||
void d_dense_qcqp_res_compute_inf_norm(struct d_dense_qcqp_res *res); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
#endif // HPIPM_D_DENSE_QCQP_RES_H_
|
||||
|
||||
|
||||
|
@ -0,0 +1,85 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_D_DENSE_QCQP_SOL_H_ |
||||
#define HPIPM_D_DENSE_QCQP_SOL_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_dense_qcqp_dim.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_dense_qcqp_sol |
||||
{ |
||||
struct d_dense_qcqp_dim *dim; |
||||
struct blasfeo_dvec *v; |
||||
struct blasfeo_dvec *pi; |
||||
struct blasfeo_dvec *lam; |
||||
struct blasfeo_dvec *t; |
||||
void *misc; |
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_dense_qcqp_sol_memsize(struct d_dense_qcqp_dim *dim); |
||||
//
|
||||
void d_dense_qcqp_sol_create(struct d_dense_qcqp_dim *dim, struct d_dense_qcqp_sol *qp_sol, void *memory); |
||||
//
|
||||
void d_dense_qcqp_sol_get_v(struct d_dense_qcqp_sol *qp_sol, double *v); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_DENSE_QCQP_SOL_H_
|
||||
|
@ -0,0 +1,82 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_DENSE_QCQP_UTILS_H_ |
||||
#define HPIPM_D_DENSE_QCQP_UTILS_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_dense_qcqp_dim.h" |
||||
#include "hpipm_d_dense_qcqp.h" |
||||
#include "hpipm_d_dense_qcqp_sol.h" |
||||
//#include "hpipm_d_dense_qcqp_ipm.h"
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
//
|
||||
void d_dense_qcqp_dim_print(struct d_dense_qcqp_dim *qp_dim); |
||||
//
|
||||
//void d_dense_qcqp_dim_codegen(char *file_name, char *mode, struct d_dense_qcqp_dim *qp_dim);
|
||||
//
|
||||
void d_dense_qcqp_print(struct d_dense_qcqp_dim *qp_dim, struct d_dense_qcqp *qp); |
||||
//
|
||||
//void d_dense_qcqp_codegen(char *file_name, char *mode, struct d_dense_qcqp_dim *qp_dim, struct d_dense_qcqp *qp);
|
||||
//
|
||||
void d_dense_qcqp_sol_print(struct d_dense_qcqp_dim *qp_dim, struct d_dense_qcqp_sol *dense_qcqp_sol); |
||||
//
|
||||
//void d_dense_qcqp_ipm_arg_codegen(char *file_name, char *mode, struct d_dense_qcqp_dim *qp_dim, struct d_dense_qcqp_ipm_arg *arg);
|
||||
//
|
||||
void d_dense_qcqp_res_print(struct d_dense_qcqp_dim *qp_dim, struct d_dense_qcqp_res *dense_qcqp_res); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_DENSE_QCQP_UTILS_H_
|
||||
|
||||
|
@ -0,0 +1,207 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_D_DENSE_QP_H_ |
||||
#define HPIPM_D_DENSE_QP_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_dense_qp_dim.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_dense_qp |
||||
{ |
||||
struct d_dense_qp_dim *dim; |
||||
struct blasfeo_dmat *Hv; // hessian of cost & vector work space
|
||||
struct blasfeo_dmat *A; // equality constraint matrix
|
||||
struct blasfeo_dmat *Ct; // inequality constraints matrix
|
||||
struct blasfeo_dvec *gz; // gradient of cost & gradient of slacks
|
||||
struct blasfeo_dvec *b; // equality constraint vector
|
||||
struct blasfeo_dvec *d; // inequality constraints vector
|
||||
struct blasfeo_dvec *d_mask; // inequality constraints mask vector
|
||||
struct blasfeo_dvec *m; // rhs of complementarity condition
|
||||
struct blasfeo_dvec *Z; // (diagonal) hessian of slacks
|
||||
int *idxb; // indices of box constrained variables within [u; x]
|
||||
int *idxs_rev; // index of soft constraints (reverse storage)
|
||||
hpipm_size_t memsize; // memory size in bytes
|
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_dense_qp_memsize(struct d_dense_qp_dim *dim); |
||||
//
|
||||
void d_dense_qp_create(struct d_dense_qp_dim *dim, struct d_dense_qp *qp, void *memory); |
||||
|
||||
// setters - colmaj
|
||||
//
|
||||
void d_dense_qp_set_all(double *H, double *g, double *A, double *b, int *idxb, double *d_lb, double *d_ub, double *C, double *d_lg, double *d_ug, double *Zl, double *Zu, double *zl, double *zu, int *idxs, double *d_ls, double *d_us, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_get_all(struct d_dense_qp *qp, double *H, double *g, double *A, double *b, int *idxb, double *d_lb, double *d_ub, double *C, double *d_lg, double *d_ug, double *Zl, double *Zu, double *zl, double *zu, int *idxs, double *d_ls, double *d_us); |
||||
//
|
||||
void d_dense_qp_set(char *field, void *value, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_H(double *H, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_g(double *g, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_A(double *A, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_b(double *b, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_idxb(int *idxb, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_Jb(double *Jb, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_lb(double *lb, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_lb_mask(double *lb, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_ub(double *ub, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_ub_mask(double *ub, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_C(double *C, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_lg(double *lg, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_lg_mask(double *lg, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_ug(double *ug, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_ug_mask(double *ug, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_idxs(int *idxs, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_idxs_rev(int *idxs_rev, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_Jsb(double *Jsb, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_Jsg(double *Jsg, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_Zl(double *Zl, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_Zu(double *Zu, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_zl(double *zl, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_zu(double *zu, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_ls(double *ls, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_ls_mask(double *ls, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_us(double *us, struct d_dense_qp *qp); |
||||
//
|
||||
void d_dense_qp_set_us_mask(double *us, struct d_dense_qp *qp); |
||||
|
||||
// getters - colmaj
|
||||
//
|
||||
void d_dense_qp_get_H(struct d_dense_qp *qp, double *H); |
||||
//
|
||||
void d_dense_qp_get_g(struct d_dense_qp *qp, double *g); |
||||
//
|
||||
void d_dense_qp_get_A(struct d_dense_qp *qp, double *A); |
||||
//
|
||||
void d_dense_qp_get_b(struct d_dense_qp *qp, double *b); |
||||
//
|
||||
void d_dense_qp_get_idxb(struct d_dense_qp *qp, int *idxb); |
||||
//
|
||||
void d_dense_qp_get_lb(struct d_dense_qp *qp, double *lb); |
||||
//
|
||||
void d_dense_qp_get_lb_mask(struct d_dense_qp *qp, double *lb); |
||||
//
|
||||
void d_dense_qp_get_ub(struct d_dense_qp *qp, double *ub); |
||||
//
|
||||
void d_dense_qp_get_ub_mask(struct d_dense_qp *qp, double *ub); |
||||
//
|
||||
void d_dense_qp_get_C(struct d_dense_qp *qp, double *C); |
||||
//
|
||||
void d_dense_qp_get_lg(struct d_dense_qp *qp, double *lg); |
||||
//
|
||||
void d_dense_qp_get_lg_mask(struct d_dense_qp *qp, double *lg); |
||||
//
|
||||
void d_dense_qp_get_ug(struct d_dense_qp *qp, double *ug); |
||||
//
|
||||
void d_dense_qp_get_ug_mask(struct d_dense_qp *qp, double *ug); |
||||
//
|
||||
void d_dense_qp_get_idxs(struct d_dense_qp *qp, int *idxs); |
||||
//
|
||||
void d_dense_qp_get_idxs_rev(struct d_dense_qp *qp, int *idxs_rev); |
||||
//
|
||||
void d_dense_qp_get_Zl(struct d_dense_qp *qp, double *Zl); |
||||
//
|
||||
void d_dense_qp_get_Zu(struct d_dense_qp *qp, double *Zu); |
||||
//
|
||||
void d_dense_qp_get_zl(struct d_dense_qp *qp, double *zl); |
||||
//
|
||||
void d_dense_qp_get_zu(struct d_dense_qp *qp, double *zu); |
||||
//
|
||||
void d_dense_qp_get_ls(struct d_dense_qp *qp, double *ls); |
||||
//
|
||||
void d_dense_qp_get_ls_mask(struct d_dense_qp *qp, double *ls); |
||||
//
|
||||
void d_dense_qp_get_us(struct d_dense_qp *qp, double *us); |
||||
//
|
||||
void d_dense_qp_get_us_mask(struct d_dense_qp *qp, double *us); |
||||
|
||||
// setters - rowmaj
|
||||
//
|
||||
void d_dense_qp_set_all_rowmaj(double *H, double *g, double *A, double *b, int *idxb, double *d_lb, double *d_ub, double *C, double *d_lg, double *d_ug, double *Zl, double *Zu, double *zl, double *zu, int *idxs, double *d_ls, double *d_us, struct d_dense_qp *qp); |
||||
|
||||
// getters - rowmaj
|
||||
//
|
||||
void d_dense_qp_get_all_rowmaj(struct d_dense_qp *qp, double *H, double *g, double *A, double *b, int *idxb, double *d_lb, double *d_ub, double *C, double *d_lg, double *d_ug, double *Zl, double *Zu, double *zl, double *zu, int *idxs, double *d_ls, double *d_us); |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_DENSE_QP_H_
|
@ -0,0 +1,92 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_DENSE_QP_DIM_H_ |
||||
#define HPIPM_D_DENSE_QP_DIM_H_ |
||||
|
||||
#include "hpipm_common.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_dense_qp_dim |
||||
{ |
||||
int nv; // number of variables
|
||||
int ne; // number of equality constraints
|
||||
int nb; // number of box constraints
|
||||
int ng; // number of general constraints
|
||||
int nsb; // number of softened box constraints
|
||||
int nsg; // number of softened general constraints
|
||||
int ns; // number of softened constraints (nsb+nsg)
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_dense_qp_dim_memsize(); |
||||
//
|
||||
void d_dense_qp_dim_create(struct d_dense_qp_dim *qp_dim, void *memory); |
||||
//
|
||||
void d_dense_qp_dim_set_all(int nv, int ne, int nb, int ng, int nsb, int nsg, struct d_dense_qp_dim *dim); |
||||
//
|
||||
void d_dense_qp_dim_set(char *field_name, int value, struct d_dense_qp_dim *dim); |
||||
//
|
||||
void d_dense_qp_dim_set_nv(int value, struct d_dense_qp_dim *dim); |
||||
//
|
||||
void d_dense_qp_dim_set_ne(int value, struct d_dense_qp_dim *dim); |
||||
//
|
||||
void d_dense_qp_dim_set_nb(int value, struct d_dense_qp_dim *dim); |
||||
//
|
||||
void d_dense_qp_dim_set_ng(int value, struct d_dense_qp_dim *dim); |
||||
//
|
||||
void d_dense_qp_dim_set_nsb(int value, struct d_dense_qp_dim *dim); |
||||
//
|
||||
void d_dense_qp_dim_set_nsg(int value, struct d_dense_qp_dim *dim); |
||||
//
|
||||
void d_dense_qp_dim_set_ns(int value, struct d_dense_qp_dim *dim); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_DENSE_QP_DIM_H_
|
@ -0,0 +1,260 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_D_DENSE_QP_IPM_H_ |
||||
#define HPIPM_D_DENSE_QP_IPM_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include <hpipm_common.h> |
||||
#include <hpipm_d_dense_qp_dim.h> |
||||
#include <hpipm_d_dense_qp.h> |
||||
#include <hpipm_d_dense_qp_res.h> |
||||
#include <hpipm_d_dense_qp_sol.h> |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_dense_qp_ipm_arg |
||||
{ |
||||
double mu0; // initial value for duality measure
|
||||
double alpha_min; // exit cond on step length
|
||||
double res_g_max; // exit cond on inf norm of residuals
|
||||
double res_b_max; // exit cond on inf norm of residuals
|
||||
double res_d_max; // exit cond on inf norm of residuals
|
||||
double res_m_max; // exit cond on inf norm of residuals
|
||||
double reg_prim; // reg of primal hessian
|
||||
double reg_dual; // reg of dual hessian
|
||||
double lam_min; // min value in lam vector
|
||||
double t_min; // min value in t vector
|
||||
double tau_min; // min value of barrier parameter
|
||||
int iter_max; // exit cond in iter number
|
||||
int stat_max; // iterations saved in stat
|
||||
int pred_corr; // Mehrotra's predictor-corrector IPM algirthm
|
||||
int cond_pred_corr; // conditional Mehrotra's predictor-corrector
|
||||
int scale; // scale hessian
|
||||
int itref_pred_max; // max number of iterative refinement steps for predictor step
|
||||
int itref_corr_max; // max number of iterative refinement steps for corrector step
|
||||
int warm_start; // 0 no warm start, 1 warm start primal sol, 2 warm start primal and dual sol
|
||||
int lq_fact; // 0 syrk+potrf, 1 mix, 2 lq
|
||||
int abs_form; // absolute IPM formulation
|
||||
int comp_res_exit; // compute residuals on exit (only for abs_form==1)
|
||||
int comp_res_pred; // compute residuals of prediction
|
||||
int kkt_fact_alg; // 0 null-space, 1 schur-complement
|
||||
int remove_lin_dep_eq; // 0 do not, 1 do check and remove linearly dependent equality constraints
|
||||
int compute_obj; // compute obj on exit
|
||||
int split_step; // use different steps for primal and dual variables
|
||||
int t_lam_min; // clip t and lam: 0 no, 1 in Gamma computation, 2 in solution
|
||||
int mode; |
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_dense_qp_ipm_ws |
||||
{ |
||||
struct d_core_qp_ipm_workspace *core_workspace; |
||||
struct d_dense_qp_res_ws *res_ws; |
||||
struct d_dense_qp_sol *sol_step; |
||||
struct d_dense_qp_sol *sol_itref; |
||||
struct d_dense_qp *qp_step; |
||||
struct d_dense_qp *qp_itref; |
||||
struct d_dense_qp_res *res; |
||||
struct d_dense_qp_res *res_itref; |
||||
struct d_dense_qp_res *res_step; |
||||
struct blasfeo_dvec *Gamma; //
|
||||
struct blasfeo_dvec *gamma; //
|
||||
struct blasfeo_dvec *Zs_inv; //
|
||||
struct blasfeo_dmat *Lv; //
|
||||
struct blasfeo_dmat *AL; //
|
||||
struct blasfeo_dmat *Le; //
|
||||
struct blasfeo_dmat *Ctx; //
|
||||
struct blasfeo_dvec *lv; //
|
||||
struct blasfeo_dvec *sv; // scale for Lv
|
||||
struct blasfeo_dvec *se; // scale for Le
|
||||
struct blasfeo_dvec *tmp_nbg; // work space of size nb+ng
|
||||
struct blasfeo_dvec *tmp_ns; // work space of size ns
|
||||
struct blasfeo_dmat *lq0; |
||||
struct blasfeo_dmat *lq1; |
||||
struct blasfeo_dvec *tmp_m; |
||||
struct blasfeo_dmat *A_LQ; |
||||
struct blasfeo_dmat *A_Q; |
||||
struct blasfeo_dmat *Zt; |
||||
struct blasfeo_dmat *ZtH; |
||||
struct blasfeo_dmat *ZtHZ; |
||||
struct blasfeo_dvec *xy; |
||||
struct blasfeo_dvec *Yxy; |
||||
struct blasfeo_dvec *xz; |
||||
struct blasfeo_dvec *tmp_nv; |
||||
struct blasfeo_dvec *tmp_2ns; |
||||
struct blasfeo_dvec *tmp_nv2ns; |
||||
struct blasfeo_dmat *A_li; // A of linearly independent equality constraints
|
||||
struct blasfeo_dvec *b_li; // b of linearly independent equality constraints
|
||||
struct blasfeo_dmat *A_bkp; // pointer to backup A
|
||||
struct blasfeo_dvec *b_bkp; // pointer to backup b
|
||||
struct blasfeo_dmat *Ab_LU; |
||||
double *stat; // convergence statistics
|
||||
int *ipiv_v; |
||||
int *ipiv_e; |
||||
int *ipiv_e1; |
||||
void *lq_work0; |
||||
void *lq_work1; |
||||
void *lq_work_null; |
||||
void *orglq_work_null; |
||||
int iter; // iteration number
|
||||
int stat_max; // iterations saved in stat
|
||||
int stat_m; // numer of recorded stat per ipm iter
|
||||
int scale; |
||||
int use_hess_fact; |
||||
int use_A_fact; |
||||
int status; |
||||
int lq_fact; // cache from arg
|
||||
int mask_constr; // use constr mask
|
||||
int ne_li; // number of linearly independent equality constraints
|
||||
int ne_bkp; // ne backup
|
||||
hpipm_size_t memsize; // memory size (in bytes) of workspace
|
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_dense_qp_ipm_arg_memsize(struct d_dense_qp_dim *dim); |
||||
//
|
||||
void d_dense_qp_ipm_arg_create(struct d_dense_qp_dim *dim, struct d_dense_qp_ipm_arg *arg, void *mem); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_default(enum hpipm_mode mode, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set(char *field, void *value, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_iter_max(int *iter_max, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_alpha_min(double *alpha_min, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_mu0(double *mu0, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_tol_stat(double *tol_stat, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_tol_eq(double *tol_eq, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_tol_ineq(double *tol_ineq, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_tol_comp(double *tol_comp, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_reg_prim(double *reg, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_reg_dual(double *reg, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_warm_start(int *warm_start, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_pred_corr(int *pred_corr, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_cond_pred_corr(int *cond_pred_corr, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_comp_res_pred(int *comp_res_pred, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_comp_res_exit(int *comp_res_exit, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_lam_min(double *value, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_t_min(double *value, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_tau_min(double *value, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_kkt_fact_alg(int *value, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_remove_lin_dep_eq(int *value, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_compute_obj(int *value, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_arg_set_t_lam_min(int *value, struct d_dense_qp_ipm_arg *arg); |
||||
|
||||
//
|
||||
void d_dense_qp_ipm_arg_set_split_step(int *value, struct d_dense_qp_ipm_arg *arg); |
||||
|
||||
//
|
||||
hpipm_size_t d_dense_qp_ipm_ws_memsize(struct d_dense_qp_dim *qp_dim, struct d_dense_qp_ipm_arg *arg); |
||||
//
|
||||
void d_dense_qp_ipm_ws_create(struct d_dense_qp_dim *qp_dim, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws, void *mem); |
||||
//
|
||||
void d_dense_qp_ipm_get(char *field, struct d_dense_qp_ipm_ws *ws, void *value); |
||||
//
|
||||
void d_dense_qp_ipm_get_status(struct d_dense_qp_ipm_ws *ws, int *status); |
||||
//
|
||||
void d_dense_qp_ipm_get_iter(struct d_dense_qp_ipm_ws *ws, int *iter); |
||||
//
|
||||
void d_dense_qp_ipm_get_max_res_stat(struct d_dense_qp_ipm_ws *ws, double *res_stat); |
||||
//
|
||||
void d_dense_qp_ipm_get_max_res_eq(struct d_dense_qp_ipm_ws *ws, double *res_eq); |
||||
//
|
||||
void d_dense_qp_ipm_get_max_res_ineq(struct d_dense_qp_ipm_ws *ws, double *res_ineq); |
||||
//
|
||||
void d_dense_qp_ipm_get_max_res_comp(struct d_dense_qp_ipm_ws *ws, double *res_comp); |
||||
//
|
||||
void d_dense_qp_ipm_get_stat(struct d_dense_qp_ipm_ws *ws, double **stat); |
||||
//
|
||||
void d_dense_qp_ipm_get_stat_m(struct d_dense_qp_ipm_ws *ws, int *stat_m); |
||||
//
|
||||
void d_dense_qp_init_var(struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
//
|
||||
void d_dense_qp_ipm_abs_step(int kk, struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
//
|
||||
void d_dense_qp_ipm_delta_step(int kk, struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
//
|
||||
void d_dense_qp_ipm_solve(struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
//
|
||||
void d_dense_qp_ipm_predict(struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
//
|
||||
void d_dense_qp_ipm_sens(struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
//
|
||||
void d_dense_qp_compute_step_length(struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_DENSE_QP_IPM_H_
|
@ -0,0 +1,72 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_D_DENSE_QP_KKT_H_ |
||||
#define HPIPM_D_DENSE_QP_KKT_H_ |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
//
|
||||
void d_fact_solve_kkt_unconstr_dense_qp(struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
//
|
||||
void d_fact_solve_kkt_step_dense_qp(struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
//
|
||||
void d_fact_lq_solve_kkt_step_dense_qp(struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
//
|
||||
void d_solve_kkt_step_dense_qp(struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
//
|
||||
void d_dense_qp_remove_lin_dep_eq(struct d_dense_qp *qp, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
//
|
||||
void d_dense_qp_restore_lin_dep_eq(struct d_dense_qp *qp, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
//
|
||||
void d_dense_qp_compute_obj(struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_ipm_arg *arg, struct d_dense_qp_ipm_ws *ws); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_DENSE_QP_KKT_H_
|
@ -0,0 +1,105 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_DENSE_QP_RES_H_ |
||||
#define HPIPM_D_DENSE_QP_RES_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include <hpipm_d_dense_qp_dim.h> |
||||
#include <hpipm_d_dense_qp.h> |
||||
#include <hpipm_d_dense_qp_sol.h> |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_dense_qp_res |
||||
{ |
||||
struct d_dense_qp_dim *dim; |
||||
struct blasfeo_dvec *res_g; // q-residuals
|
||||
struct blasfeo_dvec *res_b; // b-residuals
|
||||
struct blasfeo_dvec *res_d; // d-residuals
|
||||
struct blasfeo_dvec *res_m; // m-residuals
|
||||
double res_max[4]; // max of residuals
|
||||
double res_mu; // mu-residual
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_dense_qp_res_ws |
||||
{ |
||||
struct blasfeo_dvec *tmp_nbg; // work space of size nbM+ngM
|
||||
struct blasfeo_dvec *tmp_ns; // work space of size nsM
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_dense_qp_res_memsize(struct d_dense_qp_dim *dim); |
||||
//
|
||||
void d_dense_qp_res_create(struct d_dense_qp_dim *dim, struct d_dense_qp_res *res, void *mem); |
||||
//
|
||||
hpipm_size_t d_dense_qp_res_ws_memsize(struct d_dense_qp_dim *dim); |
||||
//
|
||||
void d_dense_qp_res_ws_create(struct d_dense_qp_dim *dim, struct d_dense_qp_res_ws *workspace, void *mem); |
||||
//
|
||||
void d_dense_qp_res_compute(struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_res *res, struct d_dense_qp_res_ws *ws); |
||||
//
|
||||
void d_dense_qp_res_compute_lin(struct d_dense_qp *qp, struct d_dense_qp_sol *qp_sol, struct d_dense_qp_sol *qp_step, struct d_dense_qp_res *res, struct d_dense_qp_res_ws *ws); |
||||
//
|
||||
void d_dense_qp_res_compute_inf_norm(struct d_dense_qp_res *res); |
||||
//
|
||||
void d_dense_qp_res_get_all(struct d_dense_qp_res *res, double *res_g, double *res_ls, double *res_us, double *res_b, double *res_d_lb, double *res_d_ub, double *res_d_lg, double *res_d_ug, double *res_d_ls, double *res_d_us, double *res_m_lb, double *res_m_ub, double *res_m_lg, double *res_m_ug, double *res_m_ls, double *res_m_us); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
#endif // HPIPM_D_DENSE_QP_RES_H_
|
||||
|
||||
|
@ -0,0 +1,94 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_D_DENSE_QP_SOL_H_ |
||||
#define HPIPM_D_DENSE_QP_SOL_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_dense_qp_dim.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_dense_qp_sol |
||||
{ |
||||
struct d_dense_qp_dim *dim; |
||||
struct blasfeo_dvec *v; |
||||
struct blasfeo_dvec *pi; |
||||
struct blasfeo_dvec *lam; |
||||
struct blasfeo_dvec *t; |
||||
void *misc; |
||||
double obj; |
||||
int valid_obj; |
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_dense_qp_sol_memsize(struct d_dense_qp_dim *dim); |
||||
//
|
||||
void d_dense_qp_sol_create(struct d_dense_qp_dim *dim, struct d_dense_qp_sol *qp_sol, void *memory); |
||||
//
|
||||
void d_dense_qp_sol_get_all(struct d_dense_qp_sol *qp_sol, double *v, double *ls, double *us, double *pi, double *lam_lb, double *lam_ub, double *lam_lg, double *lam_ug, double *lam_ls, double *lam_us); |
||||
//
|
||||
void d_dense_qp_sol_get(char *field, struct d_dense_qp_sol *sol, void *value); |
||||
//
|
||||
void d_dense_qp_sol_get_v(struct d_dense_qp_sol *sol, double *v); |
||||
//
|
||||
void d_dense_qp_sol_get_valid_obj(struct d_dense_qp_sol *sol, int *valid_obj); |
||||
//
|
||||
void d_dense_qp_sol_get_obj(struct d_dense_qp_sol *sol, double *obj); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_DENSE_QP_SOL_H_
|
@ -0,0 +1,83 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_DENSE_QP_UTILS_H_ |
||||
#define HPIPM_D_DENSE_QP_UTILS_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_dense_qp_dim.h" |
||||
#include "hpipm_d_dense_qp.h" |
||||
#include "hpipm_d_dense_qp_sol.h" |
||||
#include "hpipm_d_dense_qp_ipm.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
//
|
||||
void d_dense_qp_dim_print(struct d_dense_qp_dim *qp_dim); |
||||
//
|
||||
//void d_dense_qp_dim_codegen(char *file_name, char *mode, struct d_dense_qp_dim *qp_dim);
|
||||
//
|
||||
void d_dense_qp_print(struct d_dense_qp_dim *qp_dim, struct d_dense_qp *qp); |
||||
//
|
||||
//void d_dense_qp_codegen(char *file_name, char *mode, struct d_dense_qp_dim *qp_dim, struct d_dense_qp *qp);
|
||||
//
|
||||
void d_dense_qp_sol_print(struct d_dense_qp_dim *qp_dim, struct d_dense_qp_sol *dense_qp_sol); |
||||
//
|
||||
//void d_dense_qp_ipm_arg_codegen(char *file_name, char *mode, struct d_dense_qp_dim *qp_dim, struct d_dense_qp_ipm_arg *arg);
|
||||
//
|
||||
void d_dense_qp_res_print(struct d_dense_qp_dim *qp_dim, struct d_dense_qp_res *dense_qp_res); |
||||
//
|
||||
void d_dense_qp_arg_print(struct d_dense_qp_dim *qp_dim, struct d_dense_qp_ipm_arg *qp_ipm_arg); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_DENSE_QP_UTILS_H_
|
||||
|
@ -0,0 +1,303 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QCQP_H_ |
||||
#define HPIPM_D_OCP_QCQP_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_ocp_qcqp_dim.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_ocp_qcqp |
||||
{ |
||||
struct d_ocp_qcqp_dim *dim; |
||||
struct blasfeo_dmat *BAbt; // dynamics matrix & vector work space
|
||||
struct blasfeo_dmat *RSQrq; // hessian of cost & vector work space
|
||||
struct blasfeo_dmat *DCt; // inequality constraints matrix
|
||||
struct blasfeo_dmat **Hq; // hessians of quadratic constraints
|
||||
struct blasfeo_dvec *b; // dynamics vector
|
||||
struct blasfeo_dvec *rqz; // gradient of cost & gradient of slacks
|
||||
struct blasfeo_dvec *d; // inequality constraints vector
|
||||
struct blasfeo_dvec *d_mask; // inequality constraints mask vector
|
||||
struct blasfeo_dvec *m; // rhs of complementarity condition
|
||||
struct blasfeo_dvec *Z; // (diagonal) hessian of slacks
|
||||
int **idxb; // indices of box constrained variables within [u; x]
|
||||
int **idxs_rev; // index of soft constraints (reverse storage)
|
||||
int **Hq_nzero; // for each int, the last 3 bits ...abc, {a,b,c}=0 => {R,S,Q}=0
|
||||
hpipm_size_t memsize; // memory size in bytes
|
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_ocp_qcqp_strsize(); |
||||
//
|
||||
hpipm_size_t d_ocp_qcqp_memsize(struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_create(struct d_ocp_qcqp_dim *dim, struct d_ocp_qcqp *qp, void *memory); |
||||
//
|
||||
void d_ocp_qcqp_copy_all(struct d_ocp_qcqp *qp_orig, struct d_ocp_qcqp *qp_dest); |
||||
|
||||
// setters
|
||||
//
|
||||
void d_ocp_qcqp_set_all_zero(struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_rhs_zero(struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set(char *field_name, int stage, void *value, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_el(char *field_name, int stage, int index, void *value, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_A(int stage, double *mat, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_B(int stage, double *mat, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_b(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_Q(int stage, double *mat, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_S(int stage, double *mat, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_R(int stage, double *mat, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_q(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_r(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_lb(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_lb_mask(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_ub(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_ub_mask(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_lbx(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_lbx_mask(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_el_lbx(int stage, int index, double *elem, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_ubx(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_ubx_mask(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_el_ubx(int stage, int index, double *elem, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_lbu(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_lbu_mask(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_ubu(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_ubu_mask(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_idxb(int stage, int *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_idxbx(int stage, int *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_Jbx(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_idxbu(int stage, int *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_Jbu(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_C(int stage, double *mat, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_D(int stage, double *mat, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_lg(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_lg_mask(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_ug(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_ug_mask(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_Qq(int stage, double *mat, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_Sq(int stage, double *mat, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_Rq(int stage, double *mat, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_qq(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_rq(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_uq(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_uq_mask(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_Zl(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_Zu(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_zl(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_zu(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_lls(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_lls_mask(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_lus(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_lus_mask(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_idxs(int stage, int *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_idxs_rev(int stage, int *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_Jsbu(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_Jsbx(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_Jsg(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_set_Jsq(int stage, double *vec, struct d_ocp_qcqp *qp); |
||||
|
||||
// getters
|
||||
//
|
||||
void d_ocp_qcqp_get(char *field, int stage, struct d_ocp_qcqp *qp, void *value); |
||||
//
|
||||
void d_ocp_qcqp_get_A(int stage, struct d_ocp_qcqp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qcqp_get_B(int stage, struct d_ocp_qcqp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qcqp_get_b(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_Q(int stage, struct d_ocp_qcqp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qcqp_get_S(int stage, struct d_ocp_qcqp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qcqp_get_R(int stage, struct d_ocp_qcqp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qcqp_get_q(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_r(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_ub(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_ub_mask(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_lb(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_lb_mask(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_lbx(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_lbx_mask(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_ubx(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_ubx_mask(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_lbu(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_lbu_mask(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_ubu(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_ubu_mask(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_idxb(int stage, struct d_ocp_qcqp *qp, int *vec); |
||||
//
|
||||
//void d_ocp_qcqp_get_idxbx(int stage, struct d_ocp_qcqp *qp, int *vec);
|
||||
//
|
||||
//void d_ocp_qcqp_get_Jbx(int stage, struct d_ocp_qcqp *qp, double *vec);
|
||||
//
|
||||
//void d_ocp_qcqp_get_idxbu(int stage, struct d_ocp_qcqp *qp, int *vec);
|
||||
//
|
||||
//void d_ocp_qcqp_get_Jbu(int stage, struct d_ocp_qcqp *qp, double *vec);
|
||||
//
|
||||
void d_ocp_qcqp_get_C(int stage, struct d_ocp_qcqp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qcqp_get_D(int stage, struct d_ocp_qcqp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qcqp_get_lg(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_lg_mask(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_ug(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_ug_mask(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_Zl(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_Zu(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_zl(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_zu(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_lls(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_lls_mask(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_lus(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_lus_mask(int stage, struct d_ocp_qcqp *qp, double *vec); |
||||
// XXX only valid if there is one slack per softed constraint !!!
|
||||
void d_ocp_qcqp_get_idxs(int stage, struct d_ocp_qcqp *qp, int *vec); |
||||
//
|
||||
void d_ocp_qcqp_get_idxs_rev(int stage, struct d_ocp_qcqp *qp, int *vec); |
||||
//
|
||||
//void d_ocp_qcqp_get_Jsbu(int stage, struct d_ocp_qcqp *qp, float *vec);
|
||||
//
|
||||
//void d_ocp_qcqp_get_Jsbx(int stage, struct d_ocp_qcqp *qp, float *vec);
|
||||
//
|
||||
//void d_ocp_qcqp_get_Jsg(int stage, struct d_ocp_qcqp *qp, float *vec);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QCQP_H_
|
||||
|
@ -0,0 +1,118 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QCQP_DIM_H_ |
||||
#define HPIPM_D_OCP_QCQP_DIM_H_ |
||||
|
||||
#include "hpipm_common.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_ocp_qcqp_dim |
||||
{ |
||||
struct d_ocp_qp_dim *qp_dim; // dim of qp approximation
|
||||
int *nx; // number of states
|
||||
int *nu; // number of inputs
|
||||
int *nb; // number of box constraints
|
||||
int *nbx; // number of (two-sided) state box constraints
|
||||
int *nbu; // number of (two-sided) input box constraints
|
||||
int *ng; // number of (two-sided) general constraints
|
||||
int *nq; // number of (upper) quadratic constraints
|
||||
int *ns; // number of soft constraints
|
||||
int *nsbx; // number of (two-sided) soft state box constraints
|
||||
int *nsbu; // number of (two-sided) soft input box constraints
|
||||
int *nsg; // number of (two-sided) soft general constraints
|
||||
int *nsq; // number of (upper) soft quadratic constraints
|
||||
int N; // horizon length
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_ocp_qcqp_dim_strsize(); |
||||
//
|
||||
hpipm_size_t d_ocp_qcqp_dim_memsize(int N); |
||||
//
|
||||
void d_ocp_qcqp_dim_create(int N, struct d_ocp_qcqp_dim *qp_dim, void *memory); |
||||
//
|
||||
void d_ocp_qcqp_dim_copy_all(struct d_ocp_qcqp_dim *dim_orig, struct d_ocp_qcqp_dim *dim_dest); |
||||
//
|
||||
void d_ocp_qcqp_dim_set(char *field, int stage, int value, struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_dim_set_nx(int stage, int value, struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_dim_set_nu(int stage, int value, struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_dim_set_nbx(int stage, int value, struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_dim_set_nbu(int stage, int value, struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_dim_set_ng(int stage, int value, struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_dim_set_nq(int stage, int value, struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_dim_set_ns(int stage, int value, struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_dim_set_nsbx(int stage, int value, struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_dim_set_nsbu(int stage, int value, struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_dim_set_nsg(int stage, int value, struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_dim_set_nsq(int stage, int value, struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_dim_get(struct d_ocp_qcqp_dim *dim, char *field, int stage, int *value); |
||||
//
|
||||
void d_ocp_qcqp_dim_get_N(struct d_ocp_qcqp_dim *dim, int *value); |
||||
//
|
||||
void d_ocp_qcqp_dim_get_nx(struct d_ocp_qcqp_dim *dim, int stage, int *value); |
||||
//
|
||||
void d_ocp_qcqp_dim_get_nu(struct d_ocp_qcqp_dim *dim, int stage, int *value); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QCQP_DIM_H_
|
||||
|
@ -0,0 +1,190 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QCQP_IPM_H_ |
||||
#define HPIPM_D_OCP_QCQP_IPM_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include <hpipm_common.h> |
||||
#include <hpipm_d_ocp_qcqp_dim.h> |
||||
#include <hpipm_d_ocp_qp.h> |
||||
#include <hpipm_d_ocp_qcqp_res.h> |
||||
#include <hpipm_d_ocp_qcqp_sol.h> |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_ocp_qcqp_ipm_arg |
||||
{ |
||||
struct d_ocp_qp_ipm_arg *qp_arg; |
||||
double mu0; // initial value for complementarity slackness
|
||||
double alpha_min; // exit cond on step length
|
||||
double res_g_max; // exit cond on inf norm of residuals
|
||||
double res_b_max; // exit cond on inf norm of residuals
|
||||
double res_d_max; // exit cond on inf norm of residuals
|
||||
double res_m_max; // exit cond on inf norm of residuals
|
||||
double reg_prim; // reg of primal hessian
|
||||
double lam_min; // min value in lam vector
|
||||
double t_min; // min value in t vector
|
||||
int iter_max; // exit cond in iter number
|
||||
int stat_max; // iterations saved in stat
|
||||
int pred_corr; // use Mehrotra's predictor-corrector IPM algirthm
|
||||
int cond_pred_corr; // conditional Mehrotra's predictor-corrector
|
||||
int itref_pred_max; // max number of iterative refinement steps for predictor step
|
||||
int itref_corr_max; // max number of iterative refinement steps for corrector step
|
||||
int warm_start; // 0 no warm start, 1 warm start primal sol, 2 warm start primal and dual sol
|
||||
int square_root_alg; // 0 classical Riccati, 1 square-root Riccati
|
||||
int lq_fact; // 0 syrk+potrf, 1 mix, 2 lq (for square_root_alg==1)
|
||||
int abs_form; // absolute IPM formulation
|
||||
int comp_dual_sol_eq; // dual solution of equality constrains (only for abs_form==1)
|
||||
int comp_res_exit; // compute residuals on exit (only for abs_form==1 and comp_dual_sol_eq==1)
|
||||
int comp_res_pred; // compute residuals of prediction
|
||||
int split_step; // use different step for primal and dual variables
|
||||
int t_lam_min; // clip t and lam: 0 no, 1 in Gamma computation, 2 in solution
|
||||
int mode; |
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_ocp_qcqp_ipm_ws |
||||
{ |
||||
struct d_ocp_qp_ipm_ws *qp_ws; |
||||
struct d_ocp_qp *qp; |
||||
struct d_ocp_qp_sol *qp_sol; |
||||
struct d_ocp_qcqp_res_ws *qcqp_res_ws; |
||||
struct d_ocp_qcqp_res *qcqp_res; |
||||
struct blasfeo_dvec *tmp_nuxM; |
||||
int iter; // iteration number
|
||||
int status; |
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_ocp_qcqp_ipm_arg_strsize(); |
||||
//
|
||||
hpipm_size_t d_ocp_qcqp_ipm_arg_memsize(struct d_ocp_qcqp_dim *ocp_dim); |
||||
//
|
||||
void d_ocp_qcqp_ipm_arg_create(struct d_ocp_qcqp_dim *ocp_dim, struct d_ocp_qcqp_ipm_arg *arg, void *mem); |
||||
//
|
||||
void d_ocp_qcqp_ipm_arg_set_default(enum hpipm_mode mode, struct d_ocp_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_ocp_qcqp_ipm_arg_set(char *field, void *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// set maximum number of iterations
|
||||
void d_ocp_qcqp_ipm_arg_set_iter_max(int *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// set minimum step lenght
|
||||
void d_ocp_qcqp_ipm_arg_set_alpha_min(double *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// set initial value of barrier parameter
|
||||
void d_ocp_qcqp_ipm_arg_set_mu0(double *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// set exit tolerance on stationarity condition
|
||||
void d_ocp_qcqp_ipm_arg_set_tol_stat(double *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// set exit tolerance on equality constr
|
||||
void d_ocp_qcqp_ipm_arg_set_tol_eq(double *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// set exit tolerance on inequality constr
|
||||
void d_ocp_qcqp_ipm_arg_set_tol_ineq(double *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// set exit tolerance on complementarity condition
|
||||
void d_ocp_qcqp_ipm_arg_set_tol_comp(double *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// set regularization of primal variables
|
||||
void d_ocp_qcqp_ipm_arg_set_reg_prim(double *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// set warm start: 0 no warm start, 1 primal var
|
||||
void d_ocp_qcqp_ipm_arg_set_warm_start(int *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// Mehrotra's predictor-corrector IPM algorithm: 0 no predictor-corrector, 1 use predictor-corrector
|
||||
void d_ocp_qcqp_ipm_arg_set_pred_corr(int *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// conditional predictor-corrector: 0 no conditinal predictor-corrector, 1 conditional predictor-corrector
|
||||
void d_ocp_qcqp_ipm_arg_set_cond_pred_corr(int *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// set riccati algorithm: 0 classic, 1 square-root
|
||||
void d_ocp_qcqp_ipm_arg_set_ric_alg(int *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// compute residuals after solution
|
||||
void d_ocp_qcqp_ipm_arg_set_comp_res_exit(int *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// compute residuals of prediction
|
||||
void d_ocp_qcqp_ipm_arg_set_comp_res_pred(int *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// min value of lam in the solution
|
||||
void d_ocp_qcqp_ipm_arg_set_lam_min(double *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// min value of t in the solution
|
||||
void d_ocp_qcqp_ipm_arg_set_t_min(double *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// use different step for primal and dual variables
|
||||
void d_ocp_qcqp_ipm_arg_set_split_step(int *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
// clip t and lam: 0 no, 1 in Gamma computation, 2 in solution
|
||||
void d_ocp_qcqp_ipm_arg_set_t_lam_min(int *value, struct d_ocp_qcqp_ipm_arg *arg); |
||||
|
||||
//
|
||||
hpipm_size_t d_ocp_qcqp_ipm_ws_strsize(); |
||||
//
|
||||
hpipm_size_t d_ocp_qcqp_ipm_ws_memsize(struct d_ocp_qcqp_dim *ocp_dim, struct d_ocp_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_ocp_qcqp_ipm_ws_create(struct d_ocp_qcqp_dim *ocp_dim, struct d_ocp_qcqp_ipm_arg *arg, struct d_ocp_qcqp_ipm_ws *ws, void *mem); |
||||
//
|
||||
void d_ocp_qcqp_ipm_get(char *field, struct d_ocp_qcqp_ipm_ws *ws, void *value); |
||||
//
|
||||
void d_ocp_qcqp_ipm_get_status(struct d_ocp_qcqp_ipm_ws *ws, int *status); |
||||
//
|
||||
void d_ocp_qcqp_ipm_get_iter(struct d_ocp_qcqp_ipm_ws *ws, int *iter); |
||||
//
|
||||
void d_ocp_qcqp_ipm_get_max_res_stat(struct d_ocp_qcqp_ipm_ws *ws, double *res_stat); |
||||
//
|
||||
void d_ocp_qcqp_ipm_get_max_res_eq(struct d_ocp_qcqp_ipm_ws *ws, double *res_eq); |
||||
//
|
||||
void d_ocp_qcqp_ipm_get_max_res_ineq(struct d_ocp_qcqp_ipm_ws *ws, double *res_ineq); |
||||
//
|
||||
void d_ocp_qcqp_ipm_get_max_res_comp(struct d_ocp_qcqp_ipm_ws *ws, double *res_comp); |
||||
//
|
||||
void d_ocp_qcqp_ipm_get_stat(struct d_ocp_qcqp_ipm_ws *ws, double **stat); |
||||
//
|
||||
void d_ocp_qcqp_ipm_get_stat_m(struct d_ocp_qcqp_ipm_ws *ws, int *stat_m); |
||||
//
|
||||
void d_ocp_qcqp_init_var(struct d_ocp_qcqp *qp, struct d_ocp_qcqp_sol *qp_sol, struct d_ocp_qcqp_ipm_arg *arg, struct d_ocp_qcqp_ipm_ws *ws); |
||||
//
|
||||
void d_ocp_qcqp_ipm_solve(struct d_ocp_qcqp *qp, struct d_ocp_qcqp_sol *qp_sol, struct d_ocp_qcqp_ipm_arg *arg, struct d_ocp_qcqp_ipm_ws *ws); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QCQP_IPM_H_
|
||||
|
@ -0,0 +1,114 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QCQP_RES_H_ |
||||
#define HPIPM_D_OCP_QCQP_RES_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include <hpipm_common.h> |
||||
#include <hpipm_d_ocp_qcqp_dim.h> |
||||
#include <hpipm_d_ocp_qcqp.h> |
||||
#include <hpipm_d_ocp_qcqp_sol.h> |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_ocp_qcqp_res |
||||
{ |
||||
struct d_ocp_qcqp_dim *dim; |
||||
struct blasfeo_dvec *res_g; // q-residuals
|
||||
struct blasfeo_dvec *res_b; // b-residuals
|
||||
struct blasfeo_dvec *res_d; // d-residuals
|
||||
struct blasfeo_dvec *res_m; // m-residuals
|
||||
double res_max[4]; // max of residuals
|
||||
double res_mu; // mu-residual
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_ocp_qcqp_res_ws |
||||
{ |
||||
struct blasfeo_dvec *tmp_nuxM; // work space of size nuM+nxM
|
||||
struct blasfeo_dvec *tmp_nbgqM; // work space of size nbM+ngM+nqM
|
||||
struct blasfeo_dvec *tmp_nsM; // work space of size nsM
|
||||
struct blasfeo_dvec *q_fun; // value for evaluation of quadr constr
|
||||
struct blasfeo_dvec *q_adj; // value for adjoint of quadr constr
|
||||
int use_q_fun; // reuse cached value for evaluation of quadr constr
|
||||
int use_q_adj; // reuse cached value for adjoint of quadr constr
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_ocp_qcqp_res_memsize(struct d_ocp_qcqp_dim *ocp_dim); |
||||
//
|
||||
void d_ocp_qcqp_res_create(struct d_ocp_qcqp_dim *ocp_dim, struct d_ocp_qcqp_res *res, void *mem); |
||||
//
|
||||
hpipm_size_t d_ocp_qcqp_res_ws_memsize(struct d_ocp_qcqp_dim *ocp_dim); |
||||
//
|
||||
void d_ocp_qcqp_res_ws_create(struct d_ocp_qcqp_dim *ocp_dim, struct d_ocp_qcqp_res_ws *workspace, void *mem); |
||||
//
|
||||
void d_ocp_qcqp_res_compute(struct d_ocp_qcqp *qp, struct d_ocp_qcqp_sol *qp_sol, struct d_ocp_qcqp_res *res, struct d_ocp_qcqp_res_ws *ws); |
||||
//
|
||||
void d_ocp_qcqp_res_compute_inf_norm(struct d_ocp_qcqp_res *res); |
||||
//
|
||||
void d_ocp_qcqp_res_get_max_res_stat(struct d_ocp_qcqp_res *res, double *value); |
||||
//
|
||||
void d_ocp_qcqp_res_get_max_res_eq(struct d_ocp_qcqp_res *res, double *value); |
||||
//
|
||||
void d_ocp_qcqp_res_get_max_res_ineq(struct d_ocp_qcqp_res *res, double *value); |
||||
//
|
||||
void d_ocp_qcqp_res_get_max_res_comp(struct d_ocp_qcqp_res *res, double *value); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QCQP_RES_H_
|
||||
|
@ -0,0 +1,114 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QCQP_SOL_H_ |
||||
#define HPIPM_D_OCP_QCQP_SOL_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_ocp_qcqp_dim.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_ocp_qcqp_sol |
||||
{ |
||||
struct d_ocp_qcqp_dim *dim; |
||||
struct blasfeo_dvec *ux; |
||||
struct blasfeo_dvec *pi; |
||||
struct blasfeo_dvec *lam; |
||||
struct blasfeo_dvec *t; |
||||
hpipm_size_t memsize; // memory size in bytes
|
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_ocp_qcqp_sol_strsize(); |
||||
//
|
||||
hpipm_size_t d_ocp_qcqp_sol_memsize(struct d_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_ocp_qcqp_sol_create(struct d_ocp_qcqp_dim *dim, struct d_ocp_qcqp_sol *qp_sol, void *memory); |
||||
//
|
||||
void d_ocp_qcqp_sol_copy_all(struct d_ocp_qcqp_sol *qp_sol_orig, struct d_ocp_qcqp_sol *qp_sol_dest); |
||||
//
|
||||
void d_ocp_qcqp_sol_get(char *field, int stage, struct d_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_sol_get_u(int stage, struct d_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_sol_get_x(int stage, struct d_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_sol_get_sl(int stage, struct d_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_sol_get_su(int stage, struct d_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_sol_get_pi(int stage, struct d_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_sol_get_lam_lb(int stage, struct d_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_sol_get_lam_ub(int stage, struct d_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_sol_get_lam_lg(int stage, struct d_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_sol_get_lam_ug(int stage, struct d_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qcqp_sol_set(char *field, int stage, double *vec, struct d_ocp_qcqp_sol *qp_sol); |
||||
//
|
||||
void d_ocp_qcqp_sol_set_u(int stage, double *vec, struct d_ocp_qcqp_sol *qp_sol); |
||||
//
|
||||
void d_ocp_qcqp_sol_set_x(int stage, double *vec, struct d_ocp_qcqp_sol *qp_sol); |
||||
//
|
||||
void d_ocp_qcqp_sol_set_sl(int stage, double *vec, struct d_ocp_qcqp_sol *qp_sol); |
||||
//
|
||||
void d_ocp_qcqp_sol_set_su(int stage, double *vec, struct d_ocp_qcqp_sol *qp_sol); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QCQP_SOL_H_
|
||||
|
@ -0,0 +1,81 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QCQP_UTILS_H_ |
||||
#define HPIPM_D_OCP_QCQP_UTILS_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_ocp_qcqp_dim.h" |
||||
#include "hpipm_d_ocp_qp.h" |
||||
#include "hpipm_d_ocp_qcqp_sol.h" |
||||
#include "hpipm_d_ocp_qcqp_ipm.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
//
|
||||
void d_ocp_qcqp_dim_print(struct d_ocp_qcqp_dim *qcqp_dim); |
||||
//
|
||||
void d_ocp_qcqp_dim_codegen(char *file_name, char *mode, struct d_ocp_qcqp_dim *qcqp_dim); |
||||
//
|
||||
void d_ocp_qcqp_print(struct d_ocp_qcqp_dim *qcqp_dim, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_codegen(char *file_name, char *mode, struct d_ocp_qcqp_dim *qcqp_dim, struct d_ocp_qcqp *qp); |
||||
//
|
||||
void d_ocp_qcqp_sol_print(struct d_ocp_qcqp_dim *qcqp_dim, struct d_ocp_qcqp_sol *ocp_qcqp_sol); |
||||
//
|
||||
void d_ocp_qcqp_ipm_arg_codegen(char *file_name, char *mode, struct d_ocp_qcqp_dim *qcqp_dim, struct d_ocp_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_ocp_qcqp_res_print(struct d_ocp_qcqp_dim *qcqp_dim, struct d_ocp_qcqp_res *ocp_qcqp_res); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QCQP_UTILS_H_
|
||||
|
@ -0,0 +1,306 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QP_H_ |
||||
#define HPIPM_D_OCP_QP_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_ocp_qp_dim.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_ocp_qp |
||||
{ |
||||
struct d_ocp_qp_dim *dim; |
||||
struct blasfeo_dmat *BAbt; // dynamics matrix & vector work space
|
||||
struct blasfeo_dmat *RSQrq; // hessian of cost & vector work space
|
||||
struct blasfeo_dmat *DCt; // inequality constraints matrix
|
||||
struct blasfeo_dvec *b; // dynamics vector
|
||||
struct blasfeo_dvec *rqz; // gradient of cost & gradient of slacks
|
||||
struct blasfeo_dvec *d; // inequality constraints vector
|
||||
struct blasfeo_dvec *d_mask; // inequality constraints mask vector
|
||||
struct blasfeo_dvec *m; // rhs of complementarity condition
|
||||
struct blasfeo_dvec *Z; // (diagonal) hessian of slacks
|
||||
int **idxb; // indices of box constrained variables within [u; x]
|
||||
int **idxs_rev; // index of soft constraints (reverse storage)
|
||||
int **idxe; // indices of constraints within [bu, bx, g] that are equalities, subset of [0, ..., nbu+nbx+ng-1]
|
||||
int *diag_H_flag; // flag the fact that Hessian is diagonal
|
||||
hpipm_size_t memsize; // memory size in bytes
|
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_ocp_qp_strsize(); |
||||
//
|
||||
hpipm_size_t d_ocp_qp_memsize(struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_create(struct d_ocp_qp_dim *dim, struct d_ocp_qp *qp, void *memory); |
||||
//
|
||||
void d_ocp_qp_copy_all(struct d_ocp_qp *qp_orig, struct d_ocp_qp *qp_dest); |
||||
|
||||
// setters
|
||||
//
|
||||
void d_ocp_qp_set_all_zero(struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_rhs_zero(struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_all(double **A, double **B, double **b, double **Q, double **S, double **R, double **q, double **r, int **idxbx, double **lbx, double **ubx, int **idxbu, double **lbu, double **ubu, double **C, double **D, double **lg, double **ug, double **Zl, double **Zu, double **zl, double **zu, int **idxs, double **ls, double **us, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_all_rowmaj(double **A, double **B, double **b, double **Q, double **S, double **R, double **q, double **r, int **idxbx, double **lbx, double **ubx, int **idxbu, double **lbu, double **ubu, double **C, double **D, double **lg, double **ug, double **Zl, double **Zu, double **zl, double **zu, int **idxs, double **ls, double **us, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set(char *field_name, int stage, void *value, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_el(char *field_name, int stage, int index, void *value, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_A(int stage, double *mat, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_B(int stage, double *mat, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_b(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_Q(int stage, double *mat, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_S(int stage, double *mat, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_R(int stage, double *mat, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_q(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_r(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_lb(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_lb_mask(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_ub(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_ub_mask(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_lbx(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_lbx_mask(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_el_lbx(int stage, int index, double *elem, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_ubx(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_ubx_mask(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_el_ubx(int stage, int index, double *elem, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_lbu(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_lbu_mask(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_ubu(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_ubu_mask(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_idxb(int stage, int *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_idxbx(int stage, int *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_Jbx(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_idxbu(int stage, int *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_Jbu(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_C(int stage, double *mat, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_D(int stage, double *mat, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_lg(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_lg_mask(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_ug(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_ug_mask(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_Zl(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_Zu(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_zl(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_zu(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_lls(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_lls_mask(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_lus(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_lus_mask(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_idxs(int stage, int *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_idxs_rev(int stage, int *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_Jsbu(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_Jsbx(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_Jsg(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_idxe(int stage, int *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_idxbxe(int stage, int *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_idxbue(int stage, int *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_idxge(int stage, int *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_Jbxe(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_Jbue(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_Jge(int stage, double *vec, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_set_diag_H_flag(int stage, int *value, struct d_ocp_qp *qp); |
||||
|
||||
// getters
|
||||
//
|
||||
void d_ocp_qp_get(char *field, int stage, struct d_ocp_qp *qp, void *value); |
||||
//
|
||||
void d_ocp_qp_get_A(int stage, struct d_ocp_qp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qp_get_B(int stage, struct d_ocp_qp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qp_get_b(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_Q(int stage, struct d_ocp_qp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qp_get_S(int stage, struct d_ocp_qp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qp_get_R(int stage, struct d_ocp_qp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qp_get_q(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_r(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_ub(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_ub_mask(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_lb(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_lb_mask(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_lbx(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_lbx_mask(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_ubx(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_ubx_mask(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_lbu(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_lbu_mask(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_ubu(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_ubu_mask(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_idxb(int stage, struct d_ocp_qp *qp, int *vec); |
||||
//
|
||||
//void d_ocp_qp_get_idxbx(int stage, struct d_ocp_qp *qp, int *vec);
|
||||
//
|
||||
//void d_ocp_qp_get_Jbx(int stage, struct d_ocp_qp *qp, double *vec);
|
||||
//
|
||||
//void d_ocp_qp_get_idxbu(int stage, struct d_ocp_qp *qp, int *vec);
|
||||
//
|
||||
//void d_ocp_qp_get_Jbu(int stage, struct d_ocp_qp *qp, double *vec);
|
||||
//
|
||||
void d_ocp_qp_get_C(int stage, struct d_ocp_qp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qp_get_D(int stage, struct d_ocp_qp *qp, double *mat); |
||||
//
|
||||
void d_ocp_qp_get_lg(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_lg_mask(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_ug(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_ug_mask(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_Zl(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_Zu(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_zl(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_zu(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_lls(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_lls_mask(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_lus(int stage, struct d_ocp_qp *qp, double *vec); |
||||
//
|
||||
void d_ocp_qp_get_lus_mask(int stage, struct d_ocp_qp *qp, double *vec); |
||||
// XXX only valid if there is one slack per softed constraint !!!
|
||||
void d_ocp_qp_get_idxs(int stage, struct d_ocp_qp *qp, int *vec); |
||||
//
|
||||
void d_ocp_qp_get_idxs_rev(int stage, struct d_ocp_qp *qp, int *vec); |
||||
//
|
||||
//void d_ocp_qp_get_Jsbu(int stage, struct d_ocp_qp *qp, float *vec);
|
||||
//
|
||||
//void d_ocp_qp_get_Jsbx(int stage, struct d_ocp_qp *qp, float *vec);
|
||||
//
|
||||
//void d_ocp_qp_get_Jsg(int stage, struct d_ocp_qp *qp, float *vec);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QP_H_
|
@ -0,0 +1,142 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QP_DIM_H_ |
||||
#define HPIPM_D_OCP_QP_DIM_H_ |
||||
|
||||
#include "hpipm_common.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_ocp_qp_dim |
||||
{ |
||||
int *nx; // number of states
|
||||
int *nu; // number of inputs
|
||||
int *nb; // number of box constraints
|
||||
int *nbx; // number of state box constraints
|
||||
int *nbu; // number of input box constraints
|
||||
int *ng; // number of general constraints
|
||||
int *ns; // number of soft constraints
|
||||
int *nsbx; // number of soft state box constraints
|
||||
int *nsbu; // number of soft input box constraints
|
||||
int *nsg; // number of soft general constraints
|
||||
int *nbxe; // number of state box constraints which are equality
|
||||
int *nbue; // number of input box constraints which are equality
|
||||
int *nge; // number of general constraints which are equality
|
||||
int N; // horizon length
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_ocp_qp_dim_strsize(); |
||||
//
|
||||
hpipm_size_t d_ocp_qp_dim_memsize(int N); |
||||
//
|
||||
void d_ocp_qp_dim_create(int N, struct d_ocp_qp_dim *qp_dim, void *memory); |
||||
//
|
||||
void d_ocp_qp_dim_copy_all(struct d_ocp_qp_dim *dim_orig, struct d_ocp_qp_dim *dim_dest); |
||||
//
|
||||
void d_ocp_qp_dim_set_all(int *nx, int *nu, int *nbx, int *nbu, int *ng, int *nsbx, int *nsbu, int *nsg, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_set(char *field, int stage, int value, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_set_nx(int stage, int value, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_set_nu(int stage, int value, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_set_nbx(int stage, int value, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_set_nbu(int stage, int value, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_set_ng(int stage, int value, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_set_ns(int stage, int value, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_set_nsbx(int stage, int value, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_set_nsbu(int stage, int value, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_set_nsg(int stage, int value, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_set_nbxe(int stage, int value, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_set_nbue(int stage, int value, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_set_nge(int stage, int value, struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_dim_get(struct d_ocp_qp_dim *dim, char *field, int stage, int *value); |
||||
//
|
||||
void d_ocp_qp_dim_get_N(struct d_ocp_qp_dim *dim, int *value); |
||||
//
|
||||
void d_ocp_qp_dim_get_nx(struct d_ocp_qp_dim *dim, int stage, int *value); |
||||
//
|
||||
void d_ocp_qp_dim_get_nu(struct d_ocp_qp_dim *dim, int stage, int *value); |
||||
//
|
||||
void d_ocp_qp_dim_get_nbx(struct d_ocp_qp_dim *dim, int stage, int *value); |
||||
//
|
||||
void d_ocp_qp_dim_get_nbu(struct d_ocp_qp_dim *dim, int stage, int *value); |
||||
//
|
||||
void d_ocp_qp_dim_get_ng(struct d_ocp_qp_dim *dim, int stage, int *value); |
||||
//
|
||||
void d_ocp_qp_dim_get_ns(struct d_ocp_qp_dim *dim, int stage, int *value); |
||||
//
|
||||
void d_ocp_qp_dim_get_nsbx(struct d_ocp_qp_dim *dim, int stage, int *value); |
||||
//
|
||||
void d_ocp_qp_dim_get_nsbu(struct d_ocp_qp_dim *dim, int stage, int *value); |
||||
//
|
||||
void d_ocp_qp_dim_get_nsg(struct d_ocp_qp_dim *dim, int stage, int *value); |
||||
//
|
||||
void d_ocp_qp_dim_get_nbxe(struct d_ocp_qp_dim *dim, int stage, int *value); |
||||
//
|
||||
void d_ocp_qp_dim_get_nbue(struct d_ocp_qp_dim *dim, int stage, int *value); |
||||
//
|
||||
void d_ocp_qp_dim_get_nge(struct d_ocp_qp_dim *dim, int stage, int *value); |
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QP_DIM_H_
|
@ -0,0 +1,250 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QP_IPM_H_ |
||||
#define HPIPM_D_OCP_QP_IPM_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include <hpipm_common.h> |
||||
#include <hpipm_d_ocp_qp_dim.h> |
||||
#include <hpipm_d_ocp_qp.h> |
||||
#include <hpipm_d_ocp_qp_res.h> |
||||
#include <hpipm_d_ocp_qp_sol.h> |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_ocp_qp_ipm_arg |
||||
{ |
||||
double mu0; // initial value for complementarity slackness
|
||||
double alpha_min; // exit cond on step length
|
||||
double res_g_max; // exit cond on inf norm of residuals
|
||||
double res_b_max; // exit cond on inf norm of residuals
|
||||
double res_d_max; // exit cond on inf norm of residuals
|
||||
double res_m_max; // exit cond on inf norm of residuals
|
||||
double reg_prim; // reg of primal hessian
|
||||
double lam_min; // min value in lam vector
|
||||
double t_min; // min value in t vector
|
||||
double tau_min; // min value of barrier parameter
|
||||
int iter_max; // exit cond in iter number
|
||||
int stat_max; // iterations saved in stat
|
||||
int pred_corr; // use Mehrotra's predictor-corrector IPM algirthm
|
||||
int cond_pred_corr; // conditional Mehrotra's predictor-corrector
|
||||
int itref_pred_max; // max number of iterative refinement steps for predictor step
|
||||
int itref_corr_max; // max number of iterative refinement steps for corrector step
|
||||
int warm_start; // 0 no warm start, 1 warm start primal sol, 2 warm start primal and dual sol
|
||||
int square_root_alg; // 0 classical Riccati, 1 square-root Riccati
|
||||
int lq_fact; // 0 syrk+potrf, 1 mix, 2 lq (for square_root_alg==1)
|
||||
int abs_form; // absolute IPM formulation
|
||||
int comp_dual_sol_eq; // dual solution of equality constraints (only for abs_form==1)
|
||||
int comp_res_exit; // compute residuals on exit (only for abs_form==1 and comp_dual_sol_eq==1)
|
||||
int comp_res_pred; // compute residuals of prediction
|
||||
int split_step; // use different steps for primal and dual variables
|
||||
int var_init_scheme; // variables initialization scheme
|
||||
int t_lam_min; // clip t and lam: 0 no, 1 in Gamma computation, 2 in solution
|
||||
int mode; |
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_ocp_qp_ipm_ws |
||||
{ |
||||
double qp_res[4]; // infinity norm of residuals
|
||||
struct d_core_qp_ipm_workspace *core_workspace; |
||||
struct d_ocp_qp_dim *dim; // cache dim
|
||||
struct d_ocp_qp_res_ws *res_workspace; |
||||
struct d_ocp_qp_sol *sol_step; |
||||
struct d_ocp_qp_sol *sol_itref; |
||||
struct d_ocp_qp *qp_step; |
||||
struct d_ocp_qp *qp_itref; |
||||
struct d_ocp_qp_res *res_itref; |
||||
struct d_ocp_qp_res *res; |
||||
struct blasfeo_dvec *Gamma; // hessian update
|
||||
struct blasfeo_dvec *gamma; // hessian update
|
||||
struct blasfeo_dvec *tmp_nuxM; // work space of size nxM
|
||||
struct blasfeo_dvec *tmp_nbgM; // work space of size nbM+ngM
|
||||
struct blasfeo_dvec *tmp_nsM; // work space of size nsM
|
||||
struct blasfeo_dvec *Pb; // Pb
|
||||
struct blasfeo_dvec *Zs_inv; |
||||
struct blasfeo_dvec *tmp_m; |
||||
struct blasfeo_dvec *l; // cache linear part for _get_ric_xxx
|
||||
struct blasfeo_dmat *L; |
||||
struct blasfeo_dmat *Ls; |
||||
struct blasfeo_dmat *P; |
||||
struct blasfeo_dmat *Lh; |
||||
struct blasfeo_dmat *AL; |
||||
struct blasfeo_dmat *lq0; |
||||
struct blasfeo_dmat *tmp_nxM_nxM; |
||||
double *stat; // convergence statistics
|
||||
int *use_hess_fact; |
||||
void *lq_work0; |
||||
int iter; // iteration number
|
||||
int stat_max; // iterations saved in stat
|
||||
int stat_m; // number of recorded stat per IPM iter
|
||||
int use_Pb; |
||||
int status; // solver status
|
||||
int square_root_alg; // cache from arg
|
||||
int lq_fact; // cache from arg
|
||||
int mask_constr; // use constr mask
|
||||
int valid_ric_vec; // meaningful riccati vectors
|
||||
int valid_ric_p; // form of riccati p: 0 p*inv(L), 1 p
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_ocp_qp_ipm_arg_strsize(); |
||||
//
|
||||
hpipm_size_t d_ocp_qp_ipm_arg_memsize(struct d_ocp_qp_dim *ocp_dim); |
||||
//
|
||||
void d_ocp_qp_ipm_arg_create(struct d_ocp_qp_dim *ocp_dim, struct d_ocp_qp_ipm_arg *arg, void *mem); |
||||
//
|
||||
void d_ocp_qp_ipm_arg_set_default(enum hpipm_mode mode, struct d_ocp_qp_ipm_arg *arg); |
||||
//
|
||||
void d_ocp_qp_ipm_arg_set(char *field, void *value, struct d_ocp_qp_ipm_arg *arg); |
||||
// set maximum number of iterations
|
||||
void d_ocp_qp_ipm_arg_set_iter_max(int *iter_max, struct d_ocp_qp_ipm_arg *arg); |
||||
// set minimum step lenght
|
||||
void d_ocp_qp_ipm_arg_set_alpha_min(double *alpha_min, struct d_ocp_qp_ipm_arg *arg); |
||||
// set initial value of barrier parameter
|
||||
void d_ocp_qp_ipm_arg_set_mu0(double *mu0, struct d_ocp_qp_ipm_arg *arg); |
||||
// set exit tolerance on stationarity condition
|
||||
void d_ocp_qp_ipm_arg_set_tol_stat(double *tol_stat, struct d_ocp_qp_ipm_arg *arg); |
||||
// set exit tolerance on equality constr
|
||||
void d_ocp_qp_ipm_arg_set_tol_eq(double *tol_eq, struct d_ocp_qp_ipm_arg *arg); |
||||
// set exit tolerance on inequality constr
|
||||
void d_ocp_qp_ipm_arg_set_tol_ineq(double *tol_ineq, struct d_ocp_qp_ipm_arg *arg); |
||||
// set exit tolerance on complementarity condition
|
||||
void d_ocp_qp_ipm_arg_set_tol_comp(double *tol_comp, struct d_ocp_qp_ipm_arg *arg); |
||||
// set regularization of primal variables
|
||||
void d_ocp_qp_ipm_arg_set_reg_prim(double *tol_comp, struct d_ocp_qp_ipm_arg *arg); |
||||
// set warm start: 0 no warm start, 1 primal var
|
||||
void d_ocp_qp_ipm_arg_set_warm_start(int *warm_start, struct d_ocp_qp_ipm_arg *arg); |
||||
// Mehrotra's predictor-corrector IPM algorithm: 0 no predictor-corrector, 1 use predictor-corrector
|
||||
void d_ocp_qp_ipm_arg_set_pred_corr(int *pred_corr, struct d_ocp_qp_ipm_arg *arg); |
||||
// conditional predictor-corrector: 0 no conditinal predictor-corrector, 1 conditional predictor-corrector
|
||||
void d_ocp_qp_ipm_arg_set_cond_pred_corr(int *value, struct d_ocp_qp_ipm_arg *arg); |
||||
// set riccati algorithm: 0 classic, 1 square-root
|
||||
void d_ocp_qp_ipm_arg_set_ric_alg(int *value, struct d_ocp_qp_ipm_arg *arg); |
||||
// dual solution of equality constraints (only for abs_form==1)
|
||||
void d_ocp_qp_ipm_arg_set_comp_dual_sol_eq(int *value, struct d_ocp_qp_ipm_arg *arg); |
||||
// compute residuals after solution
|
||||
void d_ocp_qp_ipm_arg_set_comp_res_exit(int *value, struct d_ocp_qp_ipm_arg *arg); |
||||
// compute residuals of prediction
|
||||
void d_ocp_qp_ipm_arg_set_comp_res_pred(int *value, struct d_ocp_qp_ipm_arg *arg); |
||||
// min value of lam in the solution
|
||||
void d_ocp_qp_ipm_arg_set_lam_min(double *value, struct d_ocp_qp_ipm_arg *arg); |
||||
// min value of t in the solution
|
||||
void d_ocp_qp_ipm_arg_set_t_min(double *value, struct d_ocp_qp_ipm_arg *arg); |
||||
// min value of tau in the solution
|
||||
void d_ocp_qp_ipm_arg_set_tau_min(double *value, struct d_ocp_qp_ipm_arg *arg); |
||||
// set split step: 0 same step, 1 different step for primal and dual variables
|
||||
void d_ocp_qp_ipm_arg_set_split_step(int *value, struct d_ocp_qp_ipm_arg *arg); |
||||
// variables initialization scheme
|
||||
void d_ocp_qp_ipm_arg_set_var_init_scheme(int *value, struct d_ocp_qp_ipm_arg *arg); |
||||
// clip t and lam: 0 no, 1 in Gamma computation, 2 in solution
|
||||
void d_ocp_qp_ipm_arg_set_t_lam_min(int *value, struct d_ocp_qp_ipm_arg *arg); |
||||
|
||||
//
|
||||
hpipm_size_t d_ocp_qp_ipm_ws_strsize(); |
||||
//
|
||||
hpipm_size_t d_ocp_qp_ipm_ws_memsize(struct d_ocp_qp_dim *ocp_dim, struct d_ocp_qp_ipm_arg *arg); |
||||
//
|
||||
void d_ocp_qp_ipm_ws_create(struct d_ocp_qp_dim *ocp_dim, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws, void *mem); |
||||
//
|
||||
void d_ocp_qp_ipm_get(char *field, struct d_ocp_qp_ipm_ws *ws, void *value); |
||||
//
|
||||
void d_ocp_qp_ipm_get_status(struct d_ocp_qp_ipm_ws *ws, int *status); |
||||
//
|
||||
void d_ocp_qp_ipm_get_iter(struct d_ocp_qp_ipm_ws *ws, int *iter); |
||||
//
|
||||
void d_ocp_qp_ipm_get_max_res_stat(struct d_ocp_qp_ipm_ws *ws, double *res_stat); |
||||
//
|
||||
void d_ocp_qp_ipm_get_max_res_eq(struct d_ocp_qp_ipm_ws *ws, double *res_eq); |
||||
//
|
||||
void d_ocp_qp_ipm_get_max_res_ineq(struct d_ocp_qp_ipm_ws *ws, double *res_ineq); |
||||
//
|
||||
void d_ocp_qp_ipm_get_max_res_comp(struct d_ocp_qp_ipm_ws *ws, double *res_comp); |
||||
//
|
||||
void d_ocp_qp_ipm_get_stat(struct d_ocp_qp_ipm_ws *ws, double **stat); |
||||
//
|
||||
void d_ocp_qp_ipm_get_stat_m(struct d_ocp_qp_ipm_ws *ws, int *stat_m); |
||||
//
|
||||
void d_ocp_qp_ipm_get_ric_Lr(struct d_ocp_qp *qp, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws, int stage, double *Lr); |
||||
//
|
||||
void d_ocp_qp_ipm_get_ric_Ls(struct d_ocp_qp *qp, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws, int stage, double *Ls); |
||||
//
|
||||
void d_ocp_qp_ipm_get_ric_P(struct d_ocp_qp *qp, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws, int stage, double *P); |
||||
//
|
||||
void d_ocp_qp_ipm_get_ric_lr(struct d_ocp_qp *qp, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws, int stage, double *lr); |
||||
//
|
||||
void d_ocp_qp_ipm_get_ric_p(struct d_ocp_qp *qp, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws, int stage, double *p); |
||||
// feedback control gain in the form u = K x + k
|
||||
void d_ocp_qp_ipm_get_ric_K(struct d_ocp_qp *qp, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws, int stage, double *K); |
||||
// feedback control gain in the form u = K x + k
|
||||
void d_ocp_qp_ipm_get_ric_k(struct d_ocp_qp *qp, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws, int stage, double *k); |
||||
//
|
||||
void d_ocp_qp_init_var(struct d_ocp_qp *qp, struct d_ocp_qp_sol *qp_sol, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws); |
||||
//
|
||||
void d_ocp_qp_ipm_abs_step(int kk, struct d_ocp_qp *qp, struct d_ocp_qp_sol *qp_sol, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws); |
||||
//
|
||||
void d_ocp_qp_ipm_delta_step(int kk, struct d_ocp_qp *qp, struct d_ocp_qp_sol *qp_sol, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws); |
||||
//
|
||||
void d_ocp_qp_ipm_solve(struct d_ocp_qp *qp, struct d_ocp_qp_sol *qp_sol, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws); |
||||
//
|
||||
void d_ocp_qp_ipm_predict(struct d_ocp_qp *qp, struct d_ocp_qp_sol *qp_sol, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws); |
||||
//
|
||||
void d_ocp_qp_ipm_sens(struct d_ocp_qp *qp, struct d_ocp_qp_sol *qp_sol, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws); |
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QP_IPM_H_
|
@ -0,0 +1,66 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QP_KKT_H_ |
||||
#define HPIPM_D_OCP_QP_KKT_H_ |
||||
|
||||
#include <hpipm_common.h> |
||||
#include <hpipm_d_ocp_qp.h> |
||||
#include <hpipm_d_ocp_qp_sol.h> |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
//
|
||||
void d_ocp_qp_fact_solve_kkt_unconstr(struct d_ocp_qp *qp, struct d_ocp_qp_sol *qp_sol, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws); |
||||
//
|
||||
void d_ocp_qp_fact_solve_kkt_step(struct d_ocp_qp *qp, struct d_ocp_qp_sol *qp_sol, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws); |
||||
//
|
||||
void d_ocp_qp_fact_lq_solve_kkt_step(struct d_ocp_qp *qp, struct d_ocp_qp_sol *qp_sol, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws); |
||||
//
|
||||
void d_ocp_qp_solve_kkt_step(struct d_ocp_qp *qp, struct d_ocp_qp_sol *qp_sol, struct d_ocp_qp_ipm_arg *arg, struct d_ocp_qp_ipm_ws *ws); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QP_KKT_H_
|
@ -0,0 +1,117 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QP_RED_H_ |
||||
#define HPIPM_D_OCP_QP_RED_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include <hpipm_d_ocp_qp_dim.h> |
||||
#include <hpipm_d_ocp_qp.h> |
||||
#include <hpipm_d_ocp_qp_sol.h> |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_ocp_qp_reduce_eq_dof_arg |
||||
{ |
||||
double lam_min; |
||||
double t_min; |
||||
int alias_unchanged; // do not keep copy unchanged stage
|
||||
int comp_prim_sol; // primal solution (v)
|
||||
int comp_dual_sol_eq; // dual solution equality constr (pi)
|
||||
int comp_dual_sol_ineq; // dual solution inequality constr (lam t)
|
||||
hpipm_size_t memsize; // memory size in bytes
|
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_ocp_qp_reduce_eq_dof_ws |
||||
{ |
||||
struct blasfeo_dvec *tmp_nuxM; |
||||
struct blasfeo_dvec *tmp_nbgM; |
||||
int *e_imask_ux; |
||||
int *e_imask_d; |
||||
hpipm_size_t memsize; // memory size in bytes
|
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
void d_ocp_qp_dim_reduce_eq_dof(struct d_ocp_qp_dim *dim, struct d_ocp_qp_dim *dim_red); |
||||
//
|
||||
hpipm_size_t d_ocp_qp_reduce_eq_dof_arg_memsize(); |
||||
//
|
||||
void d_ocp_qp_reduce_eq_dof_arg_create(struct d_ocp_qp_reduce_eq_dof_arg *arg, void *mem); |
||||
//
|
||||
void d_ocp_qp_reduce_eq_dof_arg_set_default(struct d_ocp_qp_reduce_eq_dof_arg *arg); |
||||
//
|
||||
void d_ocp_qp_reduce_eq_dof_arg_set_alias_unchanged(struct d_ocp_qp_reduce_eq_dof_arg *arg, int value); |
||||
//
|
||||
void d_ocp_qp_reduce_eq_dof_arg_set_comp_prim_sol(struct d_ocp_qp_reduce_eq_dof_arg *arg, int value); |
||||
//
|
||||
void d_ocp_qp_reduce_eq_dof_arg_set_comp_dual_sol_eq(struct d_ocp_qp_reduce_eq_dof_arg *arg, int value); |
||||
//
|
||||
void d_ocp_qp_reduce_eq_dof_arg_set_comp_dual_sol_ineq(struct d_ocp_qp_reduce_eq_dof_arg *arg, int value); |
||||
//
|
||||
hpipm_size_t d_ocp_qp_reduce_eq_dof_ws_memsize(struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_reduce_eq_dof_ws_create(struct d_ocp_qp_dim *dim, struct d_ocp_qp_reduce_eq_dof_ws *work, void *mem); |
||||
//
|
||||
void d_ocp_qp_reduce_eq_dof(struct d_ocp_qp *qp, struct d_ocp_qp *qp_red, struct d_ocp_qp_reduce_eq_dof_arg *arg, struct d_ocp_qp_reduce_eq_dof_ws *work); |
||||
//
|
||||
void d_ocp_qp_reduce_eq_dof_lhs(struct d_ocp_qp *qp, struct d_ocp_qp *qp_red, struct d_ocp_qp_reduce_eq_dof_arg *arg, struct d_ocp_qp_reduce_eq_dof_ws *work); |
||||
//
|
||||
void d_ocp_qp_reduce_eq_dof_rhs(struct d_ocp_qp *qp, struct d_ocp_qp *qp_red, struct d_ocp_qp_reduce_eq_dof_arg *arg, struct d_ocp_qp_reduce_eq_dof_ws *work); |
||||
//
|
||||
void d_ocp_qp_restore_eq_dof(struct d_ocp_qp *qp, struct d_ocp_qp_sol *qp_sol_red, struct d_ocp_qp_sol *qp_sol, struct d_ocp_qp_reduce_eq_dof_arg *arg, struct d_ocp_qp_reduce_eq_dof_ws *work); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QP_RED_H_
|
@ -0,0 +1,112 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QP_RES_H_ |
||||
#define HPIPM_D_OCP_QP_RES_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include <hpipm_common.h> |
||||
#include <hpipm_d_ocp_qp_dim.h> |
||||
#include <hpipm_d_ocp_qp.h> |
||||
#include <hpipm_d_ocp_qp_sol.h> |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_ocp_qp_res |
||||
{ |
||||
struct d_ocp_qp_dim *dim; |
||||
struct blasfeo_dvec *res_g; // q-residuals
|
||||
struct blasfeo_dvec *res_b; // b-residuals
|
||||
struct blasfeo_dvec *res_d; // d-residuals
|
||||
struct blasfeo_dvec *res_m; // m-residuals
|
||||
double res_max[4]; // max of residuals
|
||||
double res_mu; // mu-residual
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_ocp_qp_res_ws |
||||
{ |
||||
struct blasfeo_dvec *tmp_nbgM; // work space of size nbM+ngM
|
||||
struct blasfeo_dvec *tmp_nsM; // work space of size nsM
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_ocp_qp_res_memsize(struct d_ocp_qp_dim *ocp_dim); |
||||
//
|
||||
void d_ocp_qp_res_create(struct d_ocp_qp_dim *ocp_dim, struct d_ocp_qp_res *res, void *mem); |
||||
//
|
||||
hpipm_size_t d_ocp_qp_res_ws_memsize(struct d_ocp_qp_dim *ocp_dim); |
||||
//
|
||||
void d_ocp_qp_res_ws_create(struct d_ocp_qp_dim *ocp_dim, struct d_ocp_qp_res_ws *workspace, void *mem); |
||||
//
|
||||
void d_ocp_qp_res_compute(struct d_ocp_qp *qp, struct d_ocp_qp_sol *qp_sol, struct d_ocp_qp_res *res, struct d_ocp_qp_res_ws *ws); |
||||
//
|
||||
void d_ocp_qp_res_compute_lin(struct d_ocp_qp *qp, struct d_ocp_qp_sol *qp_sol, struct d_ocp_qp_sol *qp_step, struct d_ocp_qp_res *res, struct d_ocp_qp_res_ws *ws); |
||||
//
|
||||
void d_ocp_qp_res_compute_inf_norm(struct d_ocp_qp_res *res); |
||||
//
|
||||
void d_ocp_qp_res_get_all(struct d_ocp_qp_res *res, double **res_r, double **res_q, double **res_ls, double **res_us, double **res_b, double **res_d_lb, double **res_d_ub, double **res_d_lg, double **res_d_ug, double **res_d_ls, double **res_d_us, double **res_m_lb, double **res_m_ub, double **res_m_lg, double **res_m_ug, double **res_m_ls, double **res_m_us); |
||||
//
|
||||
void d_ocp_qp_res_get_max_res_stat(struct d_ocp_qp_res *res, double *value); |
||||
//
|
||||
void d_ocp_qp_res_get_max_res_eq(struct d_ocp_qp_res *res, double *value); |
||||
//
|
||||
void d_ocp_qp_res_get_max_res_ineq(struct d_ocp_qp_res *res, double *value); |
||||
//
|
||||
void d_ocp_qp_res_get_max_res_comp(struct d_ocp_qp_res *res, double *value); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QP_RES_H_
|
@ -0,0 +1,128 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QP_SOL_H_ |
||||
#define HPIPM_D_OCP_QP_SOL_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_ocp_qp_dim.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_ocp_qp_sol |
||||
{ |
||||
struct d_ocp_qp_dim *dim; |
||||
struct blasfeo_dvec *ux; |
||||
struct blasfeo_dvec *pi; |
||||
struct blasfeo_dvec *lam; |
||||
struct blasfeo_dvec *t; |
||||
void *misc; |
||||
hpipm_size_t memsize; // memory size in bytes
|
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_ocp_qp_sol_strsize(); |
||||
//
|
||||
hpipm_size_t d_ocp_qp_sol_memsize(struct d_ocp_qp_dim *dim); |
||||
//
|
||||
void d_ocp_qp_sol_create(struct d_ocp_qp_dim *dim, struct d_ocp_qp_sol *qp_sol, void *memory); |
||||
//
|
||||
void d_ocp_qp_sol_copy_all(struct d_ocp_qp_sol *qp_sol_orig, struct d_ocp_qp_sol *qp_sol_dest); |
||||
//
|
||||
void d_ocp_qp_sol_get_all(struct d_ocp_qp_sol *qp_sol, double **u, double **x, double **ls, double **us, double **pi, double **lam_lb, double **lam_ub, double **lam_lg, double **lam_ug, double **lam_ls, double **lam_us); |
||||
//
|
||||
void d_ocp_qp_sol_get_all_rowmaj(struct d_ocp_qp_sol *qp_sol, double **u, double **x, double **ls, double **us, double **pi, double **lam_lb, double **lam_ub, double **lam_lg, double **lam_ug, double **lam_ls, double **lam_us); |
||||
//
|
||||
void d_ocp_qp_sol_set_all(double **u, double **x, double **ls, double **us, double **pi, double **lam_lb, double **lam_ub, double **lam_lg, double **lam_ug, double **lam_ls, double **lam_us, struct d_ocp_qp_sol *qp_sol); |
||||
//
|
||||
void d_ocp_qp_sol_get(char *field, int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_get_u(int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_get_x(int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_get_sl(int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_get_su(int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_get_pi(int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_get_lam_lb(int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_get_lam_lbu(int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_get_lam_lbx(int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_get_lam_ub(int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_get_lam_ubu(int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_get_lam_ubx(int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_get_lam_lg(int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_get_lam_ug(int stage, struct d_ocp_qp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_ocp_qp_sol_set(char *field, int stage, double *vec, struct d_ocp_qp_sol *qp_sol); |
||||
//
|
||||
void d_ocp_qp_sol_set_u(int stage, double *vec, struct d_ocp_qp_sol *qp_sol); |
||||
//
|
||||
void d_ocp_qp_sol_set_x(int stage, double *vec, struct d_ocp_qp_sol *qp_sol); |
||||
//
|
||||
void d_ocp_qp_sol_set_sl(int stage, double *vec, struct d_ocp_qp_sol *qp_sol); |
||||
//
|
||||
void d_ocp_qp_sol_set_su(int stage, double *vec, struct d_ocp_qp_sol *qp_sol); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QP_SOL_H_
|
@ -0,0 +1,82 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_OCP_QP_UTILS_H_ |
||||
#define HPIPM_D_OCP_QP_UTILS_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_ocp_qp_dim.h" |
||||
#include "hpipm_d_ocp_qp.h" |
||||
#include "hpipm_d_ocp_qp_sol.h" |
||||
#include "hpipm_d_ocp_qp_ipm.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
//
|
||||
void d_ocp_qp_dim_print(struct d_ocp_qp_dim *qp_dim); |
||||
//
|
||||
void d_ocp_qp_dim_codegen(char *file_name, char *mode, struct d_ocp_qp_dim *qp_dim); |
||||
//
|
||||
void d_ocp_qp_print(struct d_ocp_qp_dim *qp_dim, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_codegen(char *file_name, char *mode, struct d_ocp_qp_dim *qp_dim, struct d_ocp_qp *qp); |
||||
//
|
||||
void d_ocp_qp_sol_print(struct d_ocp_qp_dim *qp_dim, struct d_ocp_qp_sol *ocp_qp_sol); |
||||
//
|
||||
void d_ocp_qp_ipm_arg_print(struct d_ocp_qp_dim *qp_dim, struct d_ocp_qp_ipm_arg *arg); |
||||
//
|
||||
void d_ocp_qp_ipm_arg_codegen(char *file_name, char *mode, struct d_ocp_qp_dim *qp_dim, struct d_ocp_qp_ipm_arg *arg); |
||||
//
|
||||
void d_ocp_qp_res_print(struct d_ocp_qp_dim *qp_dim, struct d_ocp_qp_res *ocp_qp_res); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_OCP_QP_UTILS_H_
|
@ -0,0 +1,115 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_D_PART_COND_H_ |
||||
#define HPIPM_D_PART_COND_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_common.h" |
||||
#include "hpipm_d_cond.h" |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_part_cond_qp_arg |
||||
{ |
||||
struct d_cond_qp_arg *cond_arg; |
||||
int N2; |
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_part_cond_qp_ws |
||||
{ |
||||
struct d_cond_qp_ws *cond_workspace; |
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_part_cond_qp_arg_memsize(int N2); |
||||
//
|
||||
void d_part_cond_qp_arg_create(int N2, struct d_part_cond_qp_arg *cond_arg, void *mem); |
||||
//
|
||||
void d_part_cond_qp_arg_set_default(struct d_part_cond_qp_arg *cond_arg); |
||||
// set riccati-like algorithm: 0 classical, 1 squre-root
|
||||
void d_part_cond_qp_arg_set_ric_alg(int ric_alg, struct d_part_cond_qp_arg *cond_arg); |
||||
//
|
||||
void d_part_cond_qp_arg_set_comp_prim_sol(int value, struct d_part_cond_qp_arg *cond_arg); |
||||
//
|
||||
void d_part_cond_qp_arg_set_comp_dual_sol_eq(int value, struct d_part_cond_qp_arg *cond_arg); |
||||
//
|
||||
void d_part_cond_qp_arg_set_comp_dual_sol_ineq(int value, struct d_part_cond_qp_arg *cond_arg); |
||||
|
||||
//
|
||||
void d_part_cond_qp_compute_block_size(int N, int N2, int *block_size); |
||||
//
|
||||
void d_part_cond_qp_compute_dim(struct d_ocp_qp_dim *ocp_dim, int *block_size, struct d_ocp_qp_dim *part_dense_dim); |
||||
//
|
||||
hpipm_size_t d_part_cond_qp_ws_memsize(struct d_ocp_qp_dim *ocp_dim, int *block_size, struct d_ocp_qp_dim *part_dense_dim, struct d_part_cond_qp_arg *cond_arg); |
||||
//
|
||||
void d_part_cond_qp_ws_create(struct d_ocp_qp_dim *ocp_dim, int *block_size, struct d_ocp_qp_dim *part_dense_dim, struct d_part_cond_qp_arg *cond_arg, struct d_part_cond_qp_ws *cond_ws, void *mem); |
||||
//
|
||||
void d_part_cond_qp_cond(struct d_ocp_qp *ocp_qp, struct d_ocp_qp *part_dense_qp, struct d_part_cond_qp_arg *cond_arg, struct d_part_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_part_cond_qp_cond_lhs(struct d_ocp_qp *ocp_qp, struct d_ocp_qp *part_dense_qp, struct d_part_cond_qp_arg *cond_arg, struct d_part_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_part_cond_qp_cond_rhs(struct d_ocp_qp *ocp_qp, struct d_ocp_qp *part_dense_qp, struct d_part_cond_qp_arg *cond_arg, struct d_part_cond_qp_ws *cond_ws); |
||||
//
|
||||
void d_part_cond_qp_expand_sol(struct d_ocp_qp *ocp_qp, struct d_ocp_qp *part_dense_qp, struct d_ocp_qp_sol *part_dense_qp_sol, struct d_ocp_qp_sol *ocp_qp_sol, struct d_part_cond_qp_arg *cond_arg, struct d_part_cond_qp_ws *cond_ws); |
||||
|
||||
//
|
||||
void d_part_cond_qp_update(int *idxc, struct d_ocp_qp *ocp_qp, struct d_ocp_qp *part_dense_qp, struct d_part_cond_qp_arg *cond_arg, struct d_part_cond_qp_ws *cond_ws); |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_PART_COND_H_
|
@ -0,0 +1,106 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
|
||||
|
||||
#ifndef HPIPM_D_PART_COND_QCQP_H_ |
||||
#define HPIPM_D_PART_COND_QCQP_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_cond_qcqp.h" |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_part_cond_qcqp_arg |
||||
{ |
||||
struct d_cond_qcqp_arg *cond_arg; |
||||
int N2; |
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_part_cond_qcqp_ws |
||||
{ |
||||
struct d_cond_qcqp_ws *cond_ws; |
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_part_cond_qcqp_arg_memsize(int N2); |
||||
//
|
||||
void d_part_cond_qcqp_arg_create(int N2, struct d_part_cond_qcqp_arg *cond_arg, void *mem); |
||||
//
|
||||
void d_part_cond_qcqp_arg_set_default(struct d_part_cond_qcqp_arg *cond_arg); |
||||
// set riccati-like algorithm: 0 classical, 1 squre-root
|
||||
void d_part_cond_qcqp_arg_set_ric_alg(int ric_alg, struct d_part_cond_qcqp_arg *cond_arg); |
||||
|
||||
//
|
||||
void d_part_cond_qcqp_compute_block_size(int N, int N2, int *block_size); |
||||
//
|
||||
void d_part_cond_qcqp_compute_dim(struct d_ocp_qcqp_dim *ocp_dim, int *block_size, struct d_ocp_qcqp_dim *part_dense_dim); |
||||
//
|
||||
hpipm_size_t d_part_cond_qcqp_ws_memsize(struct d_ocp_qcqp_dim *ocp_dim, int *block_size, struct d_ocp_qcqp_dim *part_dense_dim, struct d_part_cond_qcqp_arg *cond_arg); |
||||
//
|
||||
void d_part_cond_qcqp_ws_create(struct d_ocp_qcqp_dim *ocp_dim, int *block_size, struct d_ocp_qcqp_dim *part_dense_dim, struct d_part_cond_qcqp_arg *cond_arg, struct d_part_cond_qcqp_ws *cond_ws, void *mem); |
||||
//
|
||||
void d_part_cond_qcqp_cond(struct d_ocp_qcqp *ocp_qp, struct d_ocp_qcqp *part_dense_qp, struct d_part_cond_qcqp_arg *cond_arg, struct d_part_cond_qcqp_ws *cond_ws); |
||||
//
|
||||
void d_part_cond_qcqp_cond_lhs(struct d_ocp_qcqp *ocp_qp, struct d_ocp_qcqp *part_dense_qp, struct d_part_cond_qcqp_arg *cond_arg, struct d_part_cond_qcqp_ws *cond_ws); |
||||
//
|
||||
void d_part_cond_qcqp_cond_rhs(struct d_ocp_qcqp *ocp_qp, struct d_ocp_qcqp *part_dense_qp, struct d_part_cond_qcqp_arg *cond_arg, struct d_part_cond_qcqp_ws *cond_ws); |
||||
//
|
||||
void d_part_cond_qcqp_expand_sol(struct d_ocp_qcqp *ocp_qp, struct d_ocp_qcqp *part_dense_qp, struct d_ocp_qcqp_sol *part_dense_qp_sol, struct d_ocp_qcqp_sol *ocp_qp_sol, struct d_part_cond_qcqp_arg *cond_arg, struct d_part_cond_qcqp_ws *cond_ws); |
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_PART_COND_H_
|
||||
|
@ -0,0 +1,122 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_SIM_ERK_H_ |
||||
#define HPIPM_D_SIM_ERK_H_ |
||||
|
||||
#include "hpipm_common.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
struct d_sim_erk_arg |
||||
{ |
||||
struct d_sim_rk_data *rk_data; // integrator data
|
||||
double h; // step size
|
||||
int steps; // number of steps
|
||||
// int for_sens; // compute adjoint sensitivities
|
||||
// int adj_sens; // compute adjoint sensitivities
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_sim_erk_ws |
||||
{ |
||||
void (*ode)(int t, double *x, double *p, void *ode_args, double *xdot); // function pointer to ode
|
||||
void (*vde_for)(int t, double *x, double *p, void *ode_args, double *xdot); // function pointer to forward vde
|
||||
void (*vde_adj)(int t, double *adj_in, void *ode_args, double *adj_out); // function pointer to adjoint vde
|
||||
void *ode_args; // pointer to ode args
|
||||
struct d_sim_erk_arg *erk_arg; // erk arg
|
||||
double *K; // internal variables
|
||||
double *x_for; // states and forward sensitivities
|
||||
double *x_traj; // states at all steps
|
||||
double *l; // adjoint sensitivities
|
||||
double *p; // parameter
|
||||
double *x_tmp; // temporary states and forward sensitivities
|
||||
double *adj_in; |
||||
double *adj_tmp; |
||||
int nx; // number of states
|
||||
int np; // number of parameters
|
||||
int nf; // number of forward sensitivities
|
||||
int na; // number of adjoint sensitivities
|
||||
int nf_max; // max number of forward sensitivities
|
||||
int na_max; // max number of adjoint sensitivities
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_sim_erk_arg_memsize(); |
||||
//
|
||||
void d_sim_erk_arg_create(struct d_sim_erk_arg *erk_arg, void *mem); |
||||
//
|
||||
void d_sim_erk_arg_set_all(struct d_sim_rk_data *rk_data, double h, int steps, struct d_sim_erk_arg *erk_arg); |
||||
|
||||
//
|
||||
hpipm_size_t d_sim_erk_ws_memsize(struct d_sim_erk_arg *erk_arg, int nx, int np, int nf_max, int na_max); |
||||
//
|
||||
void d_sim_erk_ws_create(struct d_sim_erk_arg *erk_arg, int nx, int np, int nf_max, int na_max, struct d_sim_erk_ws *work, void *memory); |
||||
//
|
||||
void d_sim_erk_ws_set_all(int nf, int na, double *x, double *fs, double *bs, double *p, void (*ode)(int t, double *x, double *p, void *ode_args, double *xdot), void (*vde_for)(int t, double *x, double *p, void *ode_args, double *xdot), void (*vde_adj)(int t, double *adj_in, void *ode_args, double *adj_out), void *ode_args, struct d_sim_erk_ws *work); |
||||
// number of directions for forward sensitivities
|
||||
void d_sim_erk_ws_set_nf(int *nf, struct d_sim_erk_ws *work); |
||||
// parameters (e.g. inputs)
|
||||
void d_sim_erk_ws_set_p(double *p, struct d_sim_erk_ws *work); |
||||
// state
|
||||
void d_sim_erk_ws_set_x(double *x, struct d_sim_erk_ws *work); |
||||
// forward sensitivities
|
||||
void d_sim_erk_ws_set_fs(double *fs, struct d_sim_erk_ws *work); |
||||
// ode funtion
|
||||
void d_sim_erk_ws_set_ode(void (*ode)(int t, double *x, double *p, void *ode_args, double *xdot), struct d_sim_erk_ws *work); |
||||
// forward vde function
|
||||
void d_sim_erk_ws_set_vde_for(void (*ode)(int t, double *x, double *p, void *ode_args, double *xdot), struct d_sim_erk_ws *work); |
||||
// ode_args, passed straight to the ode/vde_for/vde_adj functions
|
||||
void d_sim_erk_ws_set_ode_args(void *ode_args, struct d_sim_erk_ws *work); |
||||
// state
|
||||
void d_sim_erk_ws_get_x(struct d_sim_erk_ws *work, double *x); |
||||
// forward sensitivities
|
||||
void d_sim_erk_ws_get_fs(struct d_sim_erk_ws *work, double *fs); |
||||
//
|
||||
void d_sim_erk_solve(struct d_sim_erk_arg *arg, struct d_sim_erk_ws *work); |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif // HPIPM_D_SIM_ERK_H_
|
||||
|
@ -0,0 +1,71 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_SIM_RK_H_ |
||||
#define HPIPM_D_SIM_RK_H_ |
||||
|
||||
#include "hpipm_common.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
struct d_sim_rk_data |
||||
{ |
||||
double *A_rk; // A in butcher tableau
|
||||
double *B_rk; // b in butcher tableau
|
||||
double *C_rk; // c in butcher tableau
|
||||
int expl; // erk vs irk
|
||||
int ns; // number of stages
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_sim_rk_data_memsize(int ns); |
||||
//
|
||||
void d_sim_rk_data_create(int ns, struct d_sim_rk_data *rk_data, void *memory); |
||||
//
|
||||
void d_sim_rk_data_init_default(char *field, struct d_sim_rk_data *rk_data); |
||||
//
|
||||
void d_sim_rk_data_set_all(int expl, double *A_rk, double *B_rk, double *C_rk, struct d_sim_rk_data *rk_data); |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif // HPIPM_D_SIM_RK_H_
|
||||
|
@ -0,0 +1,213 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_TREE_OCP_QCQP_H_ |
||||
#define HPIPM_D_TREE_OCP_QCQP_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_common.h" |
||||
#include "hpipm_d_tree_ocp_qcqp_dim.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_tree_ocp_qcqp |
||||
{ |
||||
struct d_tree_ocp_qcqp_dim *dim; |
||||
struct blasfeo_dmat *BAbt; // Nn-1
|
||||
struct blasfeo_dmat *RSQrq; // Nn
|
||||
struct blasfeo_dmat *DCt; // Nn
|
||||
struct blasfeo_dmat **Hq; // Nn
|
||||
struct blasfeo_dvec *b; // Nn-1
|
||||
struct blasfeo_dvec *rqz; // Nn
|
||||
struct blasfeo_dvec *d; // Nn
|
||||
struct blasfeo_dvec *d_mask; // Nn
|
||||
struct blasfeo_dvec *m; // Nn
|
||||
struct blasfeo_dvec *Z; // Nn
|
||||
int **idxb; // indices of box constrained variables within [u; x] // Nn
|
||||
int **idxs_rev; // index of soft constraints
|
||||
hpipm_size_t memsize; // memory size in bytes
|
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_tree_ocp_qcqp_memsize(struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_create(struct d_tree_ocp_qcqp_dim *dim, struct d_tree_ocp_qcqp *qp, void *memory); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_all(double **A, double **B, double **b, double **Q, double **S, double **R, double **q, double **r, int **idxb, double **d_lb, double **d_ub, double **C, double **D, double **d_lg, double **d_ug, double **Zl, double **Zu, double **zl, double **zu, int **idxs, double **d_ls, double **d_us, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set(char *field_name, int node_edge, void *value, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_A(int edge, double *mat, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_B(int edge, double *mat, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_b(int edge, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_Q(int node, double *mat, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_S(int node, double *mat, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_R(int node, double *mat, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_q(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_r(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_lb(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_lb_mask(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_ub(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_ub_mask(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_lbx(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_lbx_mask(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_ubx(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_ubx_mask(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_lbu(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_lbu_mask(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_ubu(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_ubu_mask(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_idxb(int node, int *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_idxbx(int node, int *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_Jbx(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_idxbu(int node, int *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_Jbu(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_C(int node, double *mat, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_D(int node, double *mat, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_lg(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_lg_mask(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_ug(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_ug_mask(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_Qq(int node, double *mat, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_Sq(int node, double *mat, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_Rq(int node, double *mat, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_qq(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_rq(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_uq(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_uq_mask(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_Zl(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_Zu(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_zl(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_zu(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_lls(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_lls_mask(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_lus(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_lus_mask(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_idxs(int node, int *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_idxs_rev(int node, int *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_Jsbu(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_Jsbx(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_Jsg(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
void d_tree_ocp_qcqp_set_Jsq(int node, double *vec, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
//void d_tree_ocp_qcqp_set_idxe(int node, int *vec, struct d_tree_ocp_qcqp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qcqp_set_idxbxe(int node, int *vec, struct d_tree_ocp_qcqp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qcqp_set_idxbue(int node, int *vec, struct d_tree_ocp_qcqp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qcqp_set_idxge(int node, int *vec, struct d_tree_ocp_qcqp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qcqp_set_Jbxe(int node, double *vec, struct d_tree_ocp_qcqp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qcqp_set_Jbue(int node, double *vec, struct d_tree_ocp_qcqp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qcqp_set_Jge(int node, double *vec, struct d_tree_ocp_qcqp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qcqp_set_diag_H_flag(int node, int *value, struct d_tree_ocp_qcqp *qp);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_TREE_OCP_QCQP_H_
|
||||
|
@ -0,0 +1,117 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_TREE_OCP_QCQP_DIM_H_ |
||||
#define HPIPM_D_TREE_OCP_QCQP_DIM_H_ |
||||
|
||||
#include "hpipm_common.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_tree_ocp_qcqp_dim |
||||
{ |
||||
struct d_tree_ocp_qp_dim *qp_dim; // dim of qp approximation
|
||||
struct tree *ttree; // tree describing node conndection
|
||||
int *nx; // number of states // Nn
|
||||
int *nu; // number of inputs // Nn
|
||||
int *nb; // number of box constraints // Nn
|
||||
int *nbx; // number of state box constraints // Nn
|
||||
int *nbu; // number of input box constraints // Nn
|
||||
int *ng; // number of general constraints // Nn
|
||||
int *nq; // number of (upper) quadratic constraints
|
||||
int *ns; // number of soft constraints // Nn
|
||||
int *nsbx; // number of soft state box constraints
|
||||
int *nsbu; // number of soft input box constraints
|
||||
int *nsg; // number of soft general constraints
|
||||
int *nsq; // number of (upper) soft quadratic constraints
|
||||
int Nn; // number of nodes
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_tree_ocp_qcqp_dim_strsize(); |
||||
//
|
||||
hpipm_size_t d_tree_ocp_qcqp_dim_memsize(int Nn); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_create(int Nn, struct d_tree_ocp_qcqp_dim *qp_dim, void *memory); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_set_tree(struct tree *ttree, struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_set(char *field, int stage, int value, struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_set_nx(int stage, int value, struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_set_nu(int stage, int value, struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_set_nbx(int stage, int value, struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_set_nbu(int stage, int value, struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_set_ng(int stage, int value, struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_set_nq(int stage, int value, struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_set_ns(int stage, int value, struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_set_nsbx(int stage, int value, struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_set_nsbu(int stage, int value, struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_set_nsg(int stage, int value, struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_dim_set_nsq(int stage, int value, struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
//void d_tree_ocp_qcqp_dim_set_nbxe(int stage, int value, struct d_tree_ocp_qcqp_dim *dim);
|
||||
//
|
||||
//void d_tree_ocp_qcqp_dim_set_nbue(int stage, int value, struct d_tree_ocp_qcqp_dim *dim);
|
||||
//
|
||||
//void d_tree_ocp_qcqp_dim_set_nge(int stage, int value, struct d_tree_ocp_qcqp_dim *dim);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_TREE_OCP_QCQP_DIM_H_
|
||||
|
@ -0,0 +1,191 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_TREE_OCP_QCQP_IPM_H_ |
||||
#define HPIPM_D_TREE_OCP_QCQP_IPM_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include <hpipm_common.h> |
||||
#include <hpipm_d_tree_ocp_qcqp_dim.h> |
||||
#include <hpipm_d_tree_ocp_qp.h> |
||||
#include <hpipm_d_tree_ocp_qcqp_res.h> |
||||
#include <hpipm_d_tree_ocp_qcqp_sol.h> |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_tree_ocp_qcqp_ipm_arg |
||||
{ |
||||
struct d_tree_ocp_qp_ipm_arg *qp_arg; |
||||
double mu0; // initial value for complementarity slackness
|
||||
double alpha_min; // exit cond on step length
|
||||
double res_g_max; // exit cond on inf norm of residuals
|
||||
double res_b_max; // exit cond on inf norm of residuals
|
||||
double res_d_max; // exit cond on inf norm of residuals
|
||||
double res_m_max; // exit cond on inf norm of residuals
|
||||
double reg_prim; // reg of primal hessian
|
||||
double lam_min; // min value in lam vector
|
||||
double t_min; // min value in t vector
|
||||
int iter_max; // exit cond in iter number
|
||||
int stat_max; // iterations saved in stat
|
||||
int pred_corr; // use Mehrotra's predictor-corrector IPM algirthm
|
||||
int cond_pred_corr; // conditional Mehrotra's predictor-corrector
|
||||
int itref_pred_max; // max number of iterative refinement steps for predictor step
|
||||
int itref_corr_max; // max number of iterative refinement steps for corrector step
|
||||
int warm_start; // 0 no warm start, 1 warm start primal sol, 2 warm start primal and dual sol
|
||||
// int square_root_alg; // 0 classical Riccati, 1 square-root Riccati
|
||||
int lq_fact; // 0 syrk+potrf, 1 mix, 2 lq (for square_root_alg==1)
|
||||
int abs_form; // absolute IPM formulation
|
||||
int comp_dual_sol_eq; // dual solution of equality constrains (only for abs_form==1)
|
||||
int comp_res_exit; // compute residuals on exit (only for abs_form==1 and comp_dual_sol_eq==1)
|
||||
// int comp_res_pred; // compute residuals of prediction
|
||||
int split_step; // use different step for primal and dual variables
|
||||
int t_lam_min; // clip t and lam: 0 no, 1 in Gamma computation, 2 in solution
|
||||
int mode; |
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_tree_ocp_qcqp_ipm_ws |
||||
{ |
||||
struct d_tree_ocp_qp_ipm_ws *qp_ws; |
||||
struct d_tree_ocp_qp *qp; |
||||
struct d_tree_ocp_qp_sol *qp_sol; |
||||
struct d_tree_ocp_qcqp_res_ws *qcqp_res_ws; |
||||
struct d_tree_ocp_qcqp_res *qcqp_res; |
||||
struct blasfeo_dvec *tmp_nuxM; |
||||
int iter; // iteration number
|
||||
int status; |
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_tree_ocp_qcqp_ipm_arg_strsize(); |
||||
//
|
||||
hpipm_size_t d_tree_ocp_qcqp_ipm_arg_memsize(struct d_tree_ocp_qcqp_dim *ocp_dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_arg_create(struct d_tree_ocp_qcqp_dim *ocp_dim, struct d_tree_ocp_qcqp_ipm_arg *arg, void *mem); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_default(enum hpipm_mode mode, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_arg_set(char *field, void *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// set maximum number of iterations
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_iter_max(int *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// set minimum step lenght
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_alpha_min(double *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// set initial value of barrier parameter
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_mu0(double *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// set exit tolerance on stationarity condition
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_tol_stat(double *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// set exit tolerance on equality constr
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_tol_eq(double *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// set exit tolerance on inequality constr
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_tol_ineq(double *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// set exit tolerance on complementarity condition
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_tol_comp(double *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// set regularization of primal variables
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_reg_prim(double *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// set warm start: 0 no warm start, 1 primal var
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_warm_start(int *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// Mehrotra's predictor-corrector IPM algorithm: 0 no predictor-corrector, 1 use predictor-corrector
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_pred_corr(int *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// conditional predictor-corrector: 0 no conditinal predictor-corrector, 1 conditional predictor-corrector
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_cond_pred_corr(int *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// set riccati algorithm: 0 classic, 1 square-root
|
||||
//void d_tree_ocp_qcqp_ipm_arg_set_ric_alg(int *value, struct d_tree_ocp_qcqp_ipm_arg *arg);
|
||||
// compute residuals after solution
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_comp_res_exit(int *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// compute residuals of prediction
|
||||
//void d_tree_ocp_qcqp_ipm_arg_set_comp_res_pred(int *value, struct d_tree_ocp_qcqp_ipm_arg *arg);
|
||||
// min value of lam in the solution
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_lam_min(double *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// min value of t in the solution
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_t_min(double *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// use different step for primal and dual variables
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_split_step(int *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
// clip t and lam: 0 no, 1 in Gamma computation, 2 in solution
|
||||
void d_tree_ocp_qcqp_ipm_arg_set_t_lam_min(int *value, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
|
||||
//
|
||||
hpipm_size_t d_tree_ocp_qcqp_ipm_ws_strsize(); |
||||
//
|
||||
hpipm_size_t d_tree_ocp_qcqp_ipm_ws_memsize(struct d_tree_ocp_qcqp_dim *ocp_dim, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_ws_create(struct d_tree_ocp_qcqp_dim *ocp_dim, struct d_tree_ocp_qcqp_ipm_arg *arg, struct d_tree_ocp_qcqp_ipm_ws *ws, void *mem); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_get(char *field, struct d_tree_ocp_qcqp_ipm_ws *ws, void *value); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_get_status(struct d_tree_ocp_qcqp_ipm_ws *ws, int *status); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_get_iter(struct d_tree_ocp_qcqp_ipm_ws *ws, int *iter); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_get_max_res_stat(struct d_tree_ocp_qcqp_ipm_ws *ws, double *res_stat); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_get_max_res_eq(struct d_tree_ocp_qcqp_ipm_ws *ws, double *res_eq); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_get_max_res_ineq(struct d_tree_ocp_qcqp_ipm_ws *ws, double *res_ineq); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_get_max_res_comp(struct d_tree_ocp_qcqp_ipm_ws *ws, double *res_comp); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_get_stat(struct d_tree_ocp_qcqp_ipm_ws *ws, double **stat); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_get_stat_m(struct d_tree_ocp_qcqp_ipm_ws *ws, int *stat_m); |
||||
//
|
||||
void d_tree_ocp_qcqp_init_var(struct d_tree_ocp_qcqp *qp, struct d_tree_ocp_qcqp_sol *qp_sol, struct d_tree_ocp_qcqp_ipm_arg *arg, struct d_tree_ocp_qcqp_ipm_ws *ws); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_solve(struct d_tree_ocp_qcqp *qp, struct d_tree_ocp_qcqp_sol *qp_sol, struct d_tree_ocp_qcqp_ipm_arg *arg, struct d_tree_ocp_qcqp_ipm_ws *ws); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
#endif // HPIPM_D_TREE_OCP_QCQP_IPM_H_
|
||||
|
||||
|
@ -0,0 +1,108 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_TREE_OCP_QCQP_RES_H_ |
||||
#define HPIPM_D_TREE_OCP_QCQP_RES_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include <hpipm_common.h> |
||||
#include <hpipm_d_tree_ocp_qcqp_dim.h> |
||||
#include <hpipm_d_tree_ocp_qcqp.h> |
||||
#include <hpipm_d_tree_ocp_qcqp_sol.h> |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_tree_ocp_qcqp_res |
||||
{ |
||||
struct d_tree_ocp_qcqp_dim *dim; |
||||
struct blasfeo_dvec *res_g; // q-residuals
|
||||
struct blasfeo_dvec *res_b; // b-residuals
|
||||
struct blasfeo_dvec *res_d; // d-residuals
|
||||
struct blasfeo_dvec *res_m; // m-residuals
|
||||
double res_max[4]; // max of residuals
|
||||
double res_mu; // mu-residual
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
struct d_tree_ocp_qcqp_res_ws |
||||
{ |
||||
struct blasfeo_dvec *tmp_nuxM; // work space of size nuM+nxM
|
||||
struct blasfeo_dvec *tmp_nbgqM; // work space of size nbM+ngM+nqM
|
||||
struct blasfeo_dvec *tmp_nsM; // work space of size nsM
|
||||
struct blasfeo_dvec *q_fun; // value for evaluation of quadr constr
|
||||
struct blasfeo_dvec *q_adj; // value for adjoint of quadr constr
|
||||
int use_q_fun; // reuse cached value for evaluation of quadr constr
|
||||
int use_q_adj; // reuse cached value for adjoint of quadr constr
|
||||
hpipm_size_t memsize; |
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_tree_ocp_qcqp_res_memsize(struct d_tree_ocp_qcqp_dim *ocp_dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_res_create(struct d_tree_ocp_qcqp_dim *ocp_dim, struct d_tree_ocp_qcqp_res *res, void *mem); |
||||
//
|
||||
hpipm_size_t d_tree_ocp_qcqp_res_ws_memsize(struct d_tree_ocp_qcqp_dim *ocp_dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_res_ws_create(struct d_tree_ocp_qcqp_dim *ocp_dim, struct d_tree_ocp_qcqp_res_ws *ws, void *mem); |
||||
//
|
||||
void d_tree_ocp_qcqp_res_compute(struct d_tree_ocp_qcqp *qp, struct d_tree_ocp_qcqp_sol *qp_sol, struct d_tree_ocp_qcqp_res *res, struct d_tree_ocp_qcqp_res_ws *ws); |
||||
//
|
||||
void d_tree_ocp_qcqp_res_compute_inf_norm(struct d_tree_ocp_qcqp_res *res); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
#endif // HPIPM_D_TREE_OCP_QCQP_RES_H_
|
||||
|
||||
|
||||
|
@ -0,0 +1,99 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_TREE_OCP_QCQP_SOL_H_ |
||||
#define HPIPM_D_TREE_OCP_QCQP_SOL_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_tree_ocp_qcqp_dim.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
struct d_tree_ocp_qcqp_sol |
||||
{ |
||||
struct d_tree_ocp_qcqp_dim *dim; |
||||
struct blasfeo_dvec *ux; |
||||
struct blasfeo_dvec *pi; |
||||
struct blasfeo_dvec *lam; |
||||
struct blasfeo_dvec *t; |
||||
void *misc; |
||||
hpipm_size_t memsize; // memory size in bytes
|
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_tree_ocp_qcqp_sol_memsize(struct d_tree_ocp_qcqp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qcqp_sol_create(struct d_tree_ocp_qcqp_dim *dim, struct d_tree_ocp_qcqp_sol *qp_sol, void *memory); |
||||
//
|
||||
void d_tree_ocp_qcqp_sol_get(char *field, int node_edge, struct d_tree_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_tree_ocp_qcqp_sol_get_u(int node, struct d_tree_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_tree_ocp_qcqp_sol_get_x(int node, struct d_tree_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_tree_ocp_qcqp_sol_get_sl(int node, struct d_tree_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_tree_ocp_qcqp_sol_get_su(int node, struct d_tree_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_tree_ocp_qcqp_sol_get_pi(int edge, struct d_tree_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_tree_ocp_qcqp_sol_get_lam_lb(int node, struct d_tree_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_tree_ocp_qcqp_sol_get_lam_ub(int node, struct d_tree_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_tree_ocp_qcqp_sol_get_lam_lg(int node, struct d_tree_ocp_qcqp_sol *qp_sol, double *vec); |
||||
//
|
||||
void d_tree_ocp_qcqp_sol_get_lam_ug(int node, struct d_tree_ocp_qcqp_sol *qp_sol, double *vec); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_TREE_OCP_QCQP_SOL_H_
|
||||
|
@ -0,0 +1,84 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_TREE_OCP_QP_UTILS_H_ |
||||
#define HPIPM_D_TREE_OCP_QP_UTILS_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_tree_ocp_qcqp_dim.h" |
||||
#include "hpipm_d_tree_ocp_qcqp.h" |
||||
#include "hpipm_d_tree_ocp_qcqp_sol.h" |
||||
#include "hpipm_d_tree_ocp_qcqp_ipm.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
//
|
||||
void d_tree_ocp_qcqp_dim_print(struct d_tree_ocp_qcqp_dim *qp_dim); |
||||
//
|
||||
//void d_tree_ocp_qcqp_dim_codegen(char *file_name, char *mode, struct d_tree_ocp_qcqp_dim *qp_dim);
|
||||
//
|
||||
void d_tree_ocp_qcqp_print(struct d_tree_ocp_qcqp_dim *qp_dim, struct d_tree_ocp_qcqp *qp); |
||||
//
|
||||
//void d_tree_ocp_qcqp_codegen(char *file_name, char *mode, struct d_tree_ocp_qcqp_dim *qp_dim, struct d_tree_ocp_qcqp *qp);
|
||||
//
|
||||
void d_tree_ocp_qcqp_sol_print(struct d_tree_ocp_qcqp_dim *qp_dim, struct d_tree_ocp_qcqp_sol *ocp_qcqp_sol); |
||||
//
|
||||
void d_tree_ocp_qcqp_ipm_arg_print(struct d_tree_ocp_qcqp_dim *qp_dim, struct d_tree_ocp_qcqp_ipm_arg *arg); |
||||
//
|
||||
//void d_tree_ocp_qcqp_ipm_arg_codegen(char *file_name, char *mode, struct d_tree_ocp_qcqp_dim *qp_dim, struct d_tree_ocp_qcqp_ipm_arg *arg);
|
||||
//
|
||||
void d_tree_ocp_qcqp_res_print(struct d_tree_ocp_qcqp_dim *qp_dim, struct d_tree_ocp_qcqp_res *ocp_qcqp_res); |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} // #extern "C"
|
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_TREE_OCP_QP_UTILS_H_
|
||||
|
||||
|
@ -0,0 +1,195 @@ |
||||
/**************************************************************************************************
|
||||
* * |
||||
* This file is part of HPIPM. * |
||||
* * |
||||
* HPIPM -- High-Performance Interior Point Method. * |
||||
* Copyright (C) 2019 by Gianluca Frison. * |
||||
* Developed at IMTEK (University of Freiburg) under the supervision of Moritz Diehl. * |
||||
* All rights reserved. * |
||||
* * |
||||
* The 2-Clause BSD License * |
||||
* * |
||||
* Redistribution and use in source and binary forms, with or without * |
||||
* modification, are permitted provided that the following conditions are met: * |
||||
* * |
||||
* 1. Redistributions of source code must retain the above copyright notice, this * |
||||
* list of conditions and the following disclaimer. * |
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, * |
||||
* this list of conditions and the following disclaimer in the documentation * |
||||
* and/or other materials provided with the distribution. * |
||||
* * |
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * |
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * |
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * |
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * |
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * |
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * |
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * |
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * |
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
||||
* * |
||||
* Author: Gianluca Frison, gianluca.frison (at) imtek.uni-freiburg.de * |
||||
* * |
||||
**************************************************************************************************/ |
||||
|
||||
#ifndef HPIPM_D_TREE_OCP_QP_H_ |
||||
#define HPIPM_D_TREE_OCP_QP_H_ |
||||
|
||||
|
||||
|
||||
#include <blasfeo_target.h> |
||||
#include <blasfeo_common.h> |
||||
|
||||
#include "hpipm_d_tree_ocp_qp_dim.h" |
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
|
||||
|
||||
struct d_tree_ocp_qp |
||||
{ |
||||
struct d_tree_ocp_qp_dim *dim; |
||||
struct blasfeo_dmat *BAbt; // Nn-1
|
||||
struct blasfeo_dmat *RSQrq; // Nn
|
||||
struct blasfeo_dmat *DCt; // Nn
|
||||
struct blasfeo_dvec *b; // Nn-1
|
||||
struct blasfeo_dvec *rqz; // Nn
|
||||
struct blasfeo_dvec *d; // Nn
|
||||
struct blasfeo_dvec *d_mask; // Nn
|
||||
struct blasfeo_dvec *m; // Nn
|
||||
struct blasfeo_dvec *Z; // Nn
|
||||
int **idxb; // indices of box constrained variables within [u; x] // Nn
|
||||
// int **idxs; // index of soft constraints
|
||||
int **idxs_rev; // index of soft constraints
|
||||
hpipm_size_t memsize; // memory size in bytes
|
||||
}; |
||||
|
||||
|
||||
|
||||
//
|
||||
hpipm_size_t d_tree_ocp_qp_memsize(struct d_tree_ocp_qp_dim *dim); |
||||
//
|
||||
void d_tree_ocp_qp_create(struct d_tree_ocp_qp_dim *dim, struct d_tree_ocp_qp *qp, void *memory); |
||||
//
|
||||
void d_tree_ocp_qp_set_all(double **A, double **B, double **b, double **Q, double **S, double **R, double **q, double **r, int **idxb, double **d_lb, double **d_ub, double **C, double **D, double **d_lg, double **d_ug, double **Zl, double **Zu, double **zl, double **zu, int **idxs, double **d_ls, double **d_us, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set(char *field_name, int node_edge, void *value, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_A(int edge, double *mat, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_B(int edge, double *mat, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_b(int edge, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_Q(int node, double *mat, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_S(int node, double *mat, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_R(int node, double *mat, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_q(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_r(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_lb(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_lb_mask(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_ub(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_ub_mask(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_lbx(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_lbx_mask(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_ubx(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_ubx_mask(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_lbu(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_lbu_mask(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_ubu(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_ubu_mask(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_idxb(int node, int *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_idxbx(int node, int *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_Jbx(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_idxbu(int node, int *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_Jbu(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_C(int node, double *mat, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_D(int node, double *mat, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_lg(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_lg_mask(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_ug(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_ug_mask(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_Zl(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_Zu(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_zl(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_zu(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_lls(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_lls_mask(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_lus(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_lus_mask(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_idxs(int node, int *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_idxs_rev(int node, int *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_Jsbu(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_Jsbx(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
void d_tree_ocp_qp_set_Jsg(int node, double *vec, struct d_tree_ocp_qp *qp); |
||||
//
|
||||
//void d_tree_ocp_qp_set_idxe(int node, int *vec, struct d_tree_ocp_qp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qp_set_idxbxe(int node, int *vec, struct d_tree_ocp_qp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qp_set_idxbue(int node, int *vec, struct d_tree_ocp_qp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qp_set_idxge(int node, int *vec, struct d_tree_ocp_qp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qp_set_Jbxe(int node, double *vec, struct d_tree_ocp_qp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qp_set_Jbue(int node, double *vec, struct d_tree_ocp_qp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qp_set_Jge(int node, double *vec, struct d_tree_ocp_qp *qp);
|
||||
//
|
||||
//void d_tree_ocp_qp_set_diag_H_flag(int node, int *value, struct d_tree_ocp_qp *qp);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
|
||||
|
||||
#endif // HPIPM_D_TREE_OCP_QP_H_
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue