@@ -133,19 +133,13 @@ struct problem * set_problem(char *X, int double_precision_X, int n_samples,
133
133
problem = malloc (sizeof (struct problem ));
134
134
if (problem == NULL ) return NULL ;
135
135
problem -> l = n_samples ;
136
-
137
- if (bias > 0 ) {
138
- problem -> n = (int ) n_features + 1 ;
139
- } else {
140
- problem -> n = (int ) n_features ;
141
- }
142
-
136
+ problem -> n = n_features + (bias > 0 );
143
137
problem -> y = (double * ) Y ;
144
138
problem -> sample_weight = (double * ) sample_weight ;
145
139
problem -> x = dense_to_sparse (X , double_precision_X , n_samples , n_features ,
146
140
n_nonzero , bias );
147
141
problem -> bias = bias ;
148
- problem -> sample_weight = sample_weight ;
142
+
149
143
if (problem -> x == NULL ) {
150
144
free (problem );
151
145
return NULL ;
@@ -162,19 +156,12 @@ struct problem * csr_set_problem (char *X, int double_precision_X,
162
156
problem = malloc (sizeof (struct problem ));
163
157
if (problem == NULL ) return NULL ;
164
158
problem -> l = n_samples ;
165
- problem -> sample_weight = (double * ) sample_weight ;
166
-
167
- if (bias > 0 ){
168
- problem -> n = (int ) n_features + 1 ;
169
- } else {
170
- problem -> n = (int ) n_features ;
171
- }
172
-
159
+ problem -> n = n_features + (bias > 0 );
173
160
problem -> y = (double * ) Y ;
161
+ problem -> sample_weight = (double * ) sample_weight ;
174
162
problem -> x = csr_to_sparse (X , double_precision_X , (int * ) indices ,
175
163
(int * ) indptr , n_samples , n_features , n_nonzero , bias );
176
164
problem -> bias = bias ;
177
- problem -> sample_weight = sample_weight ;
178
165
179
166
if (problem -> x == NULL ) {
180
167
free (problem );
0 commit comments