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

Method Solve

ml/src/svm.cpp:673–967  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

671}
672
673void
674Solver::Solve(int l,
675 const pcl::QMatrix& Q,
676 const double* p_,
677 const schar* y_,
678 double* alpha_,
679 double Cp,
680 double Cn,
681 double eps,
682 SolutionInfo* si,
683 int shrinking)
684{
685 this->l = l;
686 this->Q = &Q;
687 QD = Q.get_QD();
688 clone(p, p_, l);
689 clone(y, y_, l);
690 clone(alpha, alpha_, l);
691 this->Cp = Cp;
692 this->Cn = Cn;
693 this->eps = eps;
694 unshrink = false;
695
696 // initialize alpha_status
697 {
698 alpha_status = new char[l];
699
700 for (int i = 0; i < l; i++)
701 update_alpha_status(i);
702 }
703
704 // initialize active set (for shrinking)
705 {
706 active_set = new int[l];
707
708 for (int i = 0; i < l; i++)
709 active_set[i] = i;
710
711 active_size = l;
712 }
713
714 // initialize gradient
715 {
716 G = new double[l];
717 G_bar = new double[l];
718
719 for (int i = 0; i < l; i++) {
720 G[i] = p[i];
721 G_bar[i] = 0;
722 }
723
724 for (int i = 0; i < l; i++)
725 if (!is_lower_bound(i)) {
726 const Qfloat* Q_i = Q.get_Q(i, l);
727 double alpha_i = alpha[i];
728
729 for (int j = 0; j < l; j++)
730 G[j] += alpha_i * Q_i[j];

Callers 5

solve_c_svcFunction · 0.45
solve_nu_svcFunction · 0.45
solve_one_classFunction · 0.45
solve_epsilon_svrFunction · 0.45
solve_nu_svrFunction · 0.45

Calls 6

cloneFunction · 0.85
infoFunction · 0.85
maxFunction · 0.70
minFunction · 0.70
get_QDMethod · 0.45
get_QMethod · 0.45

Tested by

no test coverage detected