Speclib  0.1.2
The library for writing better CUDA libraries

Tensor expressions are TensorLikes that represent a composite operation on other TensorLikes. More...

Classes

struct  sp::t::Make2DTensorDiagonalReal< E >
 Set the imaginary components of the diagonals of a 2D tensor to zero. More...
 
struct  sp::t::OuterProd< LHS, RHS >
 Represents the Tensor formed by the outer product of two tensors. More...
 

Macros

#define ELTWISE_TENSOR_OP(NAME, FN, NUM_ARGS)
 
#define UNARY_TENSOR_OP(NAME, FN)
 Create a Tensor operator from a unary functor type. More...
 
#define BINARY_TENSOR_OP(NAME, FN)
 Create a Tensor operator from a binary functor type. More...
 

Detailed Description

Tensor expressions are TensorLikes that represent a composite operation on other TensorLikes.

See also
TensorLike

Reading from a Tensor expression typically causes the value(s) you requested to be computed on demand, although stateful tensor expressions are allowed, and used for things like pseudorandom virtual tensors.

Macro Definition Documentation

◆ BINARY_TENSOR_OP

#define BINARY_TENSOR_OP (   NAME,
  FN 
)
Value:
template<typename LHS, typename RHS> \
struct NAME : public sp::EltwiseTensorOp<FN, LHS, RHS> { \
using This = NAME<LHS, RHS>; \
_hd_ NAME(LHS lhs, RHS rhs): sp::EltwiseTensorOp<FN, LHS, RHS>(lhs, rhs) {} \
};
Extends TensorExpr, allowing the definition of an N-ary tensor operator from any N-ary functor.
Definition: TensorExpr.hpp:131

Create a Tensor operator from a binary functor type.

◆ ELTWISE_TENSOR_OP

#define ELTWISE_TENSOR_OP (   NAME,
  FN,
  NUM_ARGS 
)
Value:
template<typename... Args> \
struct NAME : public sp::EltwiseTensorOp<FN, Args...> { \
static_assert(sizeof...(Args) == NUM_ARGS, "Incorrect number of arguments for TensorExpr of type " # NAME); \
using This = NAME<Args...>; \
_hd_ NAME(Args... args): sp::EltwiseTensorOp<FN, Args...>(args...) {} \
};

◆ UNARY_TENSOR_OP

#define UNARY_TENSOR_OP (   NAME,
  FN 
)
Value:
template<typename Arg> \
struct NAME : public sp::EltwiseTensorOp<FN, Arg> { \
using This = NAME<Arg>; \
_hd_ NAME(Arg arg): sp::EltwiseTensorOp<FN, Arg>(arg) {} \
};

Create a Tensor operator from a unary functor type.