18 #ifndef HLIDAC_PES_ALGORITHMS_H
19 #define HLIDAC_PES_ALGORITHMS_H
49 template <
class T,
class C = std::greater<T>>
51 size_t matrixSize = m.size();
52 for (
size_t k = 0; k < matrixSize; ++k) {
53 for (
size_t i = 0; i < matrixSize; ++i) {
54 for (
size_t j = 0; j < matrixSize; ++j) {
55 assert(i < m.size() && j < m[i].size() && k < m[i].size() && k < m.size() && j < m[k].size() &&
"Floyd needs square matrix!");
56 if (cmp(m[i][j], m[i][k]+m[k][j]))
57 m[i][j] = m[i][k]+m[k][j];
73 const double tol = unimodalFce.tolerance();
74 const static double phi = (std::sqrt(5.0)-1.0)/2.0;
76 double a = 0.0, b = 1.0, c = 1.0-phi, d;
77 double fxC = unimodalFce.functionValue(c), fxD;
81 fxD = unimodalFce.functionValue(d);
90 fxD = unimodalFce.functionValue(d);
std::pair< double, double > goldenSearch(const T &unimodalFce)
It finds the minimal function value of a unimodal convex function.
DistanceMatrix< T > floyd(DistanceMatrix< T > m, const C &cmp=std::greater< T >())
It calculates all-to-all shortest paths and returns the matrix with their lengths.
std::vector< std::vector< T >> DistanceMatrix
Definition of the matrix data type.