Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
vector.cxx
Go to the documentation of this file.
1 #include "common.h"
2 
3 namespace CTF_int {
4 
5  struct int1
6  {
7  int i[1];
8  int1(int a)
9  {
10  i[0] = a;
11  }
12  operator const int*() const
13  {
14  return i;
15  }
16  };
17 }
18 namespace CTF {
19  template<typename dtype>
21 
22  template<typename dtype>
24  : Tensor<dtype>(A) {
25  len = A.len;
26  }
27 
28  template<typename dtype>
30  : Tensor<dtype>(A) {
31  IASSERT(A.order == 1);
32  len = A.lens[0];
33  }
34 
35  template<typename dtype>
37  World & world_,
38  CTF_int::algstrct const & sr_)
39  : Tensor<dtype>(1, CTF_int::int1(len_), CTF_int::int1(NS), world_, sr_, NULL, 0) {
40  len = len_;
41  }
42 
43  template<typename dtype>
45  World & world_,
46  char const * name_,
47  int profile_,
48  CTF_int::algstrct const & sr_)
49  : Tensor<dtype>(1, CTF_int::int1(len_), CTF_int::int1(NS), world_, sr_, name_, profile_) {
50  len = len_;
51  }
52 
53  template<typename dtype>
55  int atr_,
56  World & world_,
57  char const * name_,
58  int profile_,
59  CTF_int::algstrct const & sr_)
60  : Tensor<dtype>(1, atr_>0, CTF_int::int1(len_), CTF_int::int1(NS), world_, sr_, name_, profile_) {
61  len = len_;
62  }
63 
64  template<typename dtype>
66  int atr_,
67  World & world_,
68  CTF_int::algstrct const & sr_)
69  : Tensor<dtype>(1, atr_>0, CTF_int::int1(len_), CTF_int::int1(NS), world_, sr_) {
70  len = len_;
71  }
72 
73  //template<typename dtype>
74  //Vector<dtype> & Vector<dtype>::operator=(const Vector<dtype> & A){
75  // CTF_int::tensor::free_self();
76  // CTF_int::tensor::init(A.sr, A.order, A.lens, A.sym, A.wrld, 1, A.name, A.profile, A.is_sparse);
77  // return *this;
78  //}
79 
80 
81 
82 }
Vector class which encapsulates a 1D tensor.
Definition: vector.h:14
Definition: common.h:37
an instance of the CTF library (world) on a MPI communicator
Definition: world.h:19
int order
number of tensor dimensions
#define IASSERT(...)
Definition: common.h:74
int1(int a)
Definition: vector.cxx:8
int * lens
unpadded tensor edge lengths
algstrct (algebraic structure) defines the elementwise operations computed in each tensor contraction...
Definition: algstrct.h:34
Definition: apsp.cxx:17
Vector()
default constructor for a vector
Definition: vector.cxx:20
an instance of a tensor within a CTF world
Definition: tensor.h:74
int i[1]
Definition: vector.cxx:7
int len
Definition: vector.h:16