Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
ctf_ext.cxx
Go to the documentation of this file.
1 #include "ctf_ext.h"
2 //#include "../src/tensor/untyped_tensor.h"
3 #include "../include/ctf.hpp"
4 namespace CTF_int{
5 
6  typedef bool TYPE1;
7  typedef int TYPE2;
8  typedef int64_t TYPE3;
9  typedef float TYPE4;
10  typedef double TYPE5;
11  typedef std::complex<float> TYPE6;
12  typedef std::complex<double> TYPE7;
13  typedef int16_t TYPE8;
14  typedef int8_t TYPE9;
15 
16  template <typename dtype>
17  void abs_helper(tensor * A, tensor * B){
18  char str[A->order];
19  for(int i=0;i<A->order;i++) {
20  str[i] = 'a' + i;
21  }
22  B->operator[](str) = CTF::Function<dtype>([](dtype a){ return std::abs(a); })(A->operator[](str));
23  }
24 
25  template <typename dtype>
26  void pow_helper(tensor * A, tensor * B, tensor * C, char const * idx_A, char const * idx_B, char const * idx_C){
27 
28  C->operator[](idx_C) = CTF::Function<dtype>([](dtype a, dtype b){ return std::pow(a,b); })(A->operator[](idx_A),B->operator[](idx_B));
29  }
30 
31 
32  template <typename dtype>
33  void all_helper(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B){
34  //std::cout<<idx_A<<std::endl;
35  //std::cout<<idx_B<<std::endl;
36  B_bool->operator[](idx_B) = CTF::Function<dtype,bool>([](dtype a){ return a==(dtype)0; })(A->operator[](idx_A));
37  //B_bool->operator[](idx_B) = -B_bool->operator[](idx_B);
38  B_bool->operator[](idx_B) = CTF::Function<bool, bool>([](bool a){ return a==false ? true : false; })(B_bool->operator[](idx_B));
39  }
40 
41  template <typename dtype>
42  void conj_helper(tensor * A, tensor * B) {
43  char str[A->order];
44  for(int i=0;i<A->order;i++) {
45  str[i] = 'a' + i;
46  }
47  B->operator[](str) = CTF::Function<std::complex<dtype>,std::complex<dtype>>([](std::complex<dtype> a){ return std::complex<dtype>(a.real(), -a.imag()); })(A->operator[](str));
48  }
49 
50  template <typename dtype>
51  void get_real(tensor * A, tensor * B){
52  char str[A->order];
53  for(int i=0;i<A->order;i++) {
54  str[i] = 'a' + i;
55  }
56  B->operator[](str) = CTF::Function<std::complex<dtype>,dtype>([](std::complex<dtype> a){ return a.real(); })(A->operator[](str));
57  }
58 
59  template <typename dtype>
60  void get_imag(tensor * A, tensor * B){
61  char str[A->order];
62  for(int i=0;i<A->order;i++) {
63  str[i] = 'a' + i;
64  }
65  B->operator[](str) = CTF::Function<std::complex<dtype>,dtype>([](std::complex<dtype> a){ return a.imag(); })(A->operator[](str));
66  }
67 
68 
69  template <typename dtype>
70  void set_real(tensor * A, tensor * B){
71  char str[A->order];
72  for(int i=0;i<A->order;i++) {
73  str[i] = 'a' + i;
74  }
75  CTF::Transform<dtype,std::complex<dtype>>([](dtype a, std::complex<dtype> & b){ b.real(a); })(A->operator[](str),B->operator[](str));
76  }
77 
78  template <typename dtype>
79  void set_imag(tensor * A, tensor * B){
80  char str[A->order];
81  for(int i=0;i<A->order;i++) {
82  str[i] = 'a' + i;
83  }
84  CTF::Transform<dtype,std::complex<dtype>>([](dtype a, std::complex<dtype> & b){ b.imag(a); })(A->operator[](str),B->operator[](str));
85  }
86 
87  template <typename dtype>
88  void any_helper(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B){
89  B_bool->operator[](idx_B) = CTF::Function<dtype,bool>([](dtype a){ return a == (dtype)0 ? false : true; })(A->operator[](idx_A));
90  }
91 
92  int64_t sum_bool_tsr(tensor * A){
94  char str[A->order];
95  for (int i=0; i<A->order; i++){
96  str[i] = 'a'+i;
97  }
98  s[""] += CTF::Function<bool, int64_t>([](bool a){ return (int64_t)a; })(A->operator[](str));
99  return s.get_val();
100  }
101 
102 
103  void subsample(tensor * A, double probability){
104  int ret = A->sparsify([=](char const * c){ return CTF_int::get_rand48() < probability; });
105  if (ret != CTF_int::SUCCESS){ printf("CTF ERROR: failed to execute function sparisfy\n"); IASSERT(0); return; }
106  }
107 
108 
109  void matrix_qr(tensor * A, tensor * Q, tensor * R){
110  switch (A->sr->el_size){
111  case 4:
112  {
113  CTF::Matrix<float> mA(*A);
116  mA.qr(mQ, mR);
117  (*Q)["ij"] = mQ["ij"];
118  (*R)["ij"] = mR["ij"];
119  }
120  break;
121 
122 
123  case 8:
124  {
125  CTF::Matrix<double> mA(*A);
128  mA.qr(mQ, mR);
129  (*Q)["ij"] = mQ["ij"];
130  (*R)["ij"] = mR["ij"];
131  }
132  break;
133 
134  default:
135  printf("CTF ERROR: SVD called on invalid tensor element type\n");
136  assert(0);
137  break;
138  }
139  }
140 
141  void matrix_qr_cmplx(tensor * A, tensor * Q, tensor * R){
142  switch (A->sr->el_size){
143  case 8:
144  {
148  mA.qr(mQ, mR);
149  (*Q)["ij"] = mQ["ij"];
150  (*R)["ij"] = mR["ij"];
151  }
152  break;
153 
154 
155  case 16:
156  {
160  mA.qr(mQ, mR);
161  (*Q)["ij"] = mQ["ij"];
162  (*R)["ij"] = mR["ij"];
163  }
164  break;
165 
166  default:
167  printf("CTF ERROR: SVD called on invalid tensor element type\n");
168  assert(0);
169  break;
170  }
171  }
172 
173 
174 
175  void matrix_svd(tensor * A, tensor * U, tensor * S, tensor * VT, int rank){
176  switch (A->sr->el_size){
177  case 4:
178  {
179  CTF::Matrix<float> mA(*A);
182  CTF::Matrix<float> mVT;
183  mA.svd(mU, vS, mVT, rank);
184  //printf("A dims %d %d, U dims %d %d, S dim %d, mVT dms %d %d)\n",mA.nrow, mA.ncol, mU.nrow, mU.ncol, vS.len, mVT.nrow, mVT.ncol);
185  (*U)["ij"] = mU["ij"];
186  (*S)["i"] = vS["i"];
187  (*VT)["ij"] = mVT["ij"];
188  }
189  break;
190 
191 
192  case 8:
193  {
194  CTF::Matrix<double> mA(*A);
198  mA.svd(mU, vS, mVT, rank);
199  //printf("A dims %d %d, U dims %d %d, S dim %d, mVT dms %d %d)\n",mA.nrow, mA.ncol, mU.nrow, mU.ncol, vS.len, mVT.nrow, mVT.ncol);
200  (*U)["ij"] = mU["ij"];
201  (*S)["i"] = vS["i"];
202  (*VT)["ij"] = mVT["ij"];
203  }
204  break;
205 
206  default:
207  printf("CTF ERROR: SVD called on invalid tensor element type\n");
208  assert(0);
209  break;
210  }
211  }
212 
213  void matrix_svd_cmplx(tensor * A, tensor * U, tensor * S, tensor * VT, int rank){
214  switch (A->sr->el_size){
215  case 8:
216  {
221  mA.svd(mU, vS, mVT, rank);
222  //printf("A dims %d %d, U dims %d %d, S dim %d, mVT dms %d %d)\n",mA.nrow, mA.ncol, mU.nrow, mU.ncol, vS.len, mVT.nrow, mVT.ncol);
223  (*U)["ij"] = mU["ij"];
224  (*S)["i"] = vS["i"];
225  (*VT)["ij"] = mVT["ij"];
226  }
227  break;
228 
229 
230  case 16:
231  {
236  mA.svd(mU, vS, mVT, rank);
237  //printf("A dims %d %d, U dims %d %d, S dim %d, mVT dms %d %d)\n",mA.nrow, mA.ncol, mU.nrow, mU.ncol, vS.len, mVT.nrow, mVT.ncol);
238  (*U)["ij"] = mU["ij"];
239  (*S)["i"] = vS["i"];
240  (*VT)["ij"] = mVT["ij"];
241  }
242  break;
243 
244  default:
245  printf("CTF ERROR: SVD called on invalid tensor element type\n");
246  assert(0);
247  break;
248  }
249  }
250 
251 
252 /* template <>
253  void tensor::conv_type<bool, std::complex<float>>(tensor * B){
254  char str[this->order];
255  for (int i=0; i<this->order; i++){
256  str[i] = 'a'+i;
257  }
258  assert(this->order == B->order);
259  B->operator[](str) = CTF::Function<std::complex<float>,bool>([](std::complex<float> a){ return a == std::complex<float>(0.,0.); })(this->operator[](str));
260 
261  }*/
262 
263 #define CONV_FCOMPLEX_INST(ctype,otype) \
264  template <> \
265  void tensor::conv_type<std::complex<ctype>,otype>(tensor * B){ \
266  char str[this->order]; \
267  for (int i=0; i<this->order; i++){ \
268  str[i] = 'a'+i; \
269  } \
270  assert(this->order == B->order); \
271  B->operator[](str) = CTF::Function<otype,std::complex<ctype>>([](otype a){ return std::complex<ctype>(a,0.); })(this->operator[](str)); \
272  }
273 
274 CONV_FCOMPLEX_INST(float,bool)
275 CONV_FCOMPLEX_INST(float,int8_t)
276 CONV_FCOMPLEX_INST(float,int16_t)
277 CONV_FCOMPLEX_INST(float,int)
278 CONV_FCOMPLEX_INST(float,int64_t)
279 CONV_FCOMPLEX_INST(float,float)
280 CONV_FCOMPLEX_INST(float,double)
281 CONV_FCOMPLEX_INST(double,bool)
282 CONV_FCOMPLEX_INST(double,int8_t)
283 CONV_FCOMPLEX_INST(double,int16_t)
284 CONV_FCOMPLEX_INST(double,int)
285 CONV_FCOMPLEX_INST(double,int64_t)
286 CONV_FCOMPLEX_INST(double,float)
287 CONV_FCOMPLEX_INST(double,double)
288 
289 
290 #define SWITCH_TYPE(T1, type_idx2, A, B) \
291  switch (type_idx2){ \
292  case 1: \
293  A->conv_type<TYPE##T1, TYPE1>(B); \
294  break; \
295  case 2: \
296  A->conv_type<TYPE##T1, TYPE2>(B); \
297  break; \
298  case 3: \
299  A->conv_type<TYPE##T1, TYPE3>(B); \
300  break; \
301  case 4: \
302  A->conv_type<TYPE##T1, TYPE4>(B); \
303  break; \
304  case 5: \
305  A->conv_type<TYPE##T1, TYPE5>(B); \
306  break; \
307  case 6: \
308  A->conv_type<TYPE##T1, TYPE6>(B); \
309  break; \
310  case 7: \
311  A->conv_type<TYPE##T1, TYPE7>(B); \
312  break; \
313  \
314  case 8: \
315  A->conv_type<TYPE##T1, TYPE8>(B); \
316  break; \
317  \
318  case 9: \
319  A->conv_type<TYPE##T1, TYPE9>(B); \
320  break; \
321  \
322  default: \
323  assert(0); \
324  break; \
325  }
326 
327  void conv_type(int type_idx1, int type_idx2, tensor * A, tensor * B){
328  switch (type_idx1){
329  case 1:
330  SWITCH_TYPE(1, type_idx2, A, B);
331  break;
332 
333  case 2:
334  SWITCH_TYPE(2, type_idx2, A, B);
335  break;
336 
337  case 3:
338  SWITCH_TYPE(3, type_idx2, A, B);
339  break;
340 
341  case 4:
342  SWITCH_TYPE(4, type_idx2, A, B);
343  break;
344 
345  case 5:
346  SWITCH_TYPE(5, type_idx2, A, B);
347  break;
348 
349  case 6:
350  SWITCH_TYPE(6, type_idx2, A, B);
351  break;
352 
353  case 7:
354  SWITCH_TYPE(7, type_idx2, A, B);
355  break;
356 
357  case 8:
358  SWITCH_TYPE(8, type_idx2, A, B);
359  break;
360 
361  case 9:
362  SWITCH_TYPE(9, type_idx2, A, B);
363  break;
364 
365  default:
366  assert(0);
367  break;
368  }
369  }
370 
371 
372  // conjugate complex tensor
373  template void conj_helper<float>(tensor * A, tensor * B);
374  // conjugate complex tensor
375  template void conj_helper<double>(tensor * A, tensor * B);
376 
377  // set the real number
378  template void set_real<float>(tensor * A, tensor * B);
379  // set the imag number
380  template void set_imag<float>(tensor * A, tensor * B);
381 
382 
383  // set the real number
384  template void set_real<double>(tensor * A, tensor * B);
385  // set the imag number
386  template void set_imag<double>(tensor * A, tensor * B);
387 
388 
389  // get the real number
390  template void get_real<float>(tensor * A, tensor * B);
391  // get the imag number
392  template void get_imag<float>(tensor * A, tensor * B);
393 
394 
395  // get the real number
396  template void get_real<double>(tensor * A, tensor * B);
397  // get the imag number
398  template void get_imag<double>(tensor * A, tensor * B);
399 
400  // == (add more dtype)
401  template void tensor::compare_elementwise<float>(tensor * A, tensor * B);
402  template void tensor::compare_elementwise<double>(tensor * A, tensor * B);
403  template void tensor::compare_elementwise< std::complex<double> >(tensor * A, tensor * B);
404  template void tensor::compare_elementwise< std::complex<float> >(tensor * A, tensor * B);
405  template void tensor::compare_elementwise<bool>(tensor * A, tensor * B);
406 
407  // != (add more dtype)
408  template void tensor::not_equals<double>(tensor * A, tensor * B);
409  template void tensor::not_equals<bool>(tensor * A, tensor * B);
410 
411  // < (add more dtype)
412  template void tensor::smaller_than<double>(tensor * A, tensor * B);
413  template void tensor::smaller_than<bool>(tensor * A, tensor * B);
414 
415  // <= (add more dtype)
416  template void tensor::smaller_equal_than<double>(tensor * A, tensor * B);
417  template void tensor::smaller_equal_than<bool>(tensor * A, tensor * B);
418 
419  // > (add more dtype)
420  template void tensor::larger_than<double>(tensor * A, tensor * B);
421  template void tensor::larger_than<bool>(tensor * A, tensor * B);
422 
423  // >= (add more dtype)
424  template void tensor::larger_equal_than<double>(tensor * A, tensor * B);
425  template void tensor::larger_equal_than<bool>(tensor * A, tensor * B);
426 
427 
428  // exp_helper
429  template void tensor::exp_helper<int16_t, float>(tensor* A);
430  template void tensor::exp_helper<int32_t, double>(tensor* A);
431  template void tensor::exp_helper<int64_t, double>(tensor* A);
432  template void tensor::exp_helper<float, float>(tensor* A);
433  template void tensor::exp_helper<double, double>(tensor* A);
434  template void tensor::exp_helper<long double, long double>(tensor* A);
435  template void tensor::exp_helper<std::complex<double>, std::complex<double>>(tensor* A);
436  // exp_helper when casting == unsafe
437  template void tensor::exp_helper<int64_t, float>(tensor* A);
438  template void tensor::exp_helper<int32_t, float>(tensor* A);
439 
440  // ctf.pow() function in c++ file (add more type)
441  template void abs_helper< std::complex<double> >(tensor * A, tensor * B);
442  template void abs_helper< std::complex<float> >(tensor * A, tensor * B);
443  template void abs_helper<double>(tensor * A, tensor * B);
444  template void abs_helper<float>(tensor * A, tensor * B);
445  template void abs_helper<int64_t>(tensor * A, tensor * B);
446  template void abs_helper<bool>(tensor * A, tensor * B);
447  template void abs_helper<int32_t>(tensor * A, tensor * B);
448  template void abs_helper<int16_t>(tensor * A, tensor * B);
449  template void abs_helper<int8_t>(tensor * A, tensor * B);
450 
451 
452  // ctf.pow() function in c++ file (add more type)
453  template void pow_helper< std::complex<double> >(tensor * A, tensor * B, tensor * C, char const * idx_A, char const * idx_B, char const * idx_C);
454  template void pow_helper< std::complex<float> >(tensor * A, tensor * B, tensor * C, char const * idx_A, char const * idx_B, char const * idx_C);
455  template void pow_helper<double>(tensor * A, tensor * B, tensor * C, char const * idx_A, char const * idx_B, char const * idx_C);
456  template void pow_helper<float>(tensor * A, tensor * B, tensor * C, char const * idx_A, char const * idx_B, char const * idx_C);
457  template void pow_helper<int64_t>(tensor * A, tensor * B, tensor * C, char const * idx_A, char const * idx_B, char const * idx_C);
458  template void pow_helper<bool>(tensor * A, tensor * B, tensor * C, char const * idx_A, char const * idx_B, char const * idx_C);
459  template void pow_helper<int32_t>(tensor * A, tensor * B, tensor * C, char const * idx_A, char const * idx_B, char const * idx_C);
460  template void pow_helper<int16_t>(tensor * A, tensor * B, tensor * C, char const * idx_A, char const * idx_B, char const * idx_C);
461  template void pow_helper<int8_t>(tensor * A, tensor * B, tensor * C, char const * idx_A, char const * idx_B, char const * idx_C);
462 
463 
464  // ctf.all() function in c++ file (add more type)
465  template void all_helper< std::complex<double> >(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
466  template void all_helper< std::complex<float> >(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
467  template void all_helper<int64_t>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
468  template void all_helper<double>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
469  template void all_helper<float>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
470  template void all_helper<bool>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
471  template void all_helper<int32_t>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
472  template void all_helper<int16_t>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
473  template void all_helper<int8_t>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
474 
475  // ctf.any() function in c++ file (add more type)
476  template void any_helper< std::complex<double> >(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
477  template void any_helper< std::complex<float> >(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
478  template void any_helper<double>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
479  template void any_helper<float>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
480  template void any_helper<int64_t>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
481  template void any_helper<bool>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
482  template void any_helper<int32_t>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
483  template void any_helper<int16_t>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
484  template void any_helper<int8_t>(tensor * A, tensor * B_bool, char const * idx_A, char const * idx_B);
485 
486  template void tensor::true_divide<double>(tensor* A);
487  template void tensor::true_divide<float>(tensor* A);
488  template void tensor::true_divide<int64_t>(tensor* A);
489  template void tensor::true_divide<int32_t>(tensor* A);
490  template void tensor::true_divide<int16_t>(tensor* A);
491  template void tensor::true_divide<int8_t>(tensor* A);
492  template void tensor::true_divide<bool>(tensor* A);
493 
494  //template void tensor::pow_helper_int<int64_t>(tensor* A, int p);
495  //template void tensor::pow_helper_int<double>(tensor* A, int p);
496 }
template void conj_helper< double >(tensor *A, tensor *B)
template void pow_helper< int64_t >(tensor *A, tensor *B, tensor *C, char const *idx_A, char const *idx_B, char const *idx_C)
template void any_helper< int16_t >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
template void get_real< double >(tensor *A, tensor *B)
int8_t TYPE9
Definition: ctf_ext.cxx:14
template void abs_helper< int32_t >(tensor *A, tensor *B)
template void all_helper< int8_t >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
template void all_helper< float >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
template void all_helper< int32_t >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
void qr(Matrix< dtype > &Q, Matrix< dtype > &R)
Definition: matrix.cxx:425
template void set_real< float >(tensor *A, tensor *B)
template void any_helper< int32_t >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
Matrix class which encapsulates a 2D tensor.
Definition: matrix.h:18
template void pow_helper< int16_t >(tensor *A, tensor *B, tensor *C, char const *idx_A, char const *idx_B, char const *idx_C)
template void set_real< double >(tensor *A, tensor *B)
def rank(self)
Definition: core.pyx:312
template void pow_helper< int32_t >(tensor *A, tensor *B, tensor *C, char const *idx_A, char const *idx_B, char const *idx_C)
int64_t sum_bool_tsr(tensor *A)
sum all 1 values in boolean tensor
Definition: ctf_ext.cxx:92
void matrix_svd(tensor *A, tensor *U, tensor *S, tensor *VT, int rank)
Definition: ctf_ext.cxx:175
double get_rand48()
returns new random number in [0,1)
Definition: common.cxx:27
int sparsify(char const *threshold=NULL, bool take_abs=true)
reduce tensor to sparse format, storing only nonzero data, or data above a specified threshold...
void conv_type(int type_idx1, int type_idx2, tensor *A, tensor *B)
convert tensor from one type to another
Definition: ctf_ext.cxx:327
dtype get_val()
returns scalar value
template void any_helper< float >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
void get_real(tensor *A, tensor *B)
Definition: ctf_ext.cxx:51
Vector class which encapsulates a 1D tensor.
Definition: vector.h:14
template void abs_helper< int16_t >(tensor *A, tensor *B)
void abs_helper(tensor *A, tensor *B)
Definition: ctf_ext.cxx:17
template void abs_helper< int64_t >(tensor *A, tensor *B)
float TYPE4
Definition: ctf_ext.cxx:9
template void any_helper< int8_t >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
int order
number of tensor dimensions
#define IASSERT(...)
Definition: common.h:74
template void any_helper< bool >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
template void all_helper< int64_t >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
template void conj_helper< float >(tensor *A, tensor *B)
void all_helper(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
Definition: ctf_ext.cxx:33
void matrix_qr_cmplx(tensor *A, tensor *Q, tensor *R)
Definition: ctf_ext.cxx:141
CTF::World * wrld
distributed processor context on which tensor is defined
Scalar class which encapsulates a 0D tensor.
Definition: scalar.h:13
template void get_imag< float >(tensor *A, tensor *B)
template void pow_helper< double >(tensor *A, tensor *B, tensor *C, char const *idx_A, char const *idx_B, char const *idx_C)
void subsample(tensor *A, double probability)
extract a sample of the entries (if sparse of the current nonzeros)
Definition: ctf_ext.cxx:103
void svd(Matrix< dtype > &U, Vector< dtype > &S, Matrix< dtype > &VT, int rank=0)
Definition: matrix.cxx:481
template void any_helper< int64_t >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
std::complex< float > TYPE6
Definition: ctf_ext.cxx:11
template void get_real< float >(tensor *A, tensor *B)
void get_imag(tensor *A, tensor *B)
Definition: ctf_ext.cxx:60
template void pow_helper< float >(tensor *A, tensor *B, tensor *C, char const *idx_A, char const *idx_B, char const *idx_C)
algstrct * sr
algstrct on which tensor elements and operations are defined
void set_real(tensor *A, tensor *B)
Definition: ctf_ext.cxx:70
void conj_helper(tensor *A, tensor *B)
Definition: ctf_ext.cxx:42
int64_t TYPE3
Definition: ctf_ext.cxx:8
template void any_helper< double >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
void any_helper(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
Definition: ctf_ext.cxx:88
def abs(initA)
Definition: core.pyx:5440
template void abs_helper< double >(tensor *A, tensor *B)
void pow_helper(tensor *A, tensor *B, tensor *C, char const *idx_A, char const *idx_B, char const *idx_C)
Definition: ctf_ext.cxx:26
template void pow_helper< bool >(tensor *A, tensor *B, tensor *C, char const *idx_A, char const *idx_B, char const *idx_C)
template void pow_helper< int8_t >(tensor *A, tensor *B, tensor *C, char const *idx_A, char const *idx_B, char const *idx_C)
template void all_helper< double >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
void matrix_qr(tensor *A, tensor *Q, tensor *R)
Definition: ctf_ext.cxx:109
int16_t TYPE8
Definition: ctf_ext.cxx:13
template void all_helper< bool >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
int el_size
size of each element of algstrct in bytes
Definition: algstrct.h:16
template void abs_helper< float >(tensor *A, tensor *B)
internal distributed tensor class
template void get_imag< double >(tensor *A, tensor *B)
template void abs_helper< bool >(tensor *A, tensor *B)
void set_imag(tensor *A, tensor *B)
Definition: ctf_ext.cxx:79
#define SWITCH_TYPE(T1, type_idx2, A, B)
Definition: ctf_ext.cxx:290
template void set_imag< double >(tensor *A, tensor *B)
double TYPE5
Definition: ctf_ext.cxx:10
bool TYPE1
Definition: ctf_ext.cxx:6
int TYPE2
Definition: ctf_ext.cxx:7
template void set_imag< float >(tensor *A, tensor *B)
std::complex< double > TYPE7
Definition: ctf_ext.cxx:12
template void abs_helper< int8_t >(tensor *A, tensor *B)
#define CONV_FCOMPLEX_INST(ctype, otype)
Definition: ctf_ext.cxx:263
template void all_helper< int16_t >(tensor *A, tensor *B_bool, char const *idx_A, char const *idx_B)
void matrix_svd_cmplx(tensor *A, tensor *U, tensor *S, tensor *VT, int rank)
Definition: ctf_ext.cxx:213