Tannic
A C++ Tensor Library
Loading...
Searching...
No Matches
operations.hpp File Reference

Defines expression templates tensor aritmetic operations. More...

#include <utility>
#include <type_traits>
#include "concepts.hpp"
#include "types.hpp"
#include "shape.hpp"
#include "strides.hpp"
#include "traits.hpp"
Include dependency graph for operations.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  tannic::operation::Unary< Operation, Operand >
 Expression template for a unary tensor aritmetic operation. More...
 
class  tannic::operation::Binary< Operation, Operand, Cooperand >
 Expression template for a binary tensor operation. More...
 
struct  tannic::operation::Negation
 Unary element-wise negation of a tensor expression. More...
 
struct  tannic::operation::Addition
 Binary element-wise addition of two tensor expressions. More...
 
struct  tannic::operation::Multiplication
 Binary element-wise multiplication of two tensor expressions. More...
 
struct  tannic::operation::Subtraction
 Binary element-wise subtraction of two tensor expressions. More...
 
struct  tannic::operation::Exponentiation
 Binary element-wise exponentiation of two tensor expressions. More...
 

Namespaces

namespace  tannic
 
namespace  tannic::operation
 

Functions

template<Expression Operand>
constexpr auto tannic::operation::operator- (Operand &&operand)
 Element-wise negation of a tensor expression.
 
template<Expression Augend, Expression Addend>
constexpr auto tannic::operation::operator+ (Augend &&augend, Addend &&addend)
 Element-wise addition of two tensor expressions.
 
template<Expression Subtrahend, Expression Minuend>
constexpr auto tannic::operation::operator- (Subtrahend &&subtrahend, Minuend &&minuend)
 Element-wise subtraction of two tensor expressions.
 
template<Expression Multiplicand, Expression Multiplier>
constexpr auto tannic::operation::operator* (Multiplicand &&multiplicand, Multiplier &&multiplier)
 Element-wise multiplication of two tensor expressions.
 
template<Expression Base, Expression Exponent>
constexpr auto tannic::operation::operator^ (Base &&base, Exponent &&exponent)
 Element-wise exponentiation of two tensor expressions.
 

Detailed Description

Defines expression templates tensor aritmetic operations.

Author
Eric Hermosis
Date
2025

This header defines expression templates used to represent lazy evaluation of unary and binary tensor aritmetic operations. The system enables composable arithmetic on tensor-like objects while deferring actual computation until evaluation (via forward()).

Includes:

  • Type promotion utility (promote)
  • Shape broadcasting logic (broadcast)
  • Unary and binary operation templates (Unary, Binary)
  • Arithmetic operation structs (Addition, Subtraction, etc.)
  • Overloaded operators (+, -, *)

Part of the Tannic Tensor Library.