Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
scalar.h
Go to the documentation of this file.
1 #ifndef __SCALAR_H__
2 #define __SCALAR_H__
3 namespace CTF {
4 
12  template <typename dtype=double>
13  class Scalar : public Tensor<dtype> {
14  public:
21  CTF_int::algstrct const & sr=Ring<dtype>());
22 
29  Scalar(dtype val,
31  CTF_int::algstrct const & sr=Ring<dtype>());
32 
36  dtype get_val();
37 
41  void set_val(dtype val);
42 
46  operator dtype() { return get_val(); }
47 
49 
50  };
51 
55 }
56 #include "scalar.cxx"
57 #endif
Ring class defined by a datatype and addition and multiplicaton functions addition must have an ident...
Definition: ring.h:18
dtype get_val()
returns scalar value
an instance of the CTF library (world) on a MPI communicator
Definition: world.h:19
CTF::World * wrld
distributed processor context on which tensor is defined
Scalar class which encapsulates a 0D tensor.
Definition: scalar.h:13
algstrct * sr
algstrct on which tensor elements and operations are defined
Scalar< dtype > & operator=(const Scalar< dtype > &A)
World & get_universe()
Definition: world.cxx:309
void set_val(dtype val)
sets scalar value
algstrct (algebraic structure) defines the elementwise operations computed in each tensor contraction...
Definition: algstrct.h:34
Definition: apsp.cxx:17
an instance of a tensor within a CTF world
Definition: tensor.h:74
Scalar(World &wrld=get_universe(), CTF_int::algstrct const &sr=Ring< dtype >())
constructor for a scalar