14 #ifndef ETEQ_CONSTANT_HPP 15 #define ETEQ_CONSTANT_HPP 35 std::fill(buffer, buffer + n, scalar);
80 return std::all_of(
data + 1,
data + nelems,
81 [&](
const T& e) {
return e ==
data[0]; });
104 return (T*)
cst_->data();
120 const T* d = (
const T*)
cst_->data();
127 std::shared_ptr<Constant<T>>
cst_;
130 template <
typename T>
133 static bool registered = register_builder<Constant<T>,T>(
136 return std::make_shared<ConstantNode<T>>(
145 template <
typename T>
148 auto out = std::make_shared<ConstantNode<T>>(
156 template <
typename T>
159 auto out = std::make_shared<ConstantNode<T>>(
168 #endif // ETEQ_CONSTANT_HPP T * data(void) override
Implementation of iNode<T>
Definition: constant.hpp:102
static Constant< T > * get(T *data, teq::Shape shape)
Definition: constant.hpp:131
NodeptrT< T > make_constant_scalar(T scalar, teq::Shape shape)
Return constant node given scalar and shape.
Definition: constant.hpp:146
bool is_scalar(void) const
Return true if constant data values are all the same, otherwise false.
Definition: constant.hpp:76
const teq::Shape & shape(void) const override
Implementation of iTensor.
Definition: ileaf.hpp:26
ConstantNode(std::shared_ptr< Constant< T >> cst)
Definition: constant.hpp:93
Definition: constant.hpp:17
TensorT< T > data_
Data Source.
Definition: ileaf.hpp:67
std::shared_ptr< Constant< T > > cst_
Definition: constant.hpp:127
Interface node for wrapping typed tensor.
Definition: inode.hpp:23
static Constant< T > * get_scalar(T scalar, teq::Shape shape)
Return Constant tensor containing scalar expanded to fill shape.
Definition: constant.hpp:31
Constant(T *data, teq::Shape shape)
Definition: constant.hpp:85
Constant's node wrapper.
Definition: constant.hpp:91
teq::Shape shape_
Shape utility to avoid excessive conversion between data_.dimensions()
Definition: ileaf.hpp:70
teq::Shape shape(void)
Return shape of internal tensor.
Definition: inode.hpp:37
void property_tag(teq::TensrefT tens, std::string property)
Associate property with tensor.
Definition: prop.hpp:57
Constant(const Constant< T > &other)=delete
bool is_const(void) const override
Implementation of iLeaf.
Definition: constant.hpp:70
std::shared_ptr< iTensor > TensptrT
Tensor smart pointer.
Definition: itensor.hpp:51
std::string to_string(teq::CoordptrT c)
Return brief hashable string representation of coordinate mapper.
Constant implementation of Eigen leaf tensor.
Definition: constant.hpp:24
std::string to_string(void) const override
Implementation of iTensor.
Definition: constant.hpp:48
EigenptrT< T > min(teq::Shape &outshape, const OpArg< T > &a, const OpArg< T > &b)
Definition: operator.hpp:939
PropertyRegistry & get_property_reg(void)
Return reference to global property registry.
const std::string immutable_tag
Identifier for immutable property.
Definition: prop.hpp:20
std::shared_ptr< iNode< T > > NodeptrT
Smart pointer of node.
Definition: inode.hpp:63
void update(void) override
Implementation of iNode<T>
Definition: constant.hpp:108
Constant< T > & operator=(const Constant< T > &other)=delete
iLeaf extension of TEQ iLeaf containing Eigen data objects
Definition: ileaf.hpp:21
static const size_t label_limit
Definition: constant.hpp:20
NodeptrT< T > make_constant(T *data, teq::Shape shape)
Return constant node given raw array and shape.
Definition: constant.hpp:157
teq::TensptrT get_tensor(void) const override
Implementation of iNode<T>
Definition: constant.hpp:111
NElemT n_elems(void) const
Return the total number of elements represented by the shape.
Definition: shape.hpp:118
ConstantNode< T > * clone(void) const
Return deep copy of this instance (with a copied constant)
Definition: constant.hpp:96
void * data(void) override
Implementation of iData.
Definition: ileaf.hpp:32
iNode< T > * clone_impl(void) const override
Definition: constant.hpp:117