1 #ifndef __JTOOLS__JMERGESORT__
2 #define __JTOOLS__JMERGESORT__
16 namespace JPP {
using namespace JTOOLS; }
50 template<
class JElement_t>
67 template<
class JSuperContainer_t,
template<
class,
class>
class JContainer_t,
class JAllocator_t>
69 JContainer_t<JElement_t, JAllocator_t>& output)
const
71 (*this)(input.begin(), input.end(), output, std::less<JElement_t>());
82 template<
class JSuperContainer_t,
template<
class,
class>
class JContainer_t,
class JAllocator_t,
class JComparator_t>
84 JContainer_t<JElement_t, JAllocator_t>& output,
85 const JComparator_t& comparator)
const
87 (*this)(input.begin(), input.end(), output, comparator);
98 template<
class T,
template<
class,
class>
class JContainer_t,
class JAllocator_t>
101 JContainer_t<JElement_t, JAllocator_t>& output)
const
103 (*this)(__begin, __end, output, std::less<JElement_t>());
115 template<
class T,
template<
class,
class>
class JContainer_t,
class JAllocator_t,
class JComparator_t>
118 JContainer_t<JElement_t, JAllocator_t>& output,
119 const JComparator_t& comparator)
const
121 if (__begin != __end) {
127 for (
size_t i =
std::distance(__begin, __end); i != 0; i >>= 1) {
137 this->
merge(__begin, __end, comparator);
151 template<
class JContainer_t>
152 static inline void copy(
const JContainer_t& input,
155 size_t n = input.size();
157 output.reserve(n + 1);
158 output.resize (n + 0);
160 typename JContainer_t::const_iterator
in = input .begin();
163 for ( ; n != 0; --
n, ++
in, ++out) {
183 template<
class JContainer_t,
class JComparator_t>
185 const JContainer_t& second,
187 const JComparator_t& comparator)
189 size_t n = first.size() + second.size();
191 output.reserve(n + 1);
192 output.resize (n + 0);
194 typename JContainer_t::const_iterator i = first .begin();
195 typename JContainer_t::const_iterator
j = second.begin();
198 for ( ; n != 0; --
n, ++out) {
200 if (comparator(*i,*j)) {
227 }
else if (level - 1 <
buffer.size()) {
232 return buffer[level - 1].first;
235 return buffer[level - 1].second;
252 template<
class _Iterator_t,
class JComparator_t>
253 inline void merge(_Iterator_t __begin,
255 const JComparator_t& comparator,
256 const size_t level = 0,
278 this->
merge(__begin, __begin + N/2, comparator, level + 1,
LEFT);
279 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.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
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
alias put_queue eval echo n
Exception for accessing a value in a collection that is outside of its range.
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
then usage $script[input file[working directory[option]]] nWhere option can be N