Speclib  0.1.2
The library for writing better CUDA libraries
sp::Operator< Subtype, Children > Struct Template Reference

Base class for any kind of operator with children (scalar or tensor). More...

#include <Operator.hpp>

Inheritance diagram for sp::Operator< Subtype, Children >:
[legend]

Public Types

using Traits = f::Traits< void >
 

Public Member Functions

template<int N = 0>
constexpr auto & child ()
 Access children. More...
 
constexpr auto & lhs ()
 Get the first subexpression if this is a binary operation. More...
 
constexpr auto & rhs ()
 Get the second subexpression if this is a binary operation. More...
 
template<int N = 0>
constexpr const auto & child () const
 
constexpr const auto & lhs () const
 
constexpr const auto & rhs () const
 
template<typename F >
constexpr void forEachChild (F &lambda)
 Run a lambda function on each child. More...
 

Static Public Member Functions

constexpr static bool commutative ()
 
constexpr static bool associative ()
 
constexpr static bool total ()
 
constexpr static bool hasIdentity ()
 
constexpr static bool invertible ()
 
template<typename T >
constexpr static auto getIdentityImpl ()
 
template<typename T >
constexpr static auto getIdentity ()
 

Static Public Attributes

static constexpr int Arity = sizeof...(Children)
 

Protected Member Functions

constexpr Operator (Children... args)
 
template<typename F , int... I>
constexpr void forEachChild (F &lambda, sp::int_sequence< I... > &)
 

Protected Attributes

std::tuple< Children... > children
 

Detailed Description

template<typename Subtype, typename... Children>
struct sp::Operator< Subtype, Children >

Base class for any kind of operator with children (scalar or tensor).

Member Function Documentation

◆ child()

template<typename Subtype , typename... Children>
template<int N = 0>
constexpr auto & sp::Operator< Subtype, Children >::child ( )
constexpr

Access children.

Get the N'th subexpression.

◆ forEachChild()

template<typename Subtype , typename... Children>
template<typename F >
constexpr void sp::Operator< Subtype, Children >::forEachChild ( F &  lambda)
constexpr

Run a lambda function on each child.

◆ lhs()

template<typename Subtype , typename... Children>
constexpr auto & sp::Operator< Subtype, Children >::lhs ( )
constexpr

Get the first subexpression if this is a binary operation.

◆ rhs()

template<typename Subtype , typename... Children>
constexpr auto & sp::Operator< Subtype, Children >::rhs ( )
constexpr

Get the second subexpression if this is a binary operation.