Blame view

src/ExternLib/Ceil/Ceil.cc 1.12 KB
74a11471   Benjamin Renard   Add min, max, var...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
 * 
 *
 *  Created on: 23 jun. 2018
 *      Author: AKKA IS
 */

#include "Ceil.hh"

#include <cmath>


template <typename Type>
int _ceil(const Type& el) {
	double dEl = (double)el;
	return (int)std::ceil(dEl);
}

template <typename Type>
std::vector<int> _ceil(const std::vector<Type>& el) {
	std::vector<int> result;
	for (typename std::vector<Type>::const_iterator it = el.begin(); it != el.end(); ++it) {
		result.push_back(_ceil(*it));
	}
	return result;
}

int Ceil(const float& el) {
	return _ceil(el);
}

int Ceil(const double& el) {
	return _ceil(el);
}

int Ceil(const long double& el) {
	return _ceil(el);
}

int Ceil(const int& el) {
	return _ceil(el);
}

int Ceil(const short& el) {
	return _ceil(el);
}

std::vector<int> Ceil(const std::vector<float>& el) {
        return _ceil(el);
}

std::vector<int> Ceil_(const std::vector<double>& el) {
        return _ceil(el);
}

std::vector<int> Ceil_(const std::vector<long double>& el) {
        return _ceil(el);
}

std::vector<int> Ceil_(const std::vector<int>& el) {
        return _ceil(el);
}

std::vector<int> Ceil_(const std::vector<short>& el) {
        return _ceil(el);
}