| 1450 | } |
| 1451 | |
| 1452 | float optQuantAnD_d( |
| 1453 | float data[MAX_ENTRIES][MAX_DIMENSION_BIG], |
| 1454 | int numEntries, |
| 1455 | int numClusters, |
| 1456 | int index[MAX_ENTRIES], |
| 1457 | float out[MAX_ENTRIES][MAX_DIMENSION_BIG], |
| 1458 | float direction[MAX_DIMENSION_BIG], float *step, |
| 1459 | int dimension, |
| 1460 | float quality |
| 1461 | ) { |
| 1462 | int index_[MAX_ENTRIES]; |
| 1463 | |
| 1464 | int maxTry = (int)(MAX_TRY * quality); |
| 1465 | int try_two = 50; |
| 1466 | |
| 1467 | int i, j, k; |
| 1468 | float t, s; |
| 1469 | |
| 1470 | float centered[MAX_ENTRIES][MAX_DIMENSION_BIG]; |
| 1471 | |
| 1472 | float mean[MAX_DIMENSION_BIG]; |
| 1473 | |
| 1474 | float cov[MAX_DIMENSION_BIG][MAX_DIMENSION_BIG]; |
| 1475 | |
| 1476 | float projected[MAX_ENTRIES]; |
| 1477 | |
| 1478 | int order_[MAX_ENTRIES]; |
| 1479 | |
| 1480 | |
| 1481 | for (i = 0; i<numEntries; i++) |
| 1482 | for (j = 0; j<dimension; j++) |
| 1483 | centered[i][j] = data[i][j]; |
| 1484 | |
| 1485 | centerInPlace_d(centered, numEntries, mean, dimension); |
| 1486 | covariance_d(centered, numEntries, cov, dimension); |
| 1487 | |
| 1488 | // check if they all are the same |
| 1489 | |
| 1490 | t = 0; |
| 1491 | for (j = 0; j<dimension; j++) |
| 1492 | t += cov[j][j]; |
| 1493 | |
| 1494 | if (numEntries == 0) { |
| 1495 | for (i = 0; i<numEntries; i++) { |
| 1496 | index[i] = 0; |
| 1497 | for (j = 0; j<dimension; j++) |
| 1498 | out[i][j] = mean[j]; |
| 1499 | } |
| 1500 | return 0.; |
| 1501 | } |
| 1502 | |
| 1503 | eigenVector_d(cov, direction, dimension); |
| 1504 | project_d(centered, numEntries, direction, projected, dimension); |
| 1505 | |
| 1506 | for (i = 0; i<maxTry; i++) { |
| 1507 | int done = 0; |
| 1508 | |
| 1509 | if (i) { |
nothing calls this directly
no test coverage detected