@@ -122,13 +122,13 @@ namespace CTF_int {
122
122
is_active = true ;
123
123
// copy initial static coefficients to initialzie model (defined in init_model.cxx)
124
124
memcpy (coeff_guess, init_guess, nparam*sizeof (double ));
125
+ name = (char *)alloc (strlen (name_)+1 );
126
+ name[0 ] = ' \0 ' ;
127
+ strcpy (name, name_);
125
128
#ifdef TUNE
126
129
/* for (int i=0; i<nparam; i++){
127
130
regularization[i] = coeff_guess[i]*REG_LAMBDA;
128
131
}*/
129
- name = (char *)alloc (strlen (name_)+1 );
130
- name[0 ] = ' \0 ' ;
131
- strcpy (name, name_);
132
132
hist_size = hist_size_;
133
133
mat_lda = nparam+1 ;
134
134
time_param_mat = (double *)alloc (mat_lda*hist_size*sizeof (double ));
@@ -140,8 +140,8 @@ namespace CTF_int {
140
140
avg_under_time = 0.0 ;
141
141
over_time = 0.0 ;
142
142
under_time = 0.0 ;
143
- get_all_models ().push_back (this );
144
143
#endif
144
+ get_all_models ().push_back (this );
145
145
}
146
146
147
147
@@ -155,8 +155,8 @@ namespace CTF_int {
155
155
156
156
template <int nparam>
157
157
LinModel<nparam>::~LinModel (){
158
- #ifdef TUNE
159
158
if (name != NULL ) cdealloc (name);
159
+ #ifdef TUNE
160
160
if (time_param_mat != NULL ) cdealloc (time_param_mat);
161
161
#endif
162
162
}
@@ -455,20 +455,21 @@ namespace CTF_int {
455
455
cdealloc (work);
456
456
cdealloc (iwork);
457
457
cdealloc (A);
458
- double step = 1 .;
459
- for (int ii=0 ; ii<nparam; ii++){
460
- if (b[ii] <= 0 .){
461
- step = std::min (step, -.999 *coeff_guess[ii]/(b[ii]-coeff_guess[ii]));
462
- }
463
- }
464
- assert (step>=0 .);
465
- if (step == 1 .)
466
- memcpy (coeff_guess, b, nparam*sizeof (double ));
467
- else {
468
- for (int ii=0 ; ii<nparam; ii++){
469
- coeff_guess[ii] = (1 .-step)*coeff_guess[ii] + step*b[ii];
470
- }
471
- }
458
+ // double step = 1.;
459
+ // for (int ii=0; ii<nparam; ii++){
460
+ // if (b[ii] <= 0.){
461
+ // step = std::min(step, -.999*coeff_guess[ii]/(b[ii]-coeff_guess[ii]));
462
+ // }
463
+ // }
464
+ // assert(step>=0.);
465
+ // if (step == 1.)
466
+ // memcpy(coeff_guess, b, nparam*sizeof(double));
467
+ // else {
468
+ // for (int ii=0; ii<nparam; ii++){
469
+ // coeff_guess[ii] = (1.-step)*coeff_guess[ii] + step*b[ii];
470
+ // }
471
+ // }
472
+ memcpy (coeff_guess, b, nparam*sizeof (double ));
472
473
/* print();
473
474
double max_resd_sq = 0.0;
474
475
for (int i=0; i<ncol-nparam; i++){
0 commit comments