| 431 | } |
| 432 | |
| 433 | distance_function operator+ ( |
| 434 | const distance_function& rhs |
| 435 | ) const |
| 436 | { |
| 437 | // make sure requires clause is not broken |
| 438 | DLIB_ASSERT(get_kernel() == rhs.get_kernel(), |
| 439 | "\t distance_function distance_function::operator+()" |
| 440 | << "\n\t You can only add two distance_functions together if they use the same kernel." |
| 441 | ); |
| 442 | |
| 443 | if (alpha.size() == 0) |
| 444 | return rhs; |
| 445 | else if (rhs.alpha.size() == 0) |
| 446 | return *this; |
| 447 | else |
| 448 | return distance_function(join_cols(alpha, rhs.alpha), |
| 449 | b + rhs.b + 2*trans(alpha)*kernel_matrix(kernel_function,basis_vectors,rhs.basis_vectors)*rhs.alpha, |
| 450 | kernel_function, |
| 451 | join_cols(basis_vectors, rhs.basis_vectors)); |
| 452 | } |
| 453 | |
| 454 | distance_function operator- ( |
| 455 | const distance_function& rhs |
nothing calls this directly
no test coverage detected