File matchmtx.c changed (mode: 100644) (index 045bb34..c2fcc93) |
... |
... |
main (int argc, char **argv) |
98 |
98 |
spcsr_lascale (&A, R, C); |
spcsr_lascale (&A, R, C); |
99 |
99 |
#endif |
#endif |
100 |
100 |
|
|
101 |
|
#if 0 |
|
|
101 |
|
#if 1 |
102 |
102 |
auction_toexpint (&A, expint); |
auction_toexpint (&A, expint); |
103 |
103 |
#else |
#else |
104 |
104 |
auction_toexp (&A, expint); |
auction_toexp (&A, expint); |
|
... |
... |
main (int argc, char **argv) |
178 |
178 |
for (k = A.rowoff[i]; k < A.rowoff[i+1]; ++k) { |
for (k = A.rowoff[i]; k < A.rowoff[i+1]; ++k) { |
179 |
179 |
const int j = A.colind[k]; |
const int j = A.colind[k]; |
180 |
180 |
const double e = expint[k]; |
const double e = expint[k]; |
181 |
|
if (isinf(price[j])) { |
|
|
181 |
|
assert(!isinf(e)); |
|
182 |
|
if (isinf(price[j])) |
182 |
183 |
price[j] = e; |
price[j] = e; |
183 |
|
} |
|
184 |
|
else { |
|
185 |
|
profit[i] = fmax(profit[i], price[j] - e); |
|
186 |
|
} |
|
|
184 |
|
profit[i] = fmax(profit[i], price[j] - e); |
|
185 |
|
assert(!isinf(profit[i])); |
187 |
186 |
} |
} |
188 |
187 |
if (profit[i] == -HUGE_VAL) profit[i] = 0.0; |
if (profit[i] == -HUGE_VAL) profit[i] = 0.0; |
189 |
188 |
} |
} |
190 |
189 |
|
|
|
190 |
|
#if 0 |
191 |
191 |
for (j = 0; j < A.nc; ++j) { |
for (j = 0; j < A.nc; ++j) { |
192 |
192 |
price[j] += shiftamount; |
price[j] += shiftamount; |
193 |
|
price[j] = R[i] * scalbn(1.0, (int)price[j]); |
|
|
193 |
|
price[j] = C[j] * scalbn(1.0, (int)price[j]); |
|
194 |
|
} |
|
195 |
|
for (i = 0; i < A.nc; ++i) { |
|
196 |
|
profit[i] = R[i] * scalbn(1.0, (int)profit[i]); |
|
197 |
|
} |
|
198 |
|
#else |
|
199 |
|
for (j = 0; j < A.nc; ++j) { |
|
200 |
|
price[j] = scalbn(1.0, (int)price[j]); |
194 |
201 |
} |
} |
195 |
202 |
for (i = 0; i < A.nc; ++i) { |
for (i = 0; i < A.nc; ++i) { |
196 |
|
profit[i] = C[j] * scalbn(1.0, (int)profit[i]); |
|
|
203 |
|
double tmp; |
|
204 |
|
tmp = scalbn(1.0, (int)profit[i]); |
|
205 |
|
if (tmp == 0.0) |
|
206 |
|
printf ("tmp %g profit[%d] %g\n", tmp, i, profit[i]); |
|
207 |
|
profit[i] = tmp; |
197 |
208 |
} |
} |
|
209 |
|
#endif |
198 |
210 |
fwrite(price, sizeof(double), A.nc, fout); |
fwrite(price, sizeof(double), A.nc, fout); |
199 |
|
fwrite(profit, sizeof(double), A.nr, fout); |
|
|
211 |
|
fwrite(profit, sizeof(double), A.nc, fout); |
200 |
212 |
} |
} |
201 |
213 |
|
|
202 |
214 |
if (profit) free(profit); |
if (profit) free(profit); |