Permalink
Browse files

fixed lint

  • Loading branch information...
giaf committed Jun 14, 2018
1 parent 54334cc commit a1f0f300eb2c7ba8243df6a7414dcd685f2019ad
@@ -210,19 +210,20 @@ void ocp_nlp_constraints_bgh_opts_update(void *config_, void *dims_, void *opts_
void ocp_nlp_constraints_bgh_opts_set(void *config_, void *dims_, void *opts_, enum acados_opts name, void *ptr_value)
void ocp_nlp_constraints_bgh_opts_set(void *config_, void *dims_, void *opts_,
enum acados_opts name, void *ptr_value)
{
ocp_nlp_constraints_bgh_opts *opts = opts_;
if (name==COMPUTE_ADJ)
if (name == COMPUTE_ADJ)
{
int *compute_adj = ptr_value;
opts->compute_adj = *compute_adj;
}
else
{
// TODO something better tha this print-and-exit
// TODO(fuck_you_lint): something better tha this print-and-exit
printf("\nocp_nlp_constraints_bgh_opts_set: unknown opts name !\n");
exit(1);
}
@@ -543,13 +544,13 @@ void ocp_nlp_constraints_bgh_update_qp_matrices(void *config_, void *dims_, void
if (opts->compute_adj)
{
blasfeo_dvecse(nu + nx + 2 * ns, 0.0, &memory->adj, 0);
blasfeo_daxpy(nb + ng + nh, -1.0, memory->lam, nb + ng + nh, memory->lam, 0, &work->tmp_ni, 0);
blasfeo_daxpy(nb + ng + nh, -1.0, memory->lam, nb+ng+nh, memory->lam, 0, &work->tmp_ni, 0);
blasfeo_dvecad_sp(nb, 1.0, &work->tmp_ni, 0, model->idxb, &memory->adj, 0);
blasfeo_dgemv_n(nu + nx, ng + nh, 1.0, memory->DCt, 0, 0, &work->tmp_ni, nb, 1.0, &memory->adj,
blasfeo_dgemv_n(nu+nx, ng+nh, 1.0, memory->DCt, 0, 0, &work->tmp_ni, nb, 1.0, &memory->adj,
0, &memory->adj, 0);
// soft
blasfeo_dvecex_sp(ns, 1.0, model->idxs, memory->lam, 0, &memory->adj, nu + nx);
blasfeo_dvecex_sp(ns, 1.0, model->idxs, memory->lam, nb + ng + nh, &memory->adj, nu + nx + ns);
blasfeo_dvecex_sp(ns, 1.0, model->idxs, memory->lam, nb + ng + nh, &memory->adj, nu+nx+ns);
blasfeo_daxpy(2 * ns, 1.0, memory->lam, 2 * nb + 2 * ng + 2 * nh, &memory->adj, nu + nx,
&memory->adj, nu + nx);
}
@@ -97,7 +97,8 @@ void ocp_nlp_constraints_bgh_opts_initialize_default(void *config, void *dims, v
//
void ocp_nlp_constraints_bgh_opts_update(void *config, void *dims, void *opts);
//
void ocp_nlp_constraints_bgh_opts_set(void *config, void *dims, void *opts, enum acados_opts name, void *ptr_value);
void ocp_nlp_constraints_bgh_opts_set(void *config, void *dims, void *opts, enum acados_opts name,
void *ptr_value);
@@ -205,19 +205,20 @@ void ocp_nlp_constraints_bghp_opts_update(void *config_, void *dims_, void *opts
void ocp_nlp_constraints_bghp_opts_set(void *config_, void *dims_, void *opts_, enum acados_opts name, void *ptr_value)
void ocp_nlp_constraints_bghp_opts_set(void *config_, void *dims_, void *opts_,
enum acados_opts name, void *ptr_value)
{
ocp_nlp_constraints_bghp_opts *opts = opts_;
if (name==COMPUTE_ADJ)
if (name == COMPUTE_ADJ)
{
int *compute_adj = ptr_value;
opts->compute_adj = *compute_adj;
}
else
{
// TODO something better tha this print-and-exit
// TODO(fuck_lint): something better tha this print-and-exit
printf("\nocp_nlp_constraints_bghp_opts_set: unknown opts name !\n");
exit(1);
}
@@ -571,13 +572,13 @@ void ocp_nlp_constraints_bghp_update_qp_matrices(void *config_, void *dims_, voi
if (opts->compute_adj)
{
blasfeo_dvecse(nu + nx + 2 * ns, 0.0, &memory->adj, 0);
blasfeo_daxpy(nb + ng + nh, -1.0, memory->lam, nb + ng + nh, memory->lam, 0, &work->tmp_ni, 0);
blasfeo_daxpy(nb+ng+nh, -1.0, memory->lam, nb + ng + nh, memory->lam, 0, &work->tmp_ni, 0);
blasfeo_dvecad_sp(nb, 1.0, &work->tmp_ni, 0, model->idxb, &memory->adj, 0);
blasfeo_dgemv_n(nu + nx, ng + nh, 1.0, memory->DCt, 0, 0, &work->tmp_ni, nb, 1.0, &memory->adj,
blasfeo_dgemv_n(nu+nx, ng+nh, 1.0, memory->DCt, 0, 0, &work->tmp_ni, nb, 1.0, &memory->adj,
0, &memory->adj, 0);
// soft
blasfeo_dvecex_sp(ns, 1.0, model->idxs, memory->lam, 0, &memory->adj, nu + nx);
blasfeo_dvecex_sp(ns, 1.0, model->idxs, memory->lam, nb + ng + nh, &memory->adj, nu + nx + ns);
blasfeo_dvecex_sp(ns, 1.0, model->idxs, memory->lam, nb+ng+nh, &memory->adj, nu+nx+ns);
blasfeo_daxpy(2 * ns, 1.0, memory->lam, 2 * nb + 2 * ng + 2 * nh, &memory->adj, nu + nx,
&memory->adj, nu + nx);
}
@@ -91,7 +91,8 @@ void ocp_nlp_constraints_bghp_opts_initialize_default(void *config, void *dims,
//
void ocp_nlp_constraints_bghp_opts_update(void *config, void *dims, void *opts);
//
void ocp_nlp_constraints_bghp_opts_set(void *config, void *dims, void *opts, enum acados_opts name, void *ptr_value);
void ocp_nlp_constraints_bghp_opts_set(void *config, void *dims, void *opts, enum acados_opts name,
void *ptr_value);
/* memory */
@@ -47,7 +47,8 @@ typedef struct
void *(*opts_assign)(void *config, void *dims, void *raw_memory);
void (*opts_initialize_default)(void *config, void *dims, void *opts);
void (*opts_update)(void *config, void *dims, void *opts);
void (*opts_set) (void *config_, void *dims_, void *opts_, enum acados_opts name, void *ptr_value);
void (*opts_set)(void *config_, void *dims_, void *opts_, enum acados_opts name,
void *ptr_value);
int (*memory_calculate_size)(void *config, void *dims, void *opts);
struct blasfeo_dvec *(*memory_get_fun_ptr)(void *memory);
struct blasfeo_dvec *(*memory_get_adj_ptr)(void *memory);
@@ -51,7 +51,8 @@ typedef struct
int (*opts_calculate_size)(void *config, void *dims);
void *(*opts_assign)(void *config, void *dims, void *raw_memory);
void (*opts_initialize_default)(void *config, void *dims, void *opts);
void (*opts_set) (void *config_, void *dims_, void *opts_, enum acados_opts name, void *ptr_value);
void (*opts_set)(void *config_, void *dims_, void *opts_, enum acados_opts name,
void *ptr_value);
void (*opts_update)(void *config, void *dims, void *opts);
int (*memory_calculate_size)(void *config, void *dims, void *opts);
void *(*memory_assign)(void *config, void *dims, void *opts, void *raw_memory);
@@ -161,19 +161,20 @@ void ocp_nlp_dynamics_cont_opts_update(void *config_, void *dims_, void *opts_)
void ocp_nlp_dynamics_cont_opts_set(void *config_, void *dims_, void *opts_, enum acados_opts name, void *ptr_value)
void ocp_nlp_dynamics_cont_opts_set(void *config_, void *dims_, void *opts_, enum acados_opts name,
void *ptr_value)
{
ocp_nlp_dynamics_cont_opts *opts = opts_;
if (name==COMPUTE_ADJ)
if (name == COMPUTE_ADJ)
{
int *compute_adj = ptr_value;
opts->compute_adj = *compute_adj;
}
else
{
// TODO something better tha this print-and-exit
// TODO(fuck_you_lint): something better tha this print-and-exit
printf("\nocp_nlp_dynamics_cont_opts_set: unknown opts name !\n");
exit(1);
}
@@ -79,7 +79,8 @@ void ocp_nlp_dynamics_cont_opts_initialize_default(void *config, void *dims, voi
//
void ocp_nlp_dynamics_cont_opts_update(void *config, void *dims, void *opts);
//
void ocp_nlp_dynamics_cont_opts_set(void *config_, void *dims_, void *opts_, enum acados_opts name, void *ptr_value);
void ocp_nlp_dynamics_cont_opts_set(void *config_, void *dims_, void *opts_, enum acados_opts name,
void *ptr_value);
@@ -132,19 +132,20 @@ void ocp_nlp_dynamics_disc_opts_update(void *config_, void *dims_, void *opts_)
void ocp_nlp_dynamics_disc_opts_set(void *config_, void *dims_, void *opts_, enum acados_opts name, void *ptr_value)
void ocp_nlp_dynamics_disc_opts_set(void *config_, void *dims_, void *opts_, enum acados_opts name,
void *ptr_value)
{
ocp_nlp_dynamics_disc_opts *opts = opts_;
if (name==COMPUTE_ADJ)
if (name == COMPUTE_ADJ)
{
int *compute_adj = ptr_value;
opts->compute_adj = *compute_adj;
}
else
{
// TODO something better tha this print-and-exit
// TODO(fuck_you_lint): something better tha this print-and-exit
printf("\nocp_nlp_dynamics_disc_opts_set: unknown opts name !\n");
exit(1);
}
@@ -381,7 +382,7 @@ void *ocp_nlp_dynamics_disc_model_assign(void *config_, void *dims_, void *raw_m
void ocp_nlp_dynamics_disc_model_set_T(double T, void *model_)
void ocp_nlp_dynamics_disc_model_set_T(double T, void *model_)
{
return;
}
@@ -72,7 +72,8 @@ void ocp_nlp_dynamics_disc_opts_initialize_default(void *config, void *dims, voi
//
void ocp_nlp_dynamics_disc_opts_update(void *config, void *dims, void *opts);
//
void ocp_nlp_dynamics_cont_opts_set(void *config_, void *dims_, void *opts_, enum acados_opts name, void *ptr_value);
void ocp_nlp_dynamics_cont_opts_set(void *config_, void *dims_, void *opts_, enum acados_opts name,
void *ptr_value);
@@ -173,7 +173,8 @@ void ocp_nlp_sqp_rti_opts_initialize_default(void *config_, void *dims_, void *o
for (ii = 0; ii < N; ii++)
{
dynamics[ii]->opts_initialize_default(dynamics[ii], dims->dynamics[ii], opts->dynamics[ii]);
dynamics[ii]->opts_set(dynamics[ii], dims->dynamics[ii], opts->dynamics[ii], COMPUTE_ADJ, &compute_adj);
dynamics[ii]->opts_set(dynamics[ii], dims->dynamics[ii], opts->dynamics[ii], COMPUTE_ADJ,
&compute_adj);
}
// cost
@@ -185,8 +186,10 @@ void ocp_nlp_sqp_rti_opts_initialize_default(void *config_, void *dims_, void *o
// constraints
for (ii = 0; ii <= N; ii++)
{
constraints[ii]->opts_initialize_default(constraints[ii], dims->constraints[ii], opts->constraints[ii]);
constraints[ii]->opts_set(constraints[ii], dims->constraints[ii], opts->constraints[ii], COMPUTE_ADJ, &compute_adj);
constraints[ii]->opts_initialize_default(constraints[ii], dims->constraints[ii],
opts->constraints[ii]);
constraints[ii]->opts_set(constraints[ii], dims->constraints[ii], opts->constraints[ii],
COMPUTE_ADJ, &compute_adj);
}
return;
@@ -359,7 +362,7 @@ void *ocp_nlp_sqp_rti_memory_assign(void *config_, void *dims_, void *opts_, voi
opts->constraints[ii]);
}
assert((char *) raw_memory + ocp_nlp_sqp_rti_memory_calculate_size(config, dims, opts) >= c_ptr);
assert((char *) raw_memory+ocp_nlp_sqp_rti_memory_calculate_size(config, dims, opts) >= c_ptr);
return mem;
}
@@ -430,8 +433,9 @@ int ocp_nlp_sqp_rti_workspace_calculate_size(void *config_, void *dims_, void *o
// TODO(all): introduce member "memsize" in all structures to make on-line cast cheaper (i.e. avoid
// to calculate size on-line)
static void ocp_nlp_sqp_rti_cast_workspace(void *config_, ocp_nlp_dims *dims, ocp_nlp_sqp_rti_work *work,
ocp_nlp_sqp_rti_memory *mem, ocp_nlp_sqp_rti_opts *opts)
static void ocp_nlp_sqp_rti_cast_workspace(void *config_, ocp_nlp_dims *dims,
ocp_nlp_sqp_rti_work *work,
ocp_nlp_sqp_rti_memory *mem, ocp_nlp_sqp_rti_opts *opts)
{
ocp_nlp_solver_config *config = (ocp_nlp_solver_config *) config_;
@@ -500,8 +504,8 @@ static void ocp_nlp_sqp_rti_cast_workspace(void *config_, ocp_nlp_dims *dims, oc
************************************************/
static void initialize_qp(void *config_, ocp_nlp_dims *dims, ocp_nlp_in *nlp_in,
ocp_nlp_out *nlp_out, ocp_nlp_sqp_rti_opts *opts, ocp_nlp_sqp_rti_memory *mem,
ocp_nlp_sqp_rti_work *work)
ocp_nlp_out *nlp_out, ocp_nlp_sqp_rti_opts *opts,
ocp_nlp_sqp_rti_memory *mem, ocp_nlp_sqp_rti_work *work)
{
ocp_nlp_solver_config *config = (ocp_nlp_solver_config *) config_;
@@ -696,8 +700,9 @@ static void sqp_update_qp_vectors(void *config_, ocp_nlp_dims *dims, ocp_nlp_in
static void sqp_update_variables(ocp_nlp_dims *dims, ocp_nlp_out *nlp_out, ocp_nlp_sqp_rti_opts *opts,
ocp_nlp_sqp_rti_memory *mem, ocp_nlp_sqp_rti_work *work)
static void sqp_update_variables(ocp_nlp_dims *dims, ocp_nlp_out *nlp_out,
ocp_nlp_sqp_rti_opts *opts, ocp_nlp_sqp_rti_memory *mem,
ocp_nlp_sqp_rti_work *work)
{
// loop index
int i;
View
@@ -3240,13 +3240,18 @@ def CheckComment(line, filename, linenum, next_line_start, error):
# Check if the // may be in quotes. If so, ignore it
if re.sub(r'\\.', '', line[0:commentpos]).count('"') % 2 == 0:
# Allow one space for new scopes, two spaces otherwise:
# if (not (Match(r'^.*{ *//', line) and next_line_start == commentpos) and
# ((commentpos >= 1 and
# line[commentpos-1] not in string.whitespace) or
# (commentpos >= 2 and
# line[commentpos-2] not in string.whitespace))):
# error(filename, linenum, 'whitespace/comments', 2,
# 'At least two spaces is best between code and comments')
if (not (Match(r'^.*{ *//', line) and next_line_start == commentpos) and
((commentpos >= 1 and
line[commentpos-1] not in string.whitespace) or
(commentpos >= 2 and
line[commentpos-2] not in string.whitespace))):
line[commentpos-1] not in string.whitespace))):
error(filename, linenum, 'whitespace/comments', 2,
'At least two spaces is best between code and comments')
'At least one spaces is best between code and comments')
# Checks for common mistakes in TODO comments.
comment = line[commentpos:]

0 comments on commit a1f0f30

Please sign in to comment.