Skip to content

Commit 3aed706

Browse files
committed
removed an unnecessary memory allocation
1 parent 5beaccd commit 3aed706

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

modules/cuqdyn-c/src/functions.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,12 @@ void *ode_model_obj_func(double *x, void *data)
4646
N_Vector parameters = N_VNew_Serial(conf->ode_expr.p_count);
4747
memcpy(NV_DATA_S(parameters), x, NV_LENGTH_S(parameters) * sizeof(realtype));
4848

49-
N_Vector initial_values = N_VNew_Serial(NV_LENGTH_S(exptotal->initial_values));
50-
memcpy(NV_DATA_S(initial_values), NV_DATA_S(exptotal->initial_values),
51-
NV_LENGTH_S(exptotal->initial_values) * sizeof(realtype));
52-
5349
N_Vector texp = N_VNew_Serial(NV_LENGTH_S(exptotal->texp));
5450
memcpy(NV_DATA_S(texp), NV_DATA_S(exptotal->texp), NV_LENGTH_S(exptotal->texp) * sizeof(realtype));
5551

5652
const realtype t0 = NV_Ith_S(texp, 0);
5753

58-
DlsMat result = solve_ode(parameters, initial_values, t0, texp);
54+
DlsMat result = solve_ode(parameters, exptotal->initial_values, t0, texp);
5955

6056
// Objective function code:
6157
const int rows = SM_ROWS_D(result);

0 commit comments

Comments
 (0)