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

Defines the excception types used in the library.
More...

#include "concepts.hpp"
#include "traits.hpp"
#include "shape.hpp"
#include "strides.hpp"
#include "tensor.hpp"
Include dependency graph for functions.hpp:

Go to the source code of this file.

Classes

class  tannic::function::Function< Functor, Argument >
 Expression template for mathematical function operations. More...
 
struct  tannic::function::Log
 Functor natural logarithm (ln(x)) Applies element-wise natural logarithm to tensor elements. More...
 
struct  tannic::function::Exp
 Functor exponential (e^x) Applies element-wise exponential to tensor elements. More...
 
struct  tannic::function::Sqrt
 Functor square root (√x) Applies element-wise square root to tensor elements. More...
 
struct  tannic::function::Rsqrt
 Functor inverse square root (1/√x) Applies element-wise inverse square root to tensor elements. More...
 
struct  tannic::function::Abs
 Functor absolute value (|x|) Applies element-wise absolute value to tensor elements. More...
 
struct  tannic::function::Sin
 Functor sine Applies element-wise sine to tensor elements (radians) More...
 
struct  tannic::function::Cos
 Functor cosine Applies element-wise cosine to tensor elements (radians) More...
 
struct  tannic::function::Tan
 Functor tangent Applies element-wise tangent to tensor elements (radians) More...
 
struct  tannic::function::Sinh
 Functor hyperbolic sine Applies element-wise hyperbolic sine to tensor elements. More...
 
struct  tannic::function::Cosh
 Functor hyperbolic cosine Applies element-wise hyperbolic cosine to tensor elements. More...
 
struct  tannic::function::Tanh
 Functor hyperbolic tangent Applies element-wise hyperbolic tangent to tensor elements. More...
 

Namespaces

namespace  tannic
 
namespace  tannic::function
 

Functions

template<Expression Operand>
constexpr auto tannic::function::log (Operand &&operand)
 Creates a lazy-evaluated natural logarithm expression.
 
template<Expression Operand>
constexpr auto tannic::function::exp (Operand &&operand)
 Creates a lazy-evaluated exponential function expression.
 
template<Expression Operand>
constexpr auto tannic::function::sqrt (Operand &&operand)
 Creates a lazy-evaluated square root expression.
 
template<Expression Operand>
constexpr auto tannic::function::rsqrt (Operand &&operand, float epsilon=0.0f)
 Creates a lazy-evaluated inverse square root expression.
 
template<Expression Operand>
constexpr auto tannic::function::abs (Operand &&operand)
 Creates a lazy-evaluated absolute value expression.
 
template<Expression Operand>
constexpr auto tannic::function::sin (Operand &&operand)
 Creates a lazy-evaluated sine function expression.
 
template<Expression Operand>
constexpr auto tannic::function::cos (Operand &&operand)
 Creates a lazy-evaluated cosine function expression.
 
template<Expression Operand>
constexpr auto tannic::function::tan (Operand &&operand)
 Creates a lazy-evaluated tangent function expression.
 
template<Expression Operand>
constexpr auto tannic::function::sinh (Operand &&operand)
 Creates a lazy-evaluated hyperbolic sine expression.
 
template<Expression Operand>
constexpr auto tannic::function::cosh (Operand &&operand)
 Creates a lazy-evaluated hyperbolic cosine expression.
 
template<Expression Operand>
constexpr auto tannic::function::tanh (Operand &&operand)
 Creates a lazy-evaluated hyperbolic tangent expression.
 

Detailed Description

Defines the excception types used in the library.

Defines mathematical function operations for tensor expressions.

Author
Eric Hermosis
Date
2025
Author
Eric Hermosis
Date
2025

This header provides lazy-evaluated mathematical functions for tensor-like objects, implemented as expression templates. All operations are element-wise and maintain the original tensor's shape and strides.

Includes the following mathematical functions:

  • Basic functions:
    • log() - Natural logarithm (ln)
    • exp() - Exponential (e^x)
    • sqrt() - Square root (√x)
    • abs() - Absolute value (|x|)
  • Trigonometric functions (radians):
    • sin() - Sine
    • cos() - Cosine
    • tan() - Tangent
  • Hyperbolic functions:
    • sinh() - Hyperbolic sine
    • cosh() - Hyperbolic cosine
    • tanh() - Hyperbolic tangent

Part of the Tannic Tensor Library.