MCPcopy Create free account
hub / github.com/davisking/dlib / operator-

Method operator-

dlib/svm/function.h:454–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

452 }
453
454 distance_function operator- (
455 const distance_function& rhs
456 ) const
457 {
458 // make sure requires clause is not broken
459 DLIB_ASSERT(get_kernel() == rhs.get_kernel(),
460 "\t distance_function distance_function::operator-()"
461 << "\n\t You can only subtract two distance_functions if they use the same kernel."
462 );
463
464 if (alpha.size() == 0 && rhs.alpha.size() == 0)
465 return distance_function(kernel_function);
466 else if (alpha.size() != 0 && rhs.alpha.size() == 0)
467 return *this;
468 else if (alpha.size() == 0 && rhs.alpha.size() != 0)
469 return -1*rhs;
470 else
471 return distance_function(join_cols(alpha, -rhs.alpha),
472 b + rhs.b - 2*trans(alpha)*kernel_matrix(kernel_function,basis_vectors,rhs.basis_vectors)*rhs.alpha,
473 kernel_function,
474 join_cols(basis_vectors, rhs.basis_vectors));
475 }
476
477 private:
478

Callers

nothing calls this directly

Calls 6

join_colsFunction · 0.85
kernel_matrixFunction · 0.85
distance_functionClass · 0.70
transFunction · 0.50
get_kernelMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected