MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / SVC_Q

Class SVC_Q

ml/src/svm.cpp:1444–1498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1442//
1443
1444class SVC_Q : public Kernel {
1445
1446public:
1447 SVC_Q(const svm_problem& prob, const svm_parameter& param, const schar* y_)
1448 : Kernel(prob.l, prob.x, param)
1449 {
1450 clone(y, y_, prob.l);
1451 cache = new Cache(prob.l, static_cast<long int>(param.cache_size * (1 << 20)));
1452 QD = new double[prob.l];
1453
1454 for (int i = 0; i < prob.l; i++)
1455 QD[i] = (this->*kernel_function)(i, i);
1456 }
1457
1458 Qfloat*
1459 get_Q(int i, int len) const override
1460 {
1461 Qfloat* data;
1462 int start;
1463
1464 if ((start = cache->get_data(i, &data, len)) < len) {
1465 for (int j = start; j < len; j++)
1466 data[j] = static_cast<Qfloat>(y[i] * y[j] * (this->*kernel_function)(i, j));
1467 }
1468
1469 return data;
1470 }
1471
1472 double*
1473 get_QD() const override
1474 {
1475 return QD;
1476 }
1477
1478 void
1479 swap_index(int i, int j) const override
1480 {
1481 cache->swap_index(i, j);
1482 Kernel::swap_index(i, j);
1483 swap(y[i], y[j]);
1484 swap(QD[i], QD[j]);
1485 }
1486
1487 ~SVC_Q() override
1488 {
1489 delete[] y;
1490 delete cache;
1491 delete[] QD;
1492 }
1493
1494private:
1495 schar* y;
1496 Cache* cache;
1497 double* QD;
1498};
1499
1500class ONE_CLASS_Q : public Kernel {
1501

Callers 2

solve_c_svcFunction · 0.85
solve_nu_svcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected