OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TableFunctions.hpp File Reference
+ Include dependency graph for TableFunctions.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

EXTENSION_NOINLINE int32_t row_copier (const Column< double > &input_col, int copy_multiplier, Column< double > &output_col)
 
EXTENSION_NOINLINE int32_t row_adder (const int copy_multiplier, const Column< double > &input_col1, const Column< double > &input_col2, Column< double > &output_col)
 
EXTENSION_NOINLINE int32_t row_addsub (const int copy_multiplier, const Column< double > &input_col1, const Column< double > &input_col2, Column< double > &output_col1, Column< double > &output_col2)
 
EXTENSION_NOINLINE int32_t get_max_with_row_offset (const Column< int > &input_col, Column< int > &output_max_col, Column< int > &output_max_row_col)
 
EXTENSION_NOINLINE int32_t column_list_get__cpu_ (const ColumnList< double > &col_list, const int index, const int m, Column< double > &col)
 
EXTENSION_NOINLINE int32_t column_list_first_last (const ColumnList< double > &col_list, const int m, Column< double > &col1, Column< double > &col2)
 

Function Documentation

EXTENSION_NOINLINE int32_t column_list_first_last ( const ColumnList< double > &  col_list,
const int  m,
Column< double > &  col1,
Column< double > &  col2 
)

Definition at line 183 of file TableFunctions.hpp.

References ColumnList< T >::getLength(), and Column< T >::getSize().

186  {
187  col1 = col_list(0);
188  col2 = col_list(col_list.getLength() - 1);
189  return col1.getSize();
190 }
DEVICE int64_t getLength() const
Definition: OmniSciTypes.h:201
DEVICE int64_t getSize() const
Definition: OmniSciTypes.h:154

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t column_list_get__cpu_ ( const ColumnList< double > &  col_list,
const int  index,
const int  m,
Column< double > &  col 
)

Definition at line 169 of file TableFunctions.hpp.

References Column< T >::getSize().

172  {
173  col = col_list(index); // copy the data of col_list item to output column
174  return col.getSize();
175 }
DEVICE int64_t getSize() const
Definition: OmniSciTypes.h:154

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t get_max_with_row_offset ( const Column< int > &  input_col,
Column< int > &  output_max_col,
Column< int > &  output_max_row_col 
)

Definition at line 135 of file TableFunctions.hpp.

References Column< T >::getSize(), and i.

137  {
138  if ((output_max_col.getSize() != 1) || output_max_row_col.getSize() != 1) {
139  return -1;
140  }
141 #ifdef __CUDACC__
142  int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
143  int32_t stop = static_cast<int32_t>(input_col.getSize());
144  int32_t step = blockDim.x * gridDim.x;
145 #else
146  auto start = 0;
147  auto stop = input_col.getSize();
148  auto step = 1;
149 #endif
150 
151  int curr_max = -2147483648;
152  int curr_max_row = -1;
153  for (auto i = start; i < stop; i += step) {
154  if (input_col[i] > curr_max) {
155  curr_max = input_col[i];
156  curr_max_row = i;
157  }
158  }
159  output_max_col[0] = curr_max;
160  output_max_row_col[0] = curr_max_row;
161  return 1;
162 }
DEVICE int64_t getSize() const
Definition: OmniSciTypes.h:154

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t row_adder ( const int  copy_multiplier,
const Column< double > &  input_col1,
const Column< double > &  input_col2,
Column< double > &  output_col 
)

Definition at line 57 of file TableFunctions.hpp.

References Column< T >::getSize(), i, Column< T >::isNull(), and Column< T >::setNull().

60  {
61  int32_t output_row_count = copy_multiplier * input_col1.getSize();
62  if (output_row_count > 100) {
63  // Test failure propagation.
64  return -1;
65  }
66  if (output_col.getSize() != output_row_count) {
67  return -1;
68  }
69 
70 #ifdef __CUDACC__
71  int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
72  int32_t stop = static_cast<int32_t>(input_col1.getSize());
73  int32_t step = blockDim.x * gridDim.x;
74 #else
75  auto start = 0;
76  auto stop = input_col1.getSize();
77  auto step = 1;
78 #endif
79  auto stride = input_col1.getSize();
80  for (auto i = start; i < stop; i += step) {
81  for (int c = 0; c < copy_multiplier; c++) {
82  if (input_col1.isNull(i) || input_col2.isNull(i)) {
83  output_col.setNull(i + (c * stride));
84  } else {
85  output_col[i + (c * stride)] = input_col1[i] + input_col2[i];
86  }
87  }
88  }
89 
90  return output_row_count;
91 }
DEVICE int64_t getSize() const
Definition: OmniSciTypes.h:154
DEVICE bool isNull(int64_t index) const
Definition: OmniSciTypes.h:157
DEVICE void setNull(int64_t index)
Definition: OmniSciTypes.h:158

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t row_addsub ( const int  copy_multiplier,
const Column< double > &  input_col1,
const Column< double > &  input_col2,
Column< double > &  output_col1,
Column< double > &  output_col2 
)

Definition at line 98 of file TableFunctions.hpp.

References Column< T >::getSize(), and i.

102  {
103  int32_t output_row_count = copy_multiplier * input_col1.getSize();
104  if (output_row_count > 100) {
105  // Test failure propagation.
106  return -1;
107  }
108  if ((output_col1.getSize() != output_row_count) ||
109  (output_col2.getSize() != output_row_count)) {
110  return -1;
111  }
112 
113 #ifdef __CUDACC__
114  int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
115  int32_t stop = static_cast<int32_t>(input_col1.getSize());
116  int32_t step = blockDim.x * gridDim.x;
117 #else
118  auto start = 0;
119  auto stop = input_col1.getSize();
120  auto step = 1;
121 #endif
122  auto stride = input_col1.getSize();
123  for (auto i = start; i < stop; i += step) {
124  for (int c = 0; c < copy_multiplier; c++) {
125  output_col1[i + (c * stride)] = input_col1[i] + input_col2[i];
126  output_col2[i + (c * stride)] = input_col1[i] - input_col2[i];
127  }
128  }
129  return output_row_count;
130 }
DEVICE int64_t getSize() const
Definition: OmniSciTypes.h:154

+ Here is the call graph for this function:

EXTENSION_NOINLINE int32_t row_copier ( const Column< double > &  input_col,
int  copy_multiplier,
Column< double > &  output_col 
)

Definition at line 23 of file TableFunctions.hpp.

References Column< T >::getSize(), and i.

25  {
26  int32_t output_row_count = copy_multiplier * input_col.getSize();
27  if (output_row_count > 100) {
28  // Test failure propagation.
29  return -1;
30  }
31  if (output_col.getSize() != output_row_count) {
32  return -1;
33  }
34 
35 #ifdef __CUDACC__
36  int32_t start = threadIdx.x + blockDim.x * blockIdx.x;
37  int32_t stop = static_cast<int32_t>(input_col.getSize());
38  int32_t step = blockDim.x * gridDim.x;
39 #else
40  auto start = 0;
41  auto stop = input_col.getSize();
42  auto step = 1;
43 #endif
44 
45  for (auto i = start; i < stop; i += step) {
46  for (int c = 0; c < copy_multiplier; c++) {
47  output_col[i + (c * input_col.getSize())] = input_col[i];
48  }
49  }
50 
51  return output_row_count;
52 }
DEVICE int64_t getSize() const
Definition: OmniSciTypes.h:154

+ Here is the call graph for this function: