source: mmcs/armadillo_bits/fn_sort_index.hpp @ 8daa049

matrices
Last change on this file since 8daa049 was 9dd61b1, checked in by rboet <rboet@…>, 9 years ago

Avance del proyecto 60%

  • Property mode set to 100644
File size: 2.3 KB
Line 
1// Copyright (C) 2009-2015 Conrad Sanderson
2// Copyright (C) 2009-2015 NICTA (www.nicta.com.au)
3//
4// This Source Code Form is subject to the terms of the Mozilla Public
5// License, v. 2.0. If a copy of the MPL was not distributed with this
6// file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8
9//! \addtogroup fn_sort_index
10//! @{
11
12
13
14
15//! kept for compatibility with old code
16template<typename T1>
17inline
18const mtOp<uword,T1,op_sort_index>
19sort_index
20  (
21  const Base<typename T1::elem_type,T1>& X,
22  const uword sort_type = 0
23  )
24  {
25  arma_extra_debug_sigprint();
26 
27  arma_debug_check( (sort_type > 1), "sort_index(): sort_type must be 0 or 1");
28 
29  return mtOp<uword,T1,op_sort_index>(X.get_ref(), sort_type, uword(0));
30  }
31
32
33
34//! kept for compatibility with old code
35template<typename T1>
36inline
37const mtOp<uword,T1,op_stable_sort_index>
38stable_sort_index
39  (
40  const Base<typename T1::elem_type,T1>& X,
41  const uword sort_type = 0
42  )
43  {
44  arma_extra_debug_sigprint();
45 
46  arma_debug_check( (sort_type > 1), "stable_sort_index(): sort_type must be 0 or 1");
47 
48  return mtOp<uword,T1,op_stable_sort_index>(X.get_ref(), sort_type, uword(0));
49  }
50
51
52
53template<typename T1, typename T2>
54inline
55typename
56enable_if2
57  <
58  ( (is_arma_type<T1>::value == true) && (is_same_type<T2, char>::value == true) ),
59  const mtOp<uword,T1,op_sort_index>
60  >::result
61sort_index
62  (
63  const T1& X,
64  const T2* sort_direction
65  )
66  {
67  arma_extra_debug_sigprint();
68 
69  const char sig = (sort_direction != NULL) ? sort_direction[0] : char(0);
70 
71  arma_debug_check( ((sig != 'a') && (sig != 'd')), "sort_index(): unknown sort direction" );
72 
73  return mtOp<uword,T1,op_sort_index>(X, ((sig == 'a') ? uword(0) : uword(1)), uword(0));
74  }
75
76
77
78template<typename T1, typename T2>
79inline
80typename
81enable_if2
82  <
83  ( (is_arma_type<T1>::value == true) && (is_same_type<T2, char>::value == true) ),
84  const mtOp<uword,T1,op_stable_sort_index>
85  >::result
86stable_sort_index
87  (
88  const T1& X,
89  const T2* sort_direction
90  )
91  {
92  arma_extra_debug_sigprint();
93 
94  const char sig = (sort_direction != NULL) ? sort_direction[0] : char(0);
95 
96  arma_debug_check( ((sig != 'a') && (sig != 'd')), "stable_sort_index(): unknown sort direction" );
97 
98  return mtOp<uword,T1,op_stable_sort_index>(X, ((sig == 'a') ? uword(0) : uword(1)), uword(0));
99  }
100
101
102
103//! @}
Note: See TracBrowser for help on using the repository browser.