@@ -65,6 +65,7 @@ int update_ever_active(int coord,
65
65
int * ever_active_ptr = ever_active ;
66
66
67
67
for (iactive = 0 ; iactive < nactive ; iactive ++ ) {
68
+ ever_active_ptr = ((int * ) ever_active + iactive );
68
69
active_var = (* ever_active_ptr );
69
70
if (active_var == coord ) {
70
71
@@ -83,7 +84,7 @@ int update_ever_active(int coord,
83
84
}
84
85
85
86
int check_KKT (double * theta , /* current theta */
86
- double * Sigma_theta , /* Sigma times theta */
87
+ double * gradient_ptr , /* Sigma times theta */
87
88
int nrow , /* how many rows in Sigma */
88
89
int row , /* which row: 0-based */
89
90
double bound ) /* Lagrange multipler for \ell_1 */
@@ -93,16 +94,16 @@ int check_KKT(double *theta, /* current theta */
93
94
int irow ;
94
95
int fail = 0 ;
95
96
double tol = 1.e-4 ;
96
- double * theta_ptr , * Sigma_theta_ptr ;
97
+ double * theta_ptr , * gradient_ptr_tmp ;
97
98
double gradient ;
98
99
99
100
for (irow = 0 ; irow < nrow ; irow ++ ) {
100
101
theta_ptr = ((double * ) theta + irow );
101
- Sigma_theta_ptr = ((double * ) Sigma_theta + irow );
102
+ gradient_ptr_tmp = ((double * ) gradient_ptr + irow );
102
103
103
104
// Compute this coordinate of the gradient
104
105
105
- gradient = * Sigma_theta_ptr ;
106
+ gradient = * gradient_ptr_tmp ;
106
107
if (row == irow ) {
107
108
gradient -= 1 ;
108
109
}
@@ -127,7 +128,7 @@ int check_KKT(double *theta, /* current theta */
127
128
128
129
double update_one_coord (double * Sigma , /* A covariance matrix: X^TX/n */
129
130
double * Sigma_diag , /* Diagonal entries of Sigma */
130
- double * Sigma_theta , /* Sigma times theta */
131
+ double * gradient_ptr , /* Sigma times theta */
131
132
int * ever_active , /* Ever active set: 0-based */
132
133
int * nactive_ptr , /* Size of ever active set */
133
134
int nrow , /* How many rows in Sigma */
@@ -143,7 +144,7 @@ double update_one_coord(double *Sigma, /* A covariance matrix: X^TX/n
143
144
double value = 0 ;
144
145
double old_value ;
145
146
double * Sigma_ptr ;
146
- double * Sigma_theta_ptr ;
147
+ double * gradient_ptr_tmp ;
147
148
double * theta_ptr ;
148
149
int icol = 0 ;
149
150
@@ -152,13 +153,13 @@ double update_one_coord(double *Sigma, /* A covariance matrix: X^TX/n
152
153
153
154
int * ever_active_ptr ;
154
155
155
- Sigma_theta_ptr = ((double * ) Sigma_theta + coord );
156
- linear_term = * Sigma_theta_ptr ;
156
+ gradient_ptr_tmp = ((double * ) gradient_ptr + coord );
157
+ linear_term = * gradient_ptr_tmp ;
157
158
158
159
theta_ptr = ((double * ) theta + coord );
159
160
old_value = * theta_ptr ;
160
161
161
- // The coord entry of Sigma_theta term has a diagonal term in it:
162
+ // The coord entry of gradient_ptr term has a diagonal term in it:
162
163
// Sigma[coord, coord] * theta[coord]
163
164
// This removes it.
164
165
linear_term -= quadratic_term * old_value ;
@@ -194,11 +195,11 @@ double update_one_coord(double *Sigma, /* A covariance matrix: X^TX/n
194
195
195
196
delta = value - old_value ;
196
197
Sigma_ptr = ((double * ) Sigma + coord * nrow );
197
- Sigma_theta_ptr = ((double * ) Sigma_theta );
198
+ gradient_ptr_tmp = ((double * ) gradient_ptr );
198
199
199
200
for (icol = 0 ; icol < nrow ; icol ++ ) {
200
- * Sigma_theta_ptr = * Sigma_theta_ptr + delta * (* Sigma_ptr );
201
- Sigma_theta_ptr += 1 ;
201
+ * gradient_ptr_tmp = * gradient_ptr_tmp + delta * (* Sigma_ptr );
202
+ gradient_ptr_tmp += 1 ;
202
203
Sigma_ptr += 1 ;
203
204
}
204
205
@@ -213,7 +214,7 @@ double update_one_coord(double *Sigma, /* A covariance matrix: X^TX/n
213
214
214
215
int find_one_row_ (double * Sigma , /* A covariance matrix: X^TX/n */
215
216
double * Sigma_diag , /* Diagonal entry of covariance matrix */
216
- double * Sigma_theta , /* Sigma times theta */
217
+ double * gradient_ptr , /* Sigma times theta */
217
218
int * ever_active , /* Ever active set: 0-based */
218
219
int * nactive_ptr , /* Size of ever active set */
219
220
int nrow , /* How many rows in Sigma */
@@ -247,7 +248,7 @@ int find_one_row_(double *Sigma, /* A covariance matrix: X^TX/n */
247
248
for (iactive = 0 ; iactive < * nactive_ptr ; iactive ++ ) {
248
249
update_one_coord (Sigma ,
249
250
Sigma_diag ,
250
- Sigma_theta ,
251
+ gradient_ptr ,
251
252
ever_active ,
252
253
nactive_ptr ,
253
254
nrow ,
@@ -260,7 +261,7 @@ int find_one_row_(double *Sigma, /* A covariance matrix: X^TX/n */
260
261
}
261
262
262
263
if (check_KKT (theta ,
263
- Sigma_theta ,
264
+ gradient_ptr ,
264
265
nrow ,
265
266
row ,
266
267
bound ) == 1 ) {
@@ -271,7 +272,7 @@ int find_one_row_(double *Sigma, /* A covariance matrix: X^TX/n */
271
272
272
273
update_one_coord (Sigma ,
273
274
Sigma_diag ,
274
- Sigma_theta ,
275
+ gradient_ptr ,
275
276
ever_active ,
276
277
nactive_ptr ,
277
278
nrow ,
@@ -283,7 +284,7 @@ int find_one_row_(double *Sigma, /* A covariance matrix: X^TX/n */
283
284
}
284
285
285
286
if (check_KKT (theta ,
286
- Sigma_theta ,
287
+ gradient_ptr ,
287
288
nrow ,
288
289
row ,
289
290
bound ) == 1 ) {
0 commit comments