IgANet
IgANets - Isogeometric Analysis Networks
Loading...
Searching...
No Matches
blocktensor.hpp File Reference

Compile-time block tensor. More...

#include <array>
#include <exception>
#include <initializer_list>
#include <memory>
#include <type_traits>
#include <core.hpp>
#include <utils/fqn.hpp>

Go to the source code of this file.

Classes

class  iganet::utils::BlockTensor< T, Rows >
 Compile-time rank-1 block tensor (row vector) More...
 
class  iganet::utils::BlockTensor< T, Rows, Cols >
 Compile-time rank-2 block tensor (matrix) More...
 
class  iganet::utils::BlockTensor< T, Rows, Cols, Slices >
 Compile-time rank-3 block tensor (tensor) More...
 
class  iganet::utils::BlockTensorCore< T, Dims >
 Compile-time block tensor core. More...
 
struct  iganet::utils::is_shared_ptr< T >
 Type trait checks if template argument is of type std::shared_ptr<T> More...
 
struct  iganet::utils::is_shared_ptr< std::shared_ptr< T > >
 

Namespaces

namespace  iganet
 
namespace  iganet::utils
 

Macros

#define blocktensor_binary_op(name)
 
#define blocktensor_binary_special_op(name)
 
#define blocktensor_unary_op(name)
 
#define blocktensor_unary_special_op(name)
 

Functions

template<typename T , std::size_t... Dims>
auto iganet::utils::abs (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the absolute value of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::absolute (const BlockTensor< T, Dims... > &input)
 Alias for abs()
 
template<typename T , std::size_t... Dims>
auto iganet::utils::acos (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the inverse cosine of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::acosh (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the inverse hyperbolic cosine of the elements of input
 
template<typename T , typename U , typename V , std::size_t... Dims>
auto iganet::utils::add (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other, V alpha=1.0)
 Returns a new block tensor with the elements of other, scaled by alpha, added to the elements of input
 
template<typename T , typename U , typename V , std::size_t... Dims>
auto iganet::utils::add (const BlockTensor< T, Dims... > &input, U other, V alpha=1.0)
 Returns a new block tensor with the elements of other, scaled by alpha, added to the elements of input
 
template<typename T , typename U , typename V , std::size_t... Dims>
auto iganet::utils::add (T input, const BlockTensor< U, Dims... > &other, V alpha=1.0)
 Returns a new block tensor with the elements of other, scaled by alpha, added to the elements of input
 
template<typename T , typename U , typename V , typename W , std::size_t... Dims>
auto iganet::utils::addcdiv (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &tensor1, const BlockTensor< V, Dims... > &tensor2, W value=1.0)
 Returns a new block tensor with the elements of tensor1 divided by the elements of tensor2, with the result multiplied by the scalar value and added to the elements of input
 
template<typename T , typename U , typename V , typename W , std::size_t... Dims>
auto iganet::utils::addcmul (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &tensor1, const BlockTensor< V, Dims... > &tensor2, W value=1.0)
 Returns a new block tensor with the elements of tensor1 multiplied by the elements of tensor2, with the result multiplied by the scalar value and added to the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::angle (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the angle (in radians) of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::arccos (const BlockTensor< T, Dims... > &input)
 Alias for acos()
 
template<typename T , std::size_t... Dims>
auto iganet::utils::arccosh (const BlockTensor< T, Dims... > &input)
 Alias for acosh()`.
 
template<typename T , std::size_t... Dims>
auto iganet::utils::arcsin (const BlockTensor< T, Dims... > &input)
 Alias for asin()
 
template<typename T , std::size_t... Dims>
auto iganet::utils::arcsinh (const BlockTensor< T, Dims... > &input)
 Alias for asinh()
 
template<typename T , std::size_t... Dims>
auto iganet::utils::arctan (const BlockTensor< T, Dims... > &input)
 Alias for atan()
 
template<typename T , std::size_t... Dims>
auto iganet::utils::arctanh (const BlockTensor< T, Dims... > &input)
 Alias for atanh()
 
template<typename T , std::size_t... Dims>
auto iganet::utils::asin (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the arcsine of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::asinh (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the inverse hyperbolic sine of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::atan (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the arctangent of the elements of input
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::atan2 (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the arctangent of the elements in input and other with consideration of the quadrant.
 
template<typename T , std::size_t... Dims>
auto iganet::utils::atanh (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the inverse hyperbolic tangent of the elements of input
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::bitwise_and (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the bitwise AND of the elements of input and other
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::bitwise_left_shift (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the left arithmetic shift of the elements of input by other bits.
 
template<typename T , std::size_t... Dims>
auto iganet::utils::bitwise_not (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the bitwise NOT of the elements of input
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::bitwise_or (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the bitwise OR of the elements of input and other
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::bitwise_right_shift (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the right arithmetic shift of the element of input by other bits.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::bitwise_xor (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the bitwise XOR of the elements of input and other
 
template<typename T , std::size_t... Dims>
auto iganet::utils::ceil (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the ceil of the elements of input, the smallest integer greater than or equal to each element.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::clamp (const BlockTensor< T, Dims... > &input, U min, U max)
 Returns a new block tensor with the elements of input clamped into the range [ min, max ].
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::clip (const BlockTensor< T, Dims... > &input, U min, U max)
 Alias for clamp()
 
template<typename T , std::size_t... Dims>
auto iganet::utils::conj_physical (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the conjugate of the elements of input tensor.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::copysign (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the magnitude of the elements of input and the sign of the elements of other
 
template<typename T , std::size_t... Dims>
auto iganet::utils::cos (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the cosine of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::cosh (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the hyperbolic cosine of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::deg2rad (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the elements of input converted from angles in degrees to radians.
 
template<typename T , std::size_t... Dims>
auto iganet::utils::digamma (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the logarithmic derivative of the gamma function of the elements of input
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::div (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the elements of input divided by the elements of other
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::divide (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Alias for div()
 
template<typename T , std::size_t... Dims>
auto iganet::utils::erf (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the error function of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::erfc (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the complementary error function of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::erfinv (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the inverse error function of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::exp (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the exponential of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::exp2 (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the base-2 exponential of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::expit (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the expit (also known as the logistic sigmoid function) of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::expm1 (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the exponential minus 1 of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::fix (const BlockTensor< T, Dims... > &input)
 Alias for trunc()
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::float_power (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the elements of input raised to the power of exponent, elementwise, in double precision.
 
template<typename T , std::size_t... Dims>
auto iganet::utils::floor (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the floor of the elements of input, the largest integer less than or equal to each element.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::fmod (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the fmod of the elements of input and other
 
template<typename T , std::size_t... Dims>
auto iganet::utils::frac (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the fractional portion of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::frexp (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the decomposition of the elements of input into mantissae and exponents.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::gammainc (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the regularized lower incomplete gamma function of each element of input
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::gammaincc (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the regularized upper incomplete gamma function of each element of input
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::hypot (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 logit
 
template<typename T , std::size_t... Dims>
auto iganet::utils::i0 (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the element-wise zeroth order modified Bessel function of the first kind for each element of input
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::igamma (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Alias for gammainc()
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::igammac (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Alias for gammainc()
 
template<typename T , std::size_t... Dims>
auto iganet::utils::imag (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the imaginary values of the elements of input
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::ldexp (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the elements of input multiplied by 2**other.
 
template<typename T , std::size_t... Dims>
auto iganet::utils::lgamma (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the natural logarithm of the absolute value of the gamma function of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::log (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the natural logarithm of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::log10 (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the logarithm to the base-10 of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::log1p (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the natural logarithm of (1 + the elements of input)
 
template<typename T , std::size_t... Dims>
auto iganet::utils::log2 (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the logarithm to the base-2 of the elements of input
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::logaddexp (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block-vector with the logarithm of the sum of exponentiations of the elements of input
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::logaddexp2 (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block-vector with the logarithm of the sum of exponentiations of the elements of input in base-2.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::logical_and (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the element-wise logical AND of the elements of input and other
 
template<typename T , std::size_t... Dims>
auto iganet::utils::logical_not (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the element-wise logical NOT of the elements of input
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::logical_or (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the element-wise logical OR of the elements of input and other
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::logical_xor (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the element-wise logical XOR of the elements of input and other
 
template<typename T >
auto iganet::utils::make_shared (T &&arg)
 Returns an std::shared_ptr<T> object from arg.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::mul (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the product of each element of input and other
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::multiply (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Alias for mul()
 
template<typename T , std::size_t... Dims>
auto iganet::utils::neg (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the negative of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::negative (const BlockTensor< T, Dims... > &input)
 Alias for neg()
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::nextafter (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Return a new block tensor with the next elementwise floating-point value after input towards other
 
template<typename T , typename U , std::size_t... TDims, std::size_t... UDims>
bool iganet::utils::operator!= (const BlockTensor< T, TDims... > &lhs, const BlockTensor< U, UDims... > &rhs)
 Returns true if both compile-time block tensors are not equal.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator* (const BlockTensor< T, Dims... > &lhs, const U &rhs)
 Multiplies a compile-time block tensor with a scalar and returns a new compile-time block tensor.
 
template<typename T , typename U , std::size_t Rows, std::size_t Common, std::size_t Cols>
auto iganet::utils::operator* (const BlockTensor< T, Rows, Common > &lhs, const BlockTensor< U, Common, Cols > &rhs)
 Multiplies one compile-time rank-2 block tensor with another compile-time rank-2 block tensor.
 
template<typename T , typename U , std::size_t Rows, std::size_t Common, std::size_t Cols, std::size_t Slices>
auto iganet::utils::operator* (const BlockTensor< T, Rows, Common > &lhs, const BlockTensor< U, Common, Cols, Slices > &rhs)
 Multiplies one compile-time rank-2 block tensor from the left with a compile-time rank-3 block tensor slice-by-slice.
 
template<typename T , typename U , std::size_t Rows, std::size_t Common, std::size_t Cols, std::size_t Slices>
auto iganet::utils::operator* (const BlockTensor< T, Rows, Common, Slices > &lhs, const BlockTensor< U, Common, Cols > &rhs)
 Multiplies one compile-time rank-3 block tensor from the left with a compile-time rank-2 block tensor slice-by-slice.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator* (const T &lhs, const BlockTensor< U, Dims... > &rhs)
 Multiplies a scalar with a compile-time block tensor and returns a new compile-time block tensor.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator+ (const BlockTensor< T, Dims... > &lhs, const BlockTensor< U, Dims... > &rhs)
 Adds one compile-time block tensor to another and returns a new compile-time block tensor.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator+ (const BlockTensor< T, Dims... > &lhs, const U &rhs)
 Adds a compile-time block tensor to a scalar and returns a new compile-time block tensor.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator+ (const T &lhs, const BlockTensor< U, Dims... > &rhs)
 Adds a scalar to a compile-time block tensor and returns a new compile-time block tensor.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator+= (BlockTensor< T, Dims... > &lhs, const BlockTensor< U, Dims... > &rhs)
 Increments one compile-time block tensor by another.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator+= (BlockTensor< T, Dims... > &lhs, const U &rhs)
 Increments a compile-time block tensor by a scalar.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator- (const BlockTensor< T, Dims... > &lhs, const BlockTensor< U, Dims... > &rhs)
 Subtracts one compile-time block tensor from another and returns a new compile-time block tensor.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator- (const BlockTensor< T, Dims... > &lhs, const U &rhs)
 Subtracts a scalar from a compile-time block tensor and returns a new compile-time block tensor.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator- (const T &lhs, const BlockTensor< U, Dims... > &rhs)
 Subtracts a compile-time block tensor from a scalar and returns a new compile-time block tensor.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator-= (BlockTensor< T, Dims... > &lhs, const BlockTensor< U, Dims... > &rhs)
 Decrements one compile-time block tensor by another.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator-= (BlockTensor< T, Dims... > &lhs, const U &rhs)
 Decrements a compile-time block tensor by a scalar.
 
template<typename T , std::size_t... Dims>
std::ostream & iganet::utils::operator<< (std::ostream &os, const BlockTensorCore< T, Dims... > &obj)
 Prints (as string) a compile-time block tensor object.
 
template<typename T , typename U , std::size_t... TDims, std::size_t... UDims>
bool iganet::utils::operator== (const BlockTensor< T, TDims... > &lhs, const BlockTensor< U, UDims... > &rhs)
 Returns true if both compile-time block tensors are equal.
 
template<typename T , std::size_t... Dims>
auto iganet::utils::positive (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the input
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::pow (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the power of each element in input with exponent other
 
template<typename T , std::size_t... Dims>
auto iganet::utils::rad2deg (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with each of the elements of input converted from angles in radians to degrees.
 
template<typename T , std::size_t... Dims>
auto iganet::utils::real (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the real values of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::reciprocal (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the reciprocal of the elements of input
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::remainder (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Returns a new block tensor with the modulus of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::round (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the elements of input rounded to the nearest integer.
 
template<typename T , std::size_t... Dims>
auto iganet::utils::rsqrt (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the reciprocal of the square-root of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::sgn (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the signs of the elements of input, extension to complex value.
 
template<typename T , std::size_t... Dims>
auto iganet::utils::sigmoid (const BlockTensor< T, Dims... > &input)
 Alias for expit()
 
template<typename T , std::size_t... Dims>
auto iganet::utils::sign (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the signs of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::signbit (const BlockTensor< T, Dims... > &input)
 Tests if each element of input has its sign bit set (is less than zero) or not.
 
template<typename T , std::size_t... Dims>
auto iganet::utils::sin (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the sine of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::sinc (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the normalized sinc of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::sinh (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the hyperbolic sine of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::sqrt (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the square-root of the elements of input
 
template<typename T , std::size_t... Dims>
auto iganet::utils::square (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the square of the elements of input
 
template<typename T , typename U , typename V , std::size_t... Dims>
auto iganet::utils::sub (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other, V alpha=1.0)
 Subtracts other, scaled by alpha, from input.
 
template<typename T , typename U , typename V , std::size_t... Dims>
auto iganet::utils::subtract (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other, V alpha=1.0)
 Alias for sub()
 
template<typename T , std::size_t... Dims>
auto iganet::utils::tan (const BlockTensor< T, Dims... > &input)
 Returns a new tensor with the tangent of the elements of input.
 
template<typename T , std::size_t... Dims>
auto iganet::utils::tanh (const BlockTensor< T, Dims... > &input)
 Returns a new tensor with the hyperbolic tangent of the elements of input.
 
template<typename T , std::size_t... Dims>
auto iganet::utils::trunc (const BlockTensor< T, Dims... > &input)
 Returns a new tensor with the truncated integer values of the elements of input.
 
template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::xlogy (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Computes input * log(other)
 

Detailed Description

Compile-time block tensor.

Author
Matthias Moller

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Macro Definition Documentation

◆ blocktensor_binary_op

#define blocktensor_binary_op (   name)
Value:
template <typename T, typename U, std::size_t... Dims> \
inline auto name(const BlockTensor<T, Dims...> &input, \
const BlockTensor<U, Dims...> &other) { \
BlockTensor<typename std::common_type<T, U>::type, Dims...> result; \
for (std::size_t idx = 0; idx < (Dims * ...); ++idx) \
result[idx] = \
std::make_shared<T>(torch::name(*input[idx], *other[idx])); \
return result; \
}

◆ blocktensor_binary_special_op

#define blocktensor_binary_special_op (   name)
Value:
template <typename T, typename U, std::size_t... Dims> \
inline auto name(const BlockTensor<T, Dims...> &input, \
const BlockTensor<U, Dims...> &other) { \
BlockTensor<typename std::common_type<T, U>::type, Dims...> result; \
for (std::size_t idx = 0; idx < (Dims * ...); ++idx) \
result[idx] = \
std::make_shared<T>(torch::special::name(*input[idx], *other[idx])); \
return result; \
}

◆ blocktensor_unary_op

#define blocktensor_unary_op (   name)
Value:
template <typename T, std::size_t... Dims> \
inline auto name(const BlockTensor<T, Dims...> &input) { \
BlockTensor<T, Dims...> result; \
for (std::size_t idx = 0; idx < (Dims * ...); ++idx) \
result[idx] = std::make_shared<T>(torch::name(*input[idx])); \
return result; \
}

◆ blocktensor_unary_special_op

#define blocktensor_unary_special_op (   name)
Value:
template <typename T, std::size_t... Dims> \
inline auto name(const BlockTensor<T, Dims...> &input) { \
BlockTensor<T, Dims...> result; \
for (std::size_t idx = 0; idx < (Dims * ...); ++idx) \
result[idx] = std::make_shared<T>(torch::special::name(*input[idx])); \
return result; \
}