11
11
// Update one coordinate
12
12
13
13
double objective (double * Sigma , /* A covariance matrix: X^TX/n */
14
- int * ever_active , /* Ever active set: 0-based */
14
+ int * ever_active_ptr , /* Ever active set: 0-based */
15
15
int * nactive_ptr , /* Size of ever active set */
16
16
int nrow , /* how many rows in Sigma */
17
17
int row , /* which row: 0-based */
@@ -31,13 +31,13 @@ double objective(double *Sigma, /* A covariance matrix: X^TX/n */
31
31
32
32
for (irow = 0 ; irow < nactive ; irow ++ ) {
33
33
34
- active_row_ptr = ((int * ) ever_active + irow );
34
+ active_row_ptr = ((int * ) ever_active_ptr + irow );
35
35
active_row = * active_row_ptr ;
36
36
theta_row_ptr = ((double * ) theta + active_row );
37
37
38
38
for (icol = 0 ; icol < nactive ; icol ++ ) {
39
39
40
- active_col_ptr = ((int * ) ever_active + icol );
40
+ active_col_ptr = ((int * ) ever_active_ptr + icol );
41
41
active_col = * active_col_ptr ;
42
42
theta_col_ptr = ((double * ) theta + active_col );
43
43
@@ -57,23 +57,23 @@ double objective(double *Sigma, /* A covariance matrix: X^TX/n */
57
57
// Check if active and add it to active list if necessary
58
58
59
59
int update_ever_active (int coord ,
60
- int * ever_active ,
60
+ int * ever_active_ptr ,
61
61
int * nactive_ptr ) {
62
62
int iactive ;
63
63
int active_var ;
64
64
int nactive = * nactive_ptr ;
65
- int * ever_active_ptr = ever_active ;
65
+ int * ever_active_ptr_tmp = ever_active_ptr ;
66
66
67
67
for (iactive = 0 ; iactive < nactive ; iactive ++ ) {
68
- ever_active_ptr = ((int * ) ever_active + iactive );
69
- active_var = (* ever_active_ptr );
68
+ ever_active_ptr_tmp = ((int * ) ever_active_ptr + iactive );
69
+ active_var = (* ever_active_ptr_tmp );
70
70
if (active_var == coord ) {
71
71
72
72
// Add it to the active set and increment the
73
73
// number of active variables
74
74
75
- ever_active_ptr = ((int * ) ever_active + * nactive_ptr );
76
- * ever_active_ptr = coord ;
75
+ ever_active_ptr_tmp = ((int * ) ever_active_ptr + * nactive_ptr );
76
+ * ever_active_ptr_tmp = coord ;
77
77
* nactive_ptr += 1 ;
78
78
79
79
return (1 );
@@ -129,7 +129,7 @@ int check_KKT(double *theta, /* current theta */
129
129
double update_one_coord (double * Sigma , /* A covariance matrix: X^TX/n */
130
130
double * Sigma_diag , /* Diagonal entries of Sigma */
131
131
double * gradient_ptr , /* Sigma times theta */
132
- int * ever_active , /* Ever active set: 0-based */
132
+ int * ever_active_ptr , /* Ever active set: 0-based */
133
133
int * nactive_ptr , /* Size of ever active set */
134
134
int nrow , /* How many rows in Sigma */
135
135
double bound , /* feasibility parameter */
@@ -151,7 +151,7 @@ double update_one_coord(double *Sigma, /* A covariance matrix: X^TX/n
151
151
double * quadratic_ptr = ((double * ) Sigma_diag + coord );
152
152
double quadratic_term = * quadratic_ptr ;
153
153
154
- int * ever_active_ptr ;
154
+ // int *ever_active_ptr_tmp ;
155
155
156
156
gradient_ptr_tmp = ((double * ) gradient_ptr + coord );
157
157
linear_term = * gradient_ptr_tmp ;
@@ -186,7 +186,7 @@ double update_one_coord(double *Sigma, /* A covariance matrix: X^TX/n
186
186
// Add to active set if necessary
187
187
188
188
if (!is_active ) {
189
- update_ever_active (coord , ever_active , nactive_ptr );
189
+ update_ever_active (coord , ever_active_ptr , nactive_ptr );
190
190
}
191
191
192
192
// Update the linear term
@@ -215,7 +215,7 @@ double update_one_coord(double *Sigma, /* A covariance matrix: X^TX/n
215
215
int find_one_row_ (double * Sigma , /* A covariance matrix: X^TX/n */
216
216
double * Sigma_diag , /* Diagonal entry of covariance matrix */
217
217
double * gradient_ptr , /* Sigma times theta */
218
- int * ever_active , /* Ever active set: 0-based */
218
+ int * ever_active_ptr , /* Ever active set: 0-based */
219
219
int * nactive_ptr , /* Size of ever active set */
220
220
int nrow , /* How many rows in Sigma */
221
221
double bound , /* feasibility parameter */
@@ -230,7 +230,7 @@ int find_one_row_(double *Sigma, /* A covariance matrix: X^TX/n */
230
230
int * active_ptr ;
231
231
232
232
double old_value = objective (Sigma ,
233
- ever_active ,
233
+ ever_active_ptr ,
234
234
nactive_ptr ,
235
235
nrow ,
236
236
row ,
@@ -243,13 +243,13 @@ int find_one_row_(double *Sigma, /* A covariance matrix: X^TX/n */
243
243
244
244
// Update the active variables first
245
245
246
- active_ptr = (int * ) ever_active ;
246
+ active_ptr = (int * ) ever_active_ptr ;
247
247
248
248
for (iactive = 0 ; iactive < * nactive_ptr ; iactive ++ ) {
249
249
update_one_coord (Sigma ,
250
250
Sigma_diag ,
251
251
gradient_ptr ,
252
- ever_active ,
252
+ ever_active_ptr ,
253
253
nactive_ptr ,
254
254
nrow ,
255
255
bound ,
@@ -273,7 +273,7 @@ int find_one_row_(double *Sigma, /* A covariance matrix: X^TX/n */
273
273
update_one_coord (Sigma ,
274
274
Sigma_diag ,
275
275
gradient_ptr ,
276
- ever_active ,
276
+ ever_active_ptr ,
277
277
nactive_ptr ,
278
278
nrow ,
279
279
bound ,
@@ -292,7 +292,7 @@ int find_one_row_(double *Sigma, /* A covariance matrix: X^TX/n */
292
292
}
293
293
294
294
new_value = objective (Sigma ,
295
- ever_active ,
295
+ ever_active_ptr ,
296
296
nactive_ptr ,
297
297
nrow ,
298
298
row ,
0 commit comments