1 #ifndef __JTOOLS__JMERGESORT__
2 #define __JTOOLS__JMERGESORT__
15 namespace JPP {
using namespace JTOOLS; }
48 template<
class JElement_t,
class JAllocator_t = std::allocator<JElement_t> >
65 template<
class JSuperContainer_t>
69 (*this)(input.begin(), input.end(), output, std::less<JElement_t>());
80 template<
class JSuperContainer_t,
class JComparator_t>
83 const JComparator_t& comparator)
const
85 (*this)(input.begin(), input.end(), output, comparator);
101 (*this)(__begin, __end, output, std::less<JElement_t>());
113 template<
class T,
class JComparator_t>
117 const JComparator_t& comparator)
const
119 if (__begin != __end) {
125 for (
size_t i =
std::distance(__begin, __end); i != 0; i >>= 1) {
135 this->
merge(__begin, __end, comparator);
149 template<
class JContainer_t>
150 static inline void copy(
const JContainer_t& input,
153 size_t n = input.size();
155 output.reserve(n + 1);
156 output.resize (n + 0);
158 typename JContainer_t::const_iterator
in = input .begin();
161 for ( ; n != 0; --
n) {
181 template<
class JContainer_t,
class JComparator_t>
183 const JContainer_t& second,
185 const JComparator_t& comparator)
187 size_t n = first.size() + second.size();
189 output.reserve(n + 1);
190 output.resize (n + 0);
192 typename JContainer_t::const_iterator i = first .begin();
193 typename JContainer_t::const_iterator
j = second.begin();
196 for ( ; n >= 4; n -= 4) {
198 if (comparator(*i,*j))
203 if (comparator(*i,*j))
208 if (comparator(*i,*j))
213 if (comparator(*i,*j))
219 for ( ; n != 0; --
n) {
221 if (comparator(*i,*j))
246 return buffer[level - 1].first;
249 return buffer[level - 1].second;
266 template<
class _Iterator_t,
class JComparator_t>
267 inline void merge(_Iterator_t __begin,
269 const JComparator_t& comparator,
270 const size_t level = 0,
292 this->
merge(__begin, __begin + N/2, comparator, level + 1,
LEFT);
293 this->
merge(__begin + N/2, __end, comparator, level + 1,
RIGHT);
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
JTwosome
Enumeration for two of a kind.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
do set_variable OUTPUT_DIRECTORY $WORKDIR T
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in