IgANet
IGAnets - Isogeometric Analysis Networks
Loading...
Searching...
No Matches
iganet::utils Namespace Reference

Namespaces

namespace  detail
 

Classes

class  BlockTensor
 Forward declaration of BlockTensor. More...
 
class  BlockTensor< T, Rows >
 Compile-time rank-1 block tensor (row vector). More...
 
class  BlockTensor< T, Rows, Cols >
 Compile-time rank-2 block tensor (matrix). More...
 
class  BlockTensor< T, Rows, Cols, Slices >
 Compile-time rank-3 block tensor (tensor). More...
 
class  BlockTensorCore
 Compile-time block tensor core. More...
 
class  FullQualifiedName
 Full qualified name descriptor. More...
 
struct  integer_pow
 Computes the power of integer E to the N at compile time. More...
 
struct  integer_pow< E, 0 >
 
struct  is_shared_ptr
 Type trait checks if template argument is of type std::shared_ptr<T> More...
 
struct  is_shared_ptr< std::shared_ptr< T > >
 
struct  is_tuple
 Type trait for std::tuple type. More...
 
struct  is_tuple< std::tuple< Ts... > >
 
struct  is_tuple_of_tuples
 Type trait for std::tuple<std::tuple> type. More...
 
struct  is_tuple_of_tuples< std::tuple< Ts... > >
 
struct  make_reverse_index_sequence
 Reverse index sequence. More...
 
struct  Serializable
 Serialization prototype. More...
 
struct  tuple_cat
 Type trait for concatenating std::tuples. More...
 
struct  tuple_cat< std::tuple< Ts... >, Tuples... >
 
struct  tuple_cat< T, Tuples... >
 
struct  tuple_cat<>
 
class  uuid
 

Concepts

concept  IterativeSolverPreconditioner
 Specifies the callable interface required by the preconditioned iterative solvers.
 

Typedefs

template<class T >
using is_tuple_of_tuples_t = is_tuple_of_tuples< T >::type
 Alias for is_tuple_of_tuples::type.
 
template<std::size_t N>
using TensorArray = std::array< torch::Tensor, N >
 
using TensorArray0 = TensorArray< 0 >
 
using TensorArray1 = TensorArray< 1 >
 
using TensorArray2 = TensorArray< 2 >
 
using TensorArray3 = TensorArray< 3 >
 
using TensorArray4 = TensorArray< 4 >
 
template<typename... Tuples>
using tuple_cat_t = tuple_cat< Tuples... >::type
 Alias for tuple_cat::type.
 

Functions

template<typename T , std::size_t... Dims>
auto 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 absolute (const BlockTensor< T, Dims... > &input)
 Alias for abs().
 
template<typename T , std::size_t... Dims>
auto 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 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 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 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 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 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 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 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 arccos (const BlockTensor< T, Dims... > &input)
 Alias for acos().
 
template<typename T , std::size_t... Dims>
auto arccosh (const BlockTensor< T, Dims... > &input)
 Provides the acosh operation.
 
template<typename T , std::size_t... Dims>
auto arcsin (const BlockTensor< T, Dims... > &input)
 Alias for asin().
 
template<typename T , std::size_t... Dims>
auto arcsinh (const BlockTensor< T, Dims... > &input)
 Alias for asinh().
 
template<typename T , std::size_t... Dims>
auto arctan (const BlockTensor< T, Dims... > &input)
 Alias for atan().
 
template<typename T , std::size_t... Dims>
auto arctanh (const BlockTensor< T, Dims... > &input)
 Alias for atanh().
 
template<typename T , std::size_t... Dims>
auto 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 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 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 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 atanh (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the inverse hyperbolic tangent of the elements of input.
 
auto bicgstab (const torch::Tensor &A, const torch::Tensor b, int max_iter=1000, double tol=1e-10)
 Solves the linear system A * x = b using the Bi-Conjugate Gradient Stabilized (BiCGStab) method.
 
template<typename T , typename U , std::size_t... Dims>
auto 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 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 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 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 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 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... Tensors, typename Func >
requires (std::invocable<Func, const Tensors &> && ...)
torch::Tensor cat_tuple_into_tensor (const std::tuple< Tensors... > &tensors, Func &&func, int64_t dim=0)
 Concatenates the entries of a std::tuple object into a single Torch tensor along the given dimension after applying the callback function.
 
template<typename... Tensors>
torch::Tensor cat_tuple_into_tensor (const std::tuple< Tensors... > &tensors, int64_t dim=0)
 Concatenates the entries of a std::tuple object into a single Torch tensor along the given dimension.
 
template<typename T , std::size_t... Dims>
auto 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.
 
auto cg (const torch::Tensor &A, const torch::Tensor b, int max_iter=1000, double tol=1e-10)
 Solves the linear system A * x = b using the Conjugate Gradient (CG) method.
 
template<typename T , typename U , std::size_t... Dims>
auto 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 clip (const BlockTensor< T, Dims... > &input, U min, U max)
 Alias for clamp().
 
template<typename T , std::size_t... Dims>
auto 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 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 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 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 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 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 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 divide (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Alias for div().
 
template<typename T , std::size_t Rows, std::size_t Cols>
auto dot (const BlockTensor< T, Rows, Cols > &input, const BlockTensor< T, Rows, Cols > &tensor)
 Returns a new block tensor with the dot product of the two input block tensors.
 
template<short_t dim = 0, typename T0 , typename T1 >
auto dotproduct (T0 &&t0, T1 &&t1)
 Computes the directional dot-product between two tensors with summation along the given dimension.
 
template<typename T , std::size_t... Dims>
auto 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 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 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 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 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 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 expm1 (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the exponential minus 1 of the elements of input.
 
auto fgmres (const torch::Tensor &A, const torch::Tensor b, const torch::Tensor &inverse_preconditioner, int max_iter=1000, double tol=1e-10, int restart=30)
 FGMRES overload taking the inverse preconditioner as a tensor.
 
template<IterativeSolverPreconditioner Preconditioner>
auto fgmres (const torch::Tensor &A, const torch::Tensor b, Preconditioner &&preconditioner, int max_iter=1000, double tol=1e-10, int restart=30)
 Solves A * x = b using restarted, right-preconditioned GMRES.
 
template<typename T , std::size_t... Dims>
auto fix (const BlockTensor< T, Dims... > &input)
 Alias for trunc().
 
template<typename T , typename U , std::size_t... Dims>
auto 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 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 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 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 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 , std::size_t N>
torch::Tensor & from_xml (const pugi::xml_document &doc, torch::Tensor &tensor, std::string tag="Matrix", int id=0, const std::string &label="", bool alloc=true, int index=-1)
 Converts an XML document object to a torch::Tensor object.
 
template<typename T , std::size_t N>
torch::TensorAccessor< T, N > & from_xml (const pugi::xml_document &doc, torch::TensorAccessor< T, N > &accessor, torch::IntArrayRef sizes, std::string tag="Matrix", int id=0, const std::string &label="", int index=-1)
 Converts an XML document object to a torch::TensorAccessor object.
 
template<typename T , std::size_t N, std::size_t M>
utils::TensorArray< M > & from_xml (const pugi::xml_document &doc, utils::TensorArray< M > &tensors, std::string tag="Matrix", int id=0, bool alloc=true, const std::string &label="")
 Converts an XML document object to a std::array of torch::Tensor objects.
 
template<typename T , std::size_t N>
torch::Tensor & from_xml (const pugi::xml_node &root, torch::Tensor &tensor, std::string tag, int id, const std::string &label, bool alloc, int index)
 Converts an XML object to a torch::Tensor object.
 
template<typename T , std::size_t N>
torch::TensorAccessor< T, N > & from_xml (const pugi::xml_node &root, torch::TensorAccessor< T, N > &accessor, torch::IntArrayRef sizes, std::string tag="Matrix", int id=0, const std::string &label="", int index=-1)
 Converts an XML object to a torch::TensorAccessor object.
 
template<typename T , std::size_t N, std::size_t M>
utils::TensorArray< M > & from_xml (const pugi::xml_node &root, utils::TensorArray< M > &tensors, std::string tag, int id, bool alloc, const std::string &label)
 Converts an XML object to a std::array of torch::Tensor objects.
 
template<typename T , typename U , std::size_t... Dims>
auto 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 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 >
getenv (std::string variable, const T &default_value)
 Returns the value from an environment variable.
 
template<typename T >
std::vector< T > getenv (std::string variable, std::initializer_list< T > default_value)
 Returns the value from an environment variable.
 
auto gmres (const torch::Tensor &A, const torch::Tensor b, int max_iter=1000, double tol=1e-10, int restart=30)
 Solves A * x = b using restarted GMRES.
 
template<typename T , typename U , std::size_t... Dims>
auto hypot (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 logit.
 
template<typename T , std::size_t... Dims>
auto 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 igamma (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Alias for gammainc().
 
template<typename T , typename U , std::size_t... Dims>
auto igammac (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Alias for gammainc().
 
template<typename T , std::size_t... Dims>
auto imag (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the imaginary values of the elements of input.
 
template<short_t dim = 0, typename T , typename... Ts>
auto kronproduct (T &&t, Ts &&...ts)
 Computes the directional Kronecker-product between two or more tensors along the given dimension.
 
template<short_t dim = 0, typename T0 , typename T1 >
auto kronproduct (T0 &&t0, T1 &&t1)
 Computes the directional Kronecker-product between two tensors along the given dimension.
 
template<typename T , typename U , std::size_t... Dims>
auto 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 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 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 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 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 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 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 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 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 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 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 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 , typename U , std::size_t N>
constexpr std::array< T, N > make_array (std::array< U, N > array)
 Creates a std::array object from another std::array object.
 
template<typename T , std::size_t N>
constexpr auto make_array (T value)
 Creates a std::array object filled with a constant.
 
template<typename T >
auto make_shared (T &&arg)
 Returns a std::shared_ptr<T> object from arg.
 
auto minres (const torch::Tensor &A, const torch::Tensor b, int max_iter=1000, double tol=1e-10)
 Solves A * x = b using MINRES.
 
template<typename T , typename U , std::size_t... Dims>
auto 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 multiply (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Alias for mul().
 
template<typename T , std::size_t... Dims>
auto 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 negative (const BlockTensor< T, Dims... > &input)
 Alias for neg().
 
template<typename T , typename U , std::size_t... Dims>
auto 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 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 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 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 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 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 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 , std::size_t N>
constexpr std::array< T, N > operator* (std::array< T, N > lhs, std::array< T, N > rhs)
 Multiplies two std::arrays.
 
template<typename T , typename U , std::size_t... Dims>
auto 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 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 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 , std::size_t N>
constexpr auto operator+ (std::array< T, N > array, T data)
 Appends data to a std::array object.
 
template<typename T , std::size_t N>
constexpr std::array< T, N > operator+ (std::array< T, N > lhs, std::array< T, N > rhs)
 Adds two std::arrays.
 
template<typename T >
constexpr auto operator+ (std::vector< T > vector, T data)
 Appends data to a std::vector object.
 
template<typename T , std::size_t N>
constexpr auto operator+ (T data, std::array< T, N > array)
 Prepends data to a std::array object.
 
template<typename T >
constexpr auto operator+ (T data, std::vector< T > vector)
 Prepends data to a std::vector object.
 
template<typename T >
constexpr auto operator+ (T data, torch::ArrayRef< T > array)
 Prepends data to a torch::ArrayRef object.
 
template<typename T >
constexpr auto operator+ (torch::ArrayRef< T > array, T data)
 Appends data to a torch::ArrayRef object.
 
template<typename T , typename U , std::size_t... Dims>
auto 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 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 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 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 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 , std::size_t N>
constexpr std::array< T, N > operator- (std::array< T, N > array)
 Negates all entries of a std::array.
 
template<typename T , std::size_t N>
constexpr std::array< T, N > operator- (std::array< T, N > lhs, std::array< T, N > rhs)
 Subtracts one std::array from another std::array.
 
template<typename T , typename U , std::size_t... Dims>
auto 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 operator-= (BlockTensor< T, Dims... > &lhs, const U &rhs)
 Decrements a compile-time block tensor by a scalar.
 
template<typename T , std::size_t N>
constexpr std::array< T, N > operator/ (std::array< T, N > lhs, std::array< T, N > rhs)
 Divides one std::array by another std::array.
 
template<typename T , std::size_t... Dims>
std::ostream & 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 operator== (const BlockTensor< T, TDims... > &lhs, const BlockTensor< U, UDims... > &rhs)
 Provides the operator== operation.
 
auto pbicgstab (const torch::Tensor &A, const torch::Tensor b, const torch::Tensor &inverse_preconditioner, int max_iter=1000, double tol=1e-10)
 PBiCGStab overload taking the inverse preconditioner as a tensor.
 
template<IterativeSolverPreconditioner Preconditioner>
auto pbicgstab (const torch::Tensor &A, const torch::Tensor b, Preconditioner &&preconditioner, int max_iter=1000, double tol=1e-10)
 Solves the linear system A * x = b using the preconditioned Bi-Conjugate Gradient Stabilized (PBiCGStab) method.
 
auto pcg (const torch::Tensor &A, const torch::Tensor b, const torch::Tensor &inverse_preconditioner, int max_iter=1000, double tol=1e-10)
 PCG overload taking the inverse preconditioner as a tensor.
 
template<IterativeSolverPreconditioner Preconditioner>
auto pcg (const torch::Tensor &A, const torch::Tensor b, Preconditioner &&preconditioner, int max_iter=1000, double tol=1e-10)
 Solves the linear system A * x = b using the preconditioned Conjugate Gradient (PCG) method.
 
auto pminres (const torch::Tensor &A, const torch::Tensor b, const torch::Tensor &inverse_preconditioner, int max_iter=1000, double tol=1e-10)
 PMINRES overload taking the inverse preconditioner as a tensor.
 
template<IterativeSolverPreconditioner Preconditioner>
auto pminres (const torch::Tensor &A, const torch::Tensor b, Preconditioner &&preconditioner, int max_iter=1000, double tol=1e-10)
 Solves A * x = b using preconditioned MINRES.
 
template<typename T , std::size_t... Dims>
auto positive (const BlockTensor< T, Dims... > &input)
 Returns a new block tensor with the input.
 
template<typename T , typename U , std::size_t... Dims>
auto 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 N>
prod (std::array< T, N > array, std::size_t start_index=0, std::size_t stop_index=N - 1)
 Computes the (partial) product of all std::array entries.
 
template<typename T , std::size_t... Dims>
auto 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 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 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 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 N, std::size_t M = 1>
constexpr std::array< T, N - M > remove_from_back (std::array< T, N > array)
 Derives a std::array object from a given std::array object dropping the last M entries.
 
template<typename T , std::size_t N, std::size_t M = 1>
constexpr std::array< T, N - M > remove_from_front (std::array< T, N > array)
 Derives a std::array object from a given std::array object dropping the first M entries.
 
template<std::size_t N, typename T >
constexpr auto repeat_tuple (const T &value)
 Returns a std::tuple object with N replications of the given value.
 
template<typename T , std::size_t... Dims>
auto 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 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 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 sigmoid (const BlockTensor< T, Dims... > &input)
 Alias for expit().
 
template<typename T , std::size_t... Dims>
auto 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 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 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 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 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 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 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 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 subtract (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other, V alpha=1.0)
 Alias for sub().
 
template<typename T , std::size_t N>
sum (std::array< T, N > array, std::size_t start_index=0, std::size_t stop_index=N - 1)
 Computes the (partial) sum of all std::array entries.
 
template<typename T , std::size_t... Dims>
auto 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 tanh (const BlockTensor< T, Dims... > &input)
 Returns a new tensor with the hyperbolic tangent of the elements of input.
 
template<typename... Args>
auto to_array (Args &&...args)
 Converts a list of arguments into std::array.
 
template<std::size_t N, typename T >
std::array< T, N > to_array (std::vector< T > &&vector)
 Converts a std::vector object into std::array.
 
template<typename T , std::size_t N>
auto to_ArrayRef (const std::array< T, N > &array)
 Converts a std::array<int64_t, N> to an at::IntArrayRef object.
 
template<typename T , std::size_t N>
auto to_json (const torch::Tensor &tensor)
 Converts a torch::Tensor object to a JSON object.
 
template<typename T , std::size_t N>
auto to_json (const torch::TensorAccessor< T, N > &accessor)
 Converts a torch::TensorAccessor object to a JSON object.
 
template<typename T , std::size_t N, std::size_t M>
auto to_json (const utils::TensorArray< M > &tensors)
 Converts a std::array of torch::Tensor objects to a JSON object.
 
torch::Tensor to_sparseCsrTensor (const torch::Tensor &col_indices, const torch::Tensor &values, const torch::IntArrayRef &size)
 Constructs a sparse-CSR matrix from the column indices, matrix values and the matrix size.
 
template<std::size_t N>
torch::Tensor to_sparseCsrTensor (const utils::TensorArray< N > &col_indices, const std::array< int64_t, N > &nbasfuncs, const torch::Tensor &values, const torch::IntArrayRef &size)
 Constructs a sparse-CSR matrix from the column indices, matrix values and the matrix size.
 
template<std::size_t N>
torch::Tensor to_sparseCsrTensor (const utils::TensorArray< N > &knot_indices, const std::array< short, N > &degrees, const std::array< int64_t, N > &nbasfuncs, const torch::Tensor &values, const torch::IntArrayRef &size)
 Constructs a sparse-CSR matrix from the B-spline basis function values evaluated at discrete points (e.g., the Greville abscissae), the corresponding knot_indices (i.e. the list of knot indices that mark the start of the knot span the discrete points fall into), the B-spline degrees and the matrix size.
 
template<typename... Args>
auto to_vector (Args &&...args)
 Converts a list of arguments into std::vector.
 
template<typename T , std::size_t N>
std::vector< T > to_vector (std::array< T, N > &&array)
 Converts a std::array object into std::vector.
 
template<typename T , std::size_t N>
pugi::xml_node & to_xml (const torch::Tensor &tensor, pugi::xml_node &root, std::string tag, int id, const std::string &label, int index)
 Converts a torch::Tensor object to an XML object.
 
template<typename T , std::size_t N>
pugi::xml_document to_xml (const torch::Tensor &tensor, std::string tag="Matrix", int id=0, const std::string &label="", int index=-1)
 Converts a torch::Tensor object to an XML document object.
 
template<typename T , std::size_t N>
pugi::xml_node & to_xml (const torch::TensorAccessor< T, N > &accessor, torch::IntArrayRef sizes, pugi::xml_node &root, std::string tag, int id, const std::string &label, int index)
 Converts a torch::TensorAccessor object to an XML object.
 
template<typename T , std::size_t N>
pugi::xml_document to_xml (const torch::TensorAccessor< T, N > &accessor, torch::IntArrayRef sizes, std::string tag="Matrix", int id=0, const std::string &label="", int index=-1)
 Converts a torch::TensorAccessor object to an XML document object.
 
template<typename T , std::size_t N, std::size_t M>
pugi::xml_node & to_xml (const utils::TensorArray< M > &tensors, pugi::xml_node &root, std::string tag, int id, const std::string &label)
 Converts a std::array of torch::Tensor objects to an XML object.
 
template<typename T , std::size_t N, std::size_t M>
pugi::xml_document to_xml (const utils::TensorArray< M > &tensors, std::string tag="Matrix", int id=0, const std::string &label="", int index=-1)
 Converts a std::array of torch::Tensor objects to an XML object.
 
template<typename T , std::size_t... Dims>
auto trunc (const BlockTensor< T, Dims... > &input)
 Returns a new tensor with the truncated integer values of the elements of input.
 
template<bool transpose = false, std::size_t N>
auto VSlice (const utils::TensorArray< N > &index, const std::array< int64_t, N > &start_offset, const std::array< int64_t, N > &stop_offset, const std::array< int64_t, N - 1 > &leading_dim=make_array< int64_t, N - 1 >(1))
 Vectorized version of torch::indexing::Slice (see https://pytorch.org/cppdocs/notes/tensor_indexing.html).
 
template<bool transpose = false>
auto VSlice (torch::Tensor index, int64_t start_offset, int64_t stop_offset)
 Vectorized version of torch::indexing::Slice (see https://pytorch.org/cppdocs/notes/tensor_indexing.html).
 
template<typename T , typename U , std::size_t... Dims>
auto xlogy (const BlockTensor< T, Dims... > &input, const BlockTensor< U, Dims... > &other)
 Computes input * log(other).
 
template<typename... T>
auto zip (T &&...seqs)
 Provides the zip operation.
 

Variables

template<class T >
constexpr auto is_tuple_of_tuples_v = is_tuple_of_tuples<T>::value
 Alias for is_tuple_of_tuples::value.
 
template<class T >
constexpr bool is_tuple_v = is_tuple<T>::value
 
template<typename... Tuples>
constexpr auto tuple_cat_v = tuple_cat<Tuples...>::value
 Alias for tuple_cat::value.
 

Class Documentation

◆ iganet::utils::BlockTensor

class iganet::utils::BlockTensor
template<typename T, std::size_t... Dims>
class iganet::utils::BlockTensor< T, Dims >

Forward declaration of BlockTensor.

◆ iganet::utils::tuple_cat

struct iganet::utils::tuple_cat
template<typename... Tuples>
struct iganet::utils::tuple_cat< Tuples >

Type trait for concatenating std::tuples.

◆ iganet::utils::tuple_cat< std::tuple< Ts... >, Tuples... >

struct iganet::utils::tuple_cat< std::tuple< Ts... >, Tuples... >
template<typename... Ts, typename... Tuples>
struct iganet::utils::tuple_cat< std::tuple< Ts... >, Tuples... >
Class Members
typedef decltype(tuple_cat(declval< tuple< Ts... > >(), type >())) type

◆ iganet::utils::tuple_cat< T, Tuples... >

struct iganet::utils::tuple_cat< T, Tuples... >
template<typename T, typename... Tuples>
struct iganet::utils::tuple_cat< T, Tuples... >
Class Members
typedef decltype(tuple_cat(declval< tuple< T > >(), type >())) type

◆ iganet::utils::tuple_cat<>

struct iganet::utils::tuple_cat<>
Class Members
typedef tuple<> type

Typedef Documentation

◆ is_tuple_of_tuples_t

template<class T >
using iganet::utils::is_tuple_of_tuples_t = typedef is_tuple_of_tuples<T>::type

Alias for is_tuple_of_tuples::type.

◆ TensorArray

template<std::size_t N>
using iganet::utils::TensorArray = typedef std::array<torch::Tensor, N>

◆ TensorArray0

◆ TensorArray1

◆ TensorArray2

◆ TensorArray3

◆ TensorArray4

◆ tuple_cat_t

template<typename... Tuples>
using iganet::utils::tuple_cat_t = typedef tuple_cat<Tuples...>::type

Alias for tuple_cat::type.

Function Documentation

◆ abs()

template<typename T , std::size_t... Dims>
auto iganet::utils::abs ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the absolute value of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ absolute()

template<typename T , std::size_t... Dims>
auto iganet::utils::absolute ( const BlockTensor< T, Dims... > &  input)
inline

Alias for abs().

Returns
Result of the operation.
Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ acos()

template<typename T , std::size_t... Dims>
auto iganet::utils::acos ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the inverse cosine of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ acosh()

template<typename T , std::size_t... Dims>
auto iganet::utils::acosh ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the inverse hyperbolic cosine of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ add() [1/3]

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,
alpha = 1.0 
)
inline

Returns a new block tensor with the elements of other, scaled by alpha, added to the elements of input.

Provides the for operation.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
VTemplate parameter V.
DimsTemplate parameter Dims.
Returns
Result of the operation.

◆ add() [2/3]

template<typename T , typename U , typename V , std::size_t... Dims>
auto iganet::utils::add ( const BlockTensor< T, Dims... > &  input,
other,
alpha = 1.0 
)
inline

Returns a new block tensor with the elements of other, scaled by alpha, added to the elements of input.

◆ add() [3/3]

template<typename T , typename U , typename V , std::size_t... Dims>
auto iganet::utils::add ( input,
const BlockTensor< U, Dims... > &  other,
alpha = 1.0 
)
inline

Returns a new block tensor with the elements of other, scaled by alpha, added to the elements of input.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
VTemplate parameter V.
DimsTemplate parameter Dims.
Parameters
inputInput value.
otherSecond input value.
alphaScaling factor.
Returns
Result of the operation.

◆ addcdiv()

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,
value = 1.0 
)
inline

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.

◆ addcmul()

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,
value = 1.0 
)
inline

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.

◆ angle()

template<typename T , std::size_t... Dims>
auto iganet::utils::angle ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the angle (in radians) of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ arccos()

template<typename T , std::size_t... Dims>
auto iganet::utils::arccos ( const BlockTensor< T, Dims... > &  input)
inline

Alias for acos().

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ arccosh()

template<typename T , std::size_t... Dims>
auto iganet::utils::arccosh ( const BlockTensor< T, Dims... > &  input)
inline

Provides the acosh operation.

Returns
Result of the operation.

Alias for acosh()`.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ arcsin()

template<typename T , std::size_t... Dims>
auto iganet::utils::arcsin ( const BlockTensor< T, Dims... > &  input)
inline

Alias for asin().

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ arcsinh()

template<typename T , std::size_t... Dims>
auto iganet::utils::arcsinh ( const BlockTensor< T, Dims... > &  input)
inline

Alias for asinh().

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ arctan()

template<typename T , std::size_t... Dims>
auto iganet::utils::arctan ( const BlockTensor< T, Dims... > &  input)
inline

Alias for atan().

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ arctanh()

template<typename T , std::size_t... Dims>
auto iganet::utils::arctanh ( const BlockTensor< T, Dims... > &  input)
inline

Alias for atanh().

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ asin()

template<typename T , std::size_t... Dims>
auto iganet::utils::asin ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the arcsine of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ asinh()

template<typename T , std::size_t... Dims>
auto iganet::utils::asinh ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the inverse hyperbolic sine of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ atan()

template<typename T , std::size_t... Dims>
auto iganet::utils::atan ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the arctangent of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ atan2()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::atan2 ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the arctangent of the elements in input and other with consideration of the quadrant.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ atanh()

template<typename T , std::size_t... Dims>
auto iganet::utils::atanh ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the inverse hyperbolic tangent of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ bicgstab()

auto iganet::utils::bicgstab ( const torch::Tensor &  A,
const torch::Tensor  b,
int  max_iter = 1000,
double  tol = 1e-10 
)
inline

Solves the linear system A * x = b using the Bi-Conjugate Gradient Stabilized (BiCGStab) method.

Parameters
AValue of A.
bValue of b.
max_iterValue of max_iter.
tolValue of tol.
Returns
Result of the operation.

◆ bitwise_and()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::bitwise_and ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the bitwise AND of the elements of input and other.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ bitwise_left_shift()

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 
)
inline

Returns a new block tensor with the left arithmetic shift of the elements of input by other bits.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ bitwise_not()

template<typename T , std::size_t... Dims>
auto iganet::utils::bitwise_not ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the bitwise NOT of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ bitwise_or()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::bitwise_or ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the bitwise OR of the elements of input and other.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ bitwise_right_shift()

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 
)
inline

Returns a new block tensor with the right arithmetic shift of the element of input by other bits.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ bitwise_xor()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::bitwise_xor ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the bitwise XOR of the elements of input and other.

Returns
Result of the operation.
Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ cat_tuple_into_tensor() [1/2]

template<typename... Tensors, typename Func >
requires (std::invocable<Func, const Tensors &> && ...)
torch::Tensor iganet::utils::cat_tuple_into_tensor ( const std::tuple< Tensors... > &  tensors,
Func &&  func,
int64_t  dim = 0 
)

Concatenates the entries of a std::tuple object into a single Torch tensor along the given dimension after applying the callback function.

Template Parameters
TensorsTemplate parameter Tensors.
FuncTemplate parameter Func.
Returns
Result of the operation.

◆ cat_tuple_into_tensor() [2/2]

template<typename... Tensors>
torch::Tensor iganet::utils::cat_tuple_into_tensor ( const std::tuple< Tensors... > &  tensors,
int64_t  dim = 0 
)

Concatenates the entries of a std::tuple object into a single Torch tensor along the given dimension.

Template Parameters
TuplesTemplate parameter Tuples.
TensorsTemplate parameter Tensors.
Parameters
tensorsValue of tensors.
dimValue of dim.
Returns
Result of the operation.

◆ ceil()

template<typename T , std::size_t... Dims>
auto iganet::utils::ceil ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the ceil of the elements of input, the smallest integer greater than or equal to each element.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ cg()

auto iganet::utils::cg ( const torch::Tensor &  A,
const torch::Tensor  b,
int  max_iter = 1000,
double  tol = 1e-10 
)
inline

Solves the linear system A * x = b using the Conjugate Gradient (CG) method.

Parameters
AValue of A.
bValue of b.
max_iterValue of max_iter.
tolValue of tol.
Returns
Result of the operation.

◆ clamp()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::clamp ( const BlockTensor< T, Dims... > &  input,
min,
max 
)
inline

Returns a new block tensor with the elements of input clamped into the range [ min, max ].

◆ clip()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::clip ( const BlockTensor< T, Dims... > &  input,
min,
max 
)
inline

Alias for clamp().

◆ concat() [1/4]

template<typename T , std::size_t... N>
auto iganet::utils::concat ( const std::array< T, N > &...  arrays)
inline

Concatenates multiple std::array objects.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
arraysValue of arrays.
Returns
Result of the operation.

◆ concat() [2/4]

template<typename... Ts>
auto iganet::utils::concat ( const std::vector< Ts > &...  vectors)
inline

Concatenates multiple std::vector objects.

Template Parameters
TsTemplate parameter Ts.
Parameters
vectorsValue of vectors.
Returns
Result of the operation.

◆ concat() [3/4]

template<typename T , std::size_t... N>
auto iganet::utils::concat ( std::array< T, N > &&...  arrays)
inline

Provides the concat operation.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
arraysValue of arrays.
Returns
Result of the operation.

◆ concat() [4/4]

template<typename... Ts>
auto iganet::utils::concat ( std::vector< Ts > &&...  vectors)
inline

Provides the concat operation.

Template Parameters
TsTemplate parameter Ts.
Parameters
vectorsValue of vectors.
Returns
Result of the operation.

◆ conj_physical()

template<typename T , std::size_t... Dims>
auto iganet::utils::conj_physical ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the conjugate of the elements of input tensor.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ copysign()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::copysign ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the magnitude of the elements of input and the sign of the elements of other.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ cos()

template<typename T , std::size_t... Dims>
auto iganet::utils::cos ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the cosine of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ cosh()

template<typename T , std::size_t... Dims>
auto iganet::utils::cosh ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the hyperbolic cosine of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ deg2rad()

template<typename T , std::size_t... Dims>
auto iganet::utils::deg2rad ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the elements of input converted from angles in degrees to radians.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ digamma()

template<typename T , std::size_t... Dims>
auto iganet::utils::digamma ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the logarithmic derivative of the gamma function of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ div()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::div ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the elements of input divided by the elements of other.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ divide()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::divide ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Alias for div().

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ dot()

template<typename T , std::size_t Rows, std::size_t Cols>
auto iganet::utils::dot ( const BlockTensor< T, Rows, Cols > &  input,
const BlockTensor< T, Rows, Cols > &  tensor 
)
inline

Returns a new block tensor with the dot product of the two input block tensors.

◆ dotproduct()

template<short_t dim = 0, typename T0 , typename T1 >
auto iganet::utils::dotproduct ( T0 &&  t0,
T1 &&  t1 
)
inline

Computes the directional dot-product between two tensors with summation along the given dimension.

Template Parameters
dimDimension along which the sum is computed.
T0Type of the first argument.
T1Type of the second argument.
Parameters
[in]t0First argument.
[in]t1Second argument.
Returns
Tensor containing the directional dot-product.

◆ erf()

template<typename T , std::size_t... Dims>
auto iganet::utils::erf ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the error function of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ erfc()

template<typename T , std::size_t... Dims>
auto iganet::utils::erfc ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the complementary error function of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ erfinv()

template<typename T , std::size_t... Dims>
auto iganet::utils::erfinv ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the inverse error function of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ exp()

template<typename T , std::size_t... Dims>
auto iganet::utils::exp ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the exponential of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ exp2()

template<typename T , std::size_t... Dims>
auto iganet::utils::exp2 ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the base-2 exponential of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ expit()

template<typename T , std::size_t... Dims>
auto iganet::utils::expit ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the expit (also known as the logistic sigmoid function) of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ expm1()

template<typename T , std::size_t... Dims>
auto iganet::utils::expm1 ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the exponential minus 1 of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ fgmres() [1/2]

auto iganet::utils::fgmres ( const torch::Tensor &  A,
const torch::Tensor  b,
const torch::Tensor &  inverse_preconditioner,
int  max_iter = 1000,
double  tol = 1e-10,
int  restart = 30 
)
inline

FGMRES overload taking the inverse preconditioner as a tensor.

Parameters
AValue of A.
bValue of b.
inverse_preconditionerValue of inverse_preconditioner.
max_iterValue of max_iter.
tolValue of tol.
restartValue of restart.
Returns
Result of the operation.

◆ fgmres() [2/2]

template<IterativeSolverPreconditioner Preconditioner>
auto iganet::utils::fgmres ( const torch::Tensor &  A,
const torch::Tensor  b,
Preconditioner &&  preconditioner,
int  max_iter = 1000,
double  tol = 1e-10,
int  restart = 30 
)
inline

Solves A * x = b using restarted, right-preconditioned GMRES.

The preconditioner must return the action of the inverse preconditioner. Setting restart equal to max_iter gives unrestarted GMRES.

Template Parameters
PreconditionerTemplate parameter Preconditioner.
Parameters
AValue of A.
bValue of b.
preconditionerValue of preconditioner.
max_iterValue of max_iter.
tolValue of tol.
restartValue of restart.
Returns
Result of the operation.

◆ fix()

template<typename T , std::size_t... Dims>
auto iganet::utils::fix ( const BlockTensor< T, Dims... > &  input)
inline

Alias for trunc().

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ float_power()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::float_power ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the elements of input raised to the power of exponent, elementwise, in double precision.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ floor()

template<typename T , std::size_t... Dims>
auto iganet::utils::floor ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the floor of the elements of input, the largest integer less than or equal to each element.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ fmod()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::fmod ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the fmod of the elements of input and other.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ frac()

template<typename T , std::size_t... Dims>
auto iganet::utils::frac ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the fractional portion of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ frexp()

template<typename T , std::size_t... Dims>
auto iganet::utils::frexp ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the decomposition of the elements of input into mantissae and exponents.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ from_xml() [1/6]

template<typename T , std::size_t N>
torch::Tensor & iganet::utils::from_xml ( const pugi::xml_document &  doc,
torch::Tensor &  tensor,
std::string  tag = "Matrix",
int  id = 0,
const std::string &  label = "",
bool  alloc = true,
int  index = -1 
)
inline

Converts an XML document object to a torch::Tensor object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
docValue of doc.
tensorTensor to process.
tagValue of tag.
idObject identifier.
labelObject label.
allocValue of alloc.
indexObject index.
Returns
Result of the operation.

◆ from_xml() [2/6]

template<typename T , std::size_t N>
torch::TensorAccessor< T, N > & iganet::utils::from_xml ( const pugi::xml_document &  doc,
torch::TensorAccessor< T, N > &  accessor,
torch::IntArrayRef  sizes,
std::string  tag = "Matrix",
int  id = 0,
const std::string &  label = "",
int  index = -1 
)
inline

Converts an XML document object to a torch::TensorAccessor object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
docValue of doc.
accessorValue of accessor.
sizesValue of sizes.
tagValue of tag.
idObject identifier.
labelObject label.
indexObject index.
Returns
Result of the operation.

◆ from_xml() [3/6]

template<typename T , std::size_t N, std::size_t M>
utils::TensorArray< M > & iganet::utils::from_xml ( const pugi::xml_document &  doc,
utils::TensorArray< M > &  tensors,
std::string  tag = "Matrix",
int  id = 0,
bool  alloc = true,
const std::string &  label = "" 
)
inline

Converts an XML document object to a std::array of torch::Tensor objects.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
MTemplate parameter M.
Parameters
docValue of doc.
tensorsValue of tensors.
tagValue of tag.
idObject identifier.
allocValue of alloc.
labelObject label.
Returns
Result of the operation.

◆ from_xml() [4/6]

template<typename T , std::size_t N>
torch::Tensor & iganet::utils::from_xml ( const pugi::xml_node &  root,
torch::Tensor &  tensor,
std::string  tag,
int  id,
const std::string &  label,
bool  alloc,
int  index 
)
inline

Converts an XML object to a torch::Tensor object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
rootRoot XML node.
tensorTensor to process.
tagValue of tag.
idObject identifier.
labelObject label.
allocValue of alloc.
indexObject index.
Returns
Result of the operation.

◆ from_xml() [5/6]

template<typename T , std::size_t N>
torch::TensorAccessor< T, N > & iganet::utils::from_xml ( const pugi::xml_node &  root,
torch::TensorAccessor< T, N > &  accessor,
torch::IntArrayRef  sizes,
std::string  tag = "Matrix",
int  id = 0,
const std::string &  label = "",
int  index = -1 
)
inline

Converts an XML object to a torch::TensorAccessor object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
rootRoot XML node.
accessorValue of accessor.
sizesValue of sizes.
tagValue of tag.
idObject identifier.
labelObject label.
indexObject index.
Returns
Result of the operation.

◆ from_xml() [6/6]

template<typename T , std::size_t N, std::size_t M>
utils::TensorArray< M > & iganet::utils::from_xml ( const pugi::xml_node &  root,
utils::TensorArray< M > &  tensors,
std::string  tag,
int  id,
bool  alloc,
const std::string &  label 
)
inline

Converts an XML object to a std::array of torch::Tensor objects.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
MTemplate parameter M.
Parameters
rootRoot XML node.
tensorsValue of tensors.
tagValue of tag.
idObject identifier.
allocValue of alloc.
labelObject label.
Returns
Result of the operation.

◆ gammainc()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::gammainc ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the regularized lower incomplete gamma function of each element of input.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ gammaincc()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::gammaincc ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the regularized upper incomplete gamma function of each element of input.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ getenv() [1/2]

template<typename T >
T iganet::utils::getenv ( std::string  variable,
const T &  default_value 
)

Returns the value from an environment variable.

Template Parameters
TTemplate parameter T.
Parameters
variableValue of variable.
default_valueValue of default_value.
Returns
Result of the operation.

◆ getenv() [2/2]

template<typename T >
std::vector< T > iganet::utils::getenv ( std::string  variable,
std::initializer_list< T >  default_value 
)

Returns the value from an environment variable.

Template Parameters
TTemplate parameter T.
Parameters
variableValue of variable.
default_valueValue of default_value.
Returns
Result of the operation.

◆ gmres()

auto iganet::utils::gmres ( const torch::Tensor &  A,
const torch::Tensor  b,
int  max_iter = 1000,
double  tol = 1e-10,
int  restart = 30 
)
inline

Solves A * x = b using restarted GMRES.

Parameters
AValue of A.
bValue of b.
max_iterValue of max_iter.
tolValue of tol.
restartValue of restart.
Returns
Result of the operation.

◆ hypot()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::hypot ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

logit.

Given the legs of a right triangle, return its hypotenuse.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ i0()

template<typename T , std::size_t... Dims>
auto iganet::utils::i0 ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the element-wise zeroth order modified Bessel function of the first kind for each element of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ igamma()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::igamma ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Alias for gammainc().

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ igammac()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::igammac ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Alias for gammainc().

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ imag()

template<typename T , std::size_t... Dims>
auto iganet::utils::imag ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the imaginary values of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ kron() [1/2]

template<typename T , typename... Ts>
auto iganet::utils::kron ( T &&  t,
Ts &&...  ts 
)
inline

Provides the kron operation.

Template Parameters
T0Template parameter T0.
T1Template parameter T1.
TTemplate parameter T.
TsTemplate parameter Ts.
Parameters
tValue of t.
tsValue of ts.
Returns
Result of the operation.

◆ kron() [2/2]

template<typename T0 , typename T1 >
auto iganet::utils::kron ( T0 &&  t0,
T1 &&  t1 
)
inline

Computes the Kronecker-product between two or more tensors.

Template Parameters
T0Template parameter T0.
T1Template parameter T1.
Parameters
t0Value of t0.
t1Value of t1.
Returns
Result of the operation.

◆ kronproduct() [1/2]

template<short_t dim = 0, typename T , typename... Ts>
auto iganet::utils::kronproduct ( T &&  t,
Ts &&...  ts 
)
inline

Computes the directional Kronecker-product between two or more tensors along the given dimension.

Template Parameters
dimDimension along which the Kronecker-product is computed.
TType of the first argument.
TsTypes of the variadic arguments.
Parameters
[in]tFirst argument.
[in]tsVariadic arguments.
Returns
Tensor containing the dimensional Kronecker-product.
Note
This is not the regular Kronecker-product but a directional variant, that is, the Kronecker-product is computed along the given direction. All other directions are left unchanged. For the regular Kronecker-product use utils::kron.

◆ kronproduct() [2/2]

template<short_t dim = 0, typename T0 , typename T1 >
auto iganet::utils::kronproduct ( T0 &&  t0,
T1 &&  t1 
)
inline

Computes the directional Kronecker-product between two tensors along the given dimension.

Template Parameters
dimDimension along which the Kronecker-product is computed.
T0Type of the first argument.
T1Type of the second argument.
Parameters
[in]t0First argument.
[in]t1Second argument.
Returns
Tensor containing the dimensional Kronecker-product.
Note
This is not the regular Kronecker-product but a directional variant, that is, the Kronecker-product is computed along the given direction. All other directions are left unchanged. For the regular Kronecker-product use utils::kron.

◆ ldexp()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::ldexp ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the elements of input multiplied by 2**other.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ lgamma()

template<typename T , std::size_t... Dims>
auto iganet::utils::lgamma ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the natural logarithm of the absolute value of the gamma function of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ log()

template<typename T , std::size_t... Dims>
auto iganet::utils::log ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the natural logarithm of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ log10()

template<typename T , std::size_t... Dims>
auto iganet::utils::log10 ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the logarithm to the base-10 of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ log1p()

template<typename T , std::size_t... Dims>
auto iganet::utils::log1p ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the natural logarithm of (1 + the elements of input).

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ log2()

template<typename T , std::size_t... Dims>
auto iganet::utils::log2 ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the logarithm to the base-2 of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ logaddexp()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::logaddexp ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block-vector with the logarithm of the sum of exponentiations of the elements of input.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ logaddexp2()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::logaddexp2 ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block-vector with the logarithm of the sum of exponentiations of the elements of input in base-2.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ logical_and()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::logical_and ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the element-wise logical AND of the elements of input and other.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ logical_not()

template<typename T , std::size_t... Dims>
auto iganet::utils::logical_not ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the element-wise logical NOT of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ logical_or()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::logical_or ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the element-wise logical OR of the elements of input and other.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ logical_xor()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::logical_xor ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the element-wise logical XOR of the elements of input and other.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ make_array() [1/2]

template<typename T , typename U , std::size_t N>
constexpr std::array< T, N > iganet::utils::make_array ( std::array< U, N >  array)
inlineconstexpr

Creates a std::array object from another std::array object.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
NTemplate parameter N.
Parameters
arrayValue of array.
Returns
Result of the operation.

◆ make_array() [2/2]

template<typename T , std::size_t N>
constexpr auto iganet::utils::make_array ( value)
inlineconstexpr

Creates a std::array object filled with a constant.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
valueValue to process.
Returns
Result of the operation.

◆ make_shared()

template<typename T >
auto iganet::utils::make_shared ( T &&  arg)
inline

Returns a std::shared_ptr<T> object from arg.

Template Parameters
TTemplate parameter T.
TTemplate parameter T.
Parameters
argValue of arg.
Returns
Result of the operation.

◆ minres()

auto iganet::utils::minres ( const torch::Tensor &  A,
const torch::Tensor  b,
int  max_iter = 1000,
double  tol = 1e-10 
)
inline

Solves A * x = b using MINRES.

Parameters
AValue of A.
bValue of b.
max_iterValue of max_iter.
tolValue of tol.
Returns
Result of the operation.

◆ mul()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::mul ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the product of each element of input and other.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ multiply()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::multiply ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Alias for mul().

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ neg()

template<typename T , std::size_t... Dims>
auto iganet::utils::neg ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the negative of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ negative()

template<typename T , std::size_t... Dims>
auto iganet::utils::negative ( const BlockTensor< T, Dims... > &  input)
inline

Alias for neg().

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ nextafter()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::nextafter ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Return a new block tensor with the next elementwise floating-point value after input towards other.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ operator!=()

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 
)
inline

Returns true if both compile-time block tensors are not equal.

◆ operator*() [1/6]

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator* ( const BlockTensor< T, Dims... > &  lhs,
const U &  rhs 
)
inline

Multiplies a compile-time block tensor with a scalar and returns a new compile-time block tensor.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
DimsTemplate parameter Dims.
Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

◆ operator*() [2/6]

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 
)
inline

Multiplies one compile-time rank-2 block tensor with another compile-time rank-2 block tensor.

Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

◆ operator*() [3/6]

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 
)
inline

Multiplies one compile-time rank-2 block tensor from the left with a compile-time rank-3 block tensor slice-by-slice.

Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

◆ operator*() [4/6]

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 
)
inline

Multiplies one compile-time rank-3 block tensor from the left with a compile-time rank-2 block tensor slice-by-slice.

Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

◆ operator*() [5/6]

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator* ( const T &  lhs,
const BlockTensor< U, Dims... > &  rhs 
)
inline

Multiplies a scalar with a compile-time block tensor and returns a new compile-time block tensor.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
DimsTemplate parameter Dims.
Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

◆ operator*() [6/6]

template<typename T , std::size_t N>
constexpr std::array< T, N > iganet::utils::operator* ( std::array< T, N >  lhs,
std::array< T, N >  rhs 
)
inlineconstexpr

Multiplies two std::arrays.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

◆ operator+() [1/10]

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator+ ( const BlockTensor< T, Dims... > &  lhs,
const BlockTensor< U, Dims... > &  rhs 
)
inline

Adds one compile-time block tensor to another and returns a new compile-time block tensor.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
DimsTemplate parameter Dims.
Parameters
lhsLeft-hand operand.
rhsRight-hand operand.

Provides the for operation.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
DimsTemplate parameter Dims.
Returns
Result of the operation.

◆ operator+() [2/10]

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator+ ( const BlockTensor< T, Dims... > &  lhs,
const U &  rhs 
)
inline

Adds a compile-time block tensor to a scalar and returns a new compile-time block tensor.

Provides the for operation.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
DimsTemplate parameter Dims.
Returns
Result of the operation.

◆ operator+() [3/10]

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator+ ( const T &  lhs,
const BlockTensor< U, Dims... > &  rhs 
)
inline

Adds a scalar to a compile-time block tensor and returns a new compile-time block tensor.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
DimsTemplate parameter Dims.
Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

◆ operator+() [4/10]

template<typename T , std::size_t N>
constexpr auto iganet::utils::operator+ ( std::array< T, N >  array,
data 
)
inlineconstexpr

Appends data to a std::array object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
arrayValue of array.
dataValue of data.
Returns
Result of the operation.

◆ operator+() [5/10]

template<typename T , std::size_t N>
constexpr std::array< T, N > iganet::utils::operator+ ( std::array< T, N >  lhs,
std::array< T, N >  rhs 
)
inlineconstexpr

Adds two std::arrays.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

◆ operator+() [6/10]

template<typename T >
constexpr auto iganet::utils::operator+ ( std::vector< T >  vector,
data 
)
inlineconstexpr

Appends data to a std::vector object.

Template Parameters
TTemplate parameter T.
Parameters
vectorValue of vector.
dataValue of data.
Returns
Result of the operation.

◆ operator+() [7/10]

template<typename T , std::size_t N>
constexpr auto iganet::utils::operator+ ( data,
std::array< T, N >  array 
)
inlineconstexpr

Prepends data to a std::array object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
dataValue of data.
arrayValue of array.
Returns
Result of the operation.

◆ operator+() [8/10]

template<typename T >
constexpr auto iganet::utils::operator+ ( data,
std::vector< T >  vector 
)
inlineconstexpr

Prepends data to a std::vector object.

Template Parameters
TTemplate parameter T.
Parameters
dataValue of data.
vectorValue of vector.
Returns
Result of the operation.

◆ operator+() [9/10]

template<typename T >
constexpr auto iganet::utils::operator+ ( data,
torch::ArrayRef< T >  array 
)
inlineconstexpr

Prepends data to a torch::ArrayRef object.

Template Parameters
TTemplate parameter T.
Parameters
dataValue of data.
arrayValue of array.
Returns
Result of the operation.

◆ operator+() [10/10]

template<typename T >
constexpr auto iganet::utils::operator+ ( torch::ArrayRef< T >  array,
data 
)
inlineconstexpr

Appends data to a torch::ArrayRef object.

Template Parameters
TTemplate parameter T.
Parameters
arrayValue of array.
dataValue of data.
Returns
Result of the operation.

◆ operator+=() [1/2]

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator+= ( BlockTensor< T, Dims... > &  lhs,
const BlockTensor< U, Dims... > &  rhs 
)
inline

Increments one compile-time block tensor by another.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
DimsTemplate parameter Dims.
Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

◆ operator+=() [2/2]

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator+= ( BlockTensor< T, Dims... > &  lhs,
const U &  rhs 
)
inline

Increments a compile-time block tensor by a scalar.

Provides the for operation.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
DimsTemplate parameter Dims.
Returns
Result of the operation.

◆ operator-() [1/5]

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator- ( const BlockTensor< T, Dims... > &  lhs,
const BlockTensor< U, Dims... > &  rhs 
)
inline

Subtracts one compile-time block tensor from another and returns a new compile-time block tensor.

Provides the for operation.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
DimsTemplate parameter Dims.
Returns
Result of the operation.

◆ operator-() [2/5]

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator- ( const BlockTensor< T, Dims... > &  lhs,
const U &  rhs 
)
inline

Subtracts a scalar from a compile-time block tensor and returns a new compile-time block tensor.

◆ operator-() [3/5]

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator- ( const T &  lhs,
const BlockTensor< U, Dims... > &  rhs 
)
inline

Subtracts a compile-time block tensor from a scalar and returns a new compile-time block tensor.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
DimsTemplate parameter Dims.
Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

◆ operator-() [4/5]

template<typename T , std::size_t N>
constexpr std::array< T, N > iganet::utils::operator- ( std::array< T, N >  array)
inlineconstexpr

Negates all entries of a std::array.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
arrayValue of array.
Returns
Result of the operation.

◆ operator-() [5/5]

template<typename T , std::size_t N>
constexpr std::array< T, N > iganet::utils::operator- ( std::array< T, N >  lhs,
std::array< T, N >  rhs 
)
inlineconstexpr

Subtracts one std::array from another std::array.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

◆ operator-=() [1/2]

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator-= ( BlockTensor< T, Dims... > &  lhs,
const BlockTensor< U, Dims... > &  rhs 
)
inline

Decrements one compile-time block tensor by another.

Template Parameters
TTemplate parameter T.
UTemplate parameter U.
DimsTemplate parameter Dims.
Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

◆ operator-=() [2/2]

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::operator-= ( BlockTensor< T, Dims... > &  lhs,
const U &  rhs 
)
inline

Decrements a compile-time block tensor by a scalar.

◆ operator/()

template<typename T , std::size_t N>
constexpr std::array< T, N > iganet::utils::operator/ ( std::array< T, N >  lhs,
std::array< T, N >  rhs 
)
inlineconstexpr

Divides one std::array by another std::array.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

◆ operator<<()

template<typename T , std::size_t... Dims>
std::ostream & iganet::utils::operator<< ( std::ostream &  os,
const BlockTensorCore< T, Dims... > &  obj 
)
inline

Prints (as string) a compile-time block tensor object.

Template Parameters
TTemplate parameter T.
DimsTemplate parameter Dims.
Parameters
osOutput stream.
objObject to process.
Returns
Result of the operation.

◆ operator==()

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 
)
inline

Provides the operator== operation.

Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Result of the operation.

Returns true if both compile-time block tensors are equal.

◆ pbicgstab() [1/2]

auto iganet::utils::pbicgstab ( const torch::Tensor &  A,
const torch::Tensor  b,
const torch::Tensor &  inverse_preconditioner,
int  max_iter = 1000,
double  tol = 1e-10 
)
inline

PBiCGStab overload taking the inverse preconditioner as a tensor.

Parameters
AValue of A.
bValue of b.
inverse_preconditionerValue of inverse_preconditioner.
max_iterValue of max_iter.
tolValue of tol.
Returns
Result of the operation.

◆ pbicgstab() [2/2]

template<IterativeSolverPreconditioner Preconditioner>
auto iganet::utils::pbicgstab ( const torch::Tensor &  A,
const torch::Tensor  b,
Preconditioner &&  preconditioner,
int  max_iter = 1000,
double  tol = 1e-10 
)
inline

Solves the linear system A * x = b using the preconditioned Bi-Conjugate Gradient Stabilized (PBiCGStab) method.

The preconditioner must be callable with a residual tensor and return the action of the inverse preconditioner on that residual.

Template Parameters
PreconditionerTemplate parameter Preconditioner.
Parameters
AValue of A.
bValue of b.
preconditionerValue of preconditioner.
max_iterValue of max_iter.
tolValue of tol.
Returns
Result of the operation.

◆ pcg() [1/2]

auto iganet::utils::pcg ( const torch::Tensor &  A,
const torch::Tensor  b,
const torch::Tensor &  inverse_preconditioner,
int  max_iter = 1000,
double  tol = 1e-10 
)
inline

PCG overload taking the inverse preconditioner as a tensor.

Parameters
AValue of A.
bValue of b.
inverse_preconditionerValue of inverse_preconditioner.
max_iterValue of max_iter.
tolValue of tol.
Returns
Result of the operation.

◆ pcg() [2/2]

template<IterativeSolverPreconditioner Preconditioner>
auto iganet::utils::pcg ( const torch::Tensor &  A,
const torch::Tensor  b,
Preconditioner &&  preconditioner,
int  max_iter = 1000,
double  tol = 1e-10 
)
inline

Solves the linear system A * x = b using the preconditioned Conjugate Gradient (PCG) method.

The preconditioner must be callable with a residual tensor and return the action of the inverse preconditioner on that residual.

Template Parameters
PreconditionerTemplate parameter Preconditioner.
Parameters
AValue of A.
bValue of b.
preconditionerValue of preconditioner.
max_iterValue of max_iter.
tolValue of tol.
Returns
Result of the operation.

◆ pminres() [1/2]

auto iganet::utils::pminres ( const torch::Tensor &  A,
const torch::Tensor  b,
const torch::Tensor &  inverse_preconditioner,
int  max_iter = 1000,
double  tol = 1e-10 
)
inline

PMINRES overload taking the inverse preconditioner as a tensor.

Parameters
AValue of A.
bValue of b.
inverse_preconditionerValue of inverse_preconditioner.
max_iterValue of max_iter.
tolValue of tol.
Returns
Result of the operation.

◆ pminres() [2/2]

template<IterativeSolverPreconditioner Preconditioner>
auto iganet::utils::pminres ( const torch::Tensor &  A,
const torch::Tensor  b,
Preconditioner &&  preconditioner,
int  max_iter = 1000,
double  tol = 1e-10 
)
inline

Solves A * x = b using preconditioned MINRES.

A must be symmetric and the preconditioner must be symmetric positive definite. The preconditioner returns the action of its inverse.

Template Parameters
PreconditionerTemplate parameter Preconditioner.
Parameters
AValue of A.
bValue of b.
preconditionerValue of preconditioner.
max_iterValue of max_iter.
tolValue of tol.
Returns
Result of the operation.

◆ positive()

template<typename T , std::size_t... Dims>
auto iganet::utils::positive ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ pow()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::pow ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the power of each element in input with exponent other.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ prod()

template<typename T , std::size_t N>
T iganet::utils::prod ( std::array< T, N >  array,
std::size_t  start_index = 0,
std::size_t  stop_index = N - 1 
)
inline

Computes the (partial) product of all std::array entries.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
arrayValue of array.
start_indexValue of start_index.
stop_indexValue of stop_index.
Returns
Result of the operation.

◆ rad2deg()

template<typename T , std::size_t... Dims>
auto iganet::utils::rad2deg ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with each of the elements of input converted from angles in radians to degrees.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ real()

template<typename T , std::size_t... Dims>
auto iganet::utils::real ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the real values of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ reciprocal()

template<typename T , std::size_t... Dims>
auto iganet::utils::reciprocal ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the reciprocal of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ remainder()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::remainder ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Returns a new block tensor with the modulus of the elements of input.

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ remove_from_back()

template<typename T , std::size_t N, std::size_t M = 1>
constexpr std::array< T, N - M > iganet::utils::remove_from_back ( std::array< T, N >  array)
inlineconstexpr

Derives a std::array object from a given std::array object dropping the last M entries.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
MTemplate parameter M.
Parameters
arrayValue of array.
Returns
Result of the operation.

◆ remove_from_front()

template<typename T , std::size_t N, std::size_t M = 1>
constexpr std::array< T, N - M > iganet::utils::remove_from_front ( std::array< T, N >  array)
inlineconstexpr

Derives a std::array object from a given std::array object dropping the first M entries.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
MTemplate parameter M.
Parameters
arrayValue of array.
Returns
Result of the operation.

◆ repeat_tuple()

template<std::size_t N, typename T >
constexpr auto iganet::utils::repeat_tuple ( const T &  value)
constexpr

Returns a std::tuple object with N replications of the given value.

Template Parameters
NTemplate parameter N.
TTemplate parameter T.
Parameters
valueValue to process.
Returns
Result of the operation.

◆ round()

template<typename T , std::size_t... Dims>
auto iganet::utils::round ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the elements of input rounded to the nearest integer.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ rsqrt()

template<typename T , std::size_t... Dims>
auto iganet::utils::rsqrt ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the reciprocal of the square-root of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ sgn()

template<typename T , std::size_t... Dims>
auto iganet::utils::sgn ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the signs of the elements of input, extension to complex value.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ sigmoid()

template<typename T , std::size_t... Dims>
auto iganet::utils::sigmoid ( const BlockTensor< T, Dims... > &  input)
inline

Alias for expit().

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ sign()

template<typename T , std::size_t... Dims>
auto iganet::utils::sign ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the signs of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ signbit()

template<typename T , std::size_t... Dims>
auto iganet::utils::signbit ( const BlockTensor< T, Dims... > &  input)
inline

Tests if each element of input has its sign bit set (is less than zero) or not.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ sin()

template<typename T , std::size_t... Dims>
auto iganet::utils::sin ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the sine of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ sinc()

template<typename T , std::size_t... Dims>
auto iganet::utils::sinc ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the normalized sinc of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ sinh()

template<typename T , std::size_t... Dims>
auto iganet::utils::sinh ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the hyperbolic sine of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ slice_tensor_into_tuple() [1/2]

template<std::size_t I = 0, typename... Tensors, typename FuncSize , typename FuncAssign >
void iganet::utils::slice_tensor_into_tuple ( std::tuple< Tensors... > &  tuple,
const torch::Tensor &  tensor,
FuncSize &&  funcSize,
FuncAssign &&  funcAssign,
int64_t &  offset,
int64_t  dim = 0 
)

Slices the given tensor into the objects of the std::tuple.

Parameters
tupleValue of tuple.
tensorTensor to process.
funcSizeValue of funcSize.
funcAssignValue of funcAssign.
offsetValue of offset.
dimValue of dim.

◆ slice_tensor_into_tuple() [2/2]

template<typename... Tensors, typename FuncSize , typename FuncAssign >
void iganet::utils::slice_tensor_into_tuple ( std::tuple< Tensors... > &  tuple,
const torch::Tensor &  tensor,
FuncSize &&  funcSize,
FuncAssign &&  funcAssign,
int64_t  dim = 0 
)

Provides the slice_tensor_into_tuple operation.

Template Parameters
TensorsTemplate parameter Tensors.
FuncSizeTemplate parameter FuncSize.
FuncAssignTemplate parameter FuncAssign.
Parameters
tupleValue of tuple.
tensorTensor to process.
funcSizeValue of funcSize.
funcAssignValue of funcAssign.
dimValue of dim.

◆ sqrt()

template<typename T , std::size_t... Dims>
auto iganet::utils::sqrt ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the square-root of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ square()

template<typename T , std::size_t... Dims>
auto iganet::utils::square ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new block tensor with the square of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ sub()

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,
alpha = 1.0 
)
inline

Subtracts other, scaled by alpha, from input.

◆ subtract()

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,
alpha = 1.0 
)
inline

Alias for sub().

◆ sum()

template<typename T , std::size_t N>
T iganet::utils::sum ( std::array< T, N >  array,
std::size_t  start_index = 0,
std::size_t  stop_index = N - 1 
)
inline

Computes the (partial) sum of all std::array entries.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
arrayValue of array.
start_indexValue of start_index.
stop_indexValue of stop_index.
Returns
Result of the operation.

◆ tan()

template<typename T , std::size_t... Dims>
auto iganet::utils::tan ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new tensor with the tangent of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ tanh()

template<typename T , std::size_t... Dims>
auto iganet::utils::tanh ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new tensor with the hyperbolic tangent of the elements of input.

Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ to_array() [1/2]

template<typename... Args>
auto iganet::utils::to_array ( Args &&...  args)
inline

Converts a list of arguments into std::array.

Template Parameters
ArgsTemplate parameter Args.
Parameters
argsValue of args.
Returns
Result of the operation.

◆ to_array() [2/2]

template<std::size_t N, typename T >
std::array< T, N > iganet::utils::to_array ( std::vector< T > &&  vector)
inline

Converts a std::vector object into std::array.

Template Parameters
NTemplate parameter N.
TTemplate parameter T.
Parameters
vectorValue of vector.
Returns
Result of the operation.

◆ to_ArrayRef()

template<typename T , std::size_t N>
auto iganet::utils::to_ArrayRef ( const std::array< T, N > &  array)
inline

Converts a std::array<int64_t, N> to an at::IntArrayRef object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
arrayValue of array.
Returns
Result of the operation.

◆ to_json() [1/3]

template<typename T , std::size_t N>
auto iganet::utils::to_json ( const torch::Tensor &  tensor)
inline

Converts a torch::Tensor object to a JSON object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
tensorTensor to process.
Returns
Result of the operation.

◆ to_json() [2/3]

template<typename T , std::size_t N>
auto iganet::utils::to_json ( const torch::TensorAccessor< T, N > &  accessor)
inline

Converts a torch::TensorAccessor object to a JSON object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
accessorValue of accessor.
Returns
Result of the operation.

◆ to_json() [3/3]

template<typename T , std::size_t N, std::size_t M>
auto iganet::utils::to_json ( const utils::TensorArray< M > &  tensors)
inline

Converts a std::array of torch::Tensor objects to a JSON object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
MTemplate parameter M.
Parameters
tensorsValue of tensors.
Returns
Result of the operation.

◆ to_sparseCsrTensor() [1/3]

torch::Tensor iganet::utils::to_sparseCsrTensor ( const torch::Tensor &  col_indices,
const torch::Tensor &  values,
const torch::IntArrayRef &  size 
)
inline

Constructs a sparse-CSR matrix from the column indices, matrix values and the matrix size.

Parameters
[in]col_indicesColumn indices in row-major order. ///.
[in]valuesMatrix values in row-major order.
[in]sizeMatrix size.
Returns
Result of the operation.

◆ to_sparseCsrTensor() [2/3]

template<std::size_t N>
torch::Tensor iganet::utils::to_sparseCsrTensor ( const utils::TensorArray< N > &  col_indices,
const std::array< int64_t, N > &  nbasfuncs,
const torch::Tensor &  values,
const torch::IntArrayRef &  size 
)
inline

Constructs a sparse-CSR matrix from the column indices, matrix values and the matrix size.

Template Parameters
NSize of the column index array.
Parameters
[in]col_indicesArray of column indices in row-major order. ///.
[in]valuesMatrix values in row-major order.
[in]sizeMatrix size.
nbasfuncsValue of nbasfuncs.
Returns
Result of the operation.

◆ to_sparseCsrTensor() [3/3]

template<std::size_t N>
torch::Tensor iganet::utils::to_sparseCsrTensor ( const utils::TensorArray< N > &  knot_indices,
const std::array< short, N > &  degrees,
const std::array< int64_t, N > &  nbasfuncs,
const torch::Tensor &  values,
const torch::IntArrayRef &  size 
)
inline

Constructs a sparse-CSR matrix from the B-spline basis function values evaluated at discrete points (e.g., the Greville abscissae), the corresponding knot_indices (i.e. the list of knot indices that mark the start of the knot span the discrete points fall into), the B-spline degrees and the matrix size.

Template Parameters
NSize of the knot index and degree arrays.
Parameters
[in]knot_indicesList of knot indices marking the start of the knot span the discrete evaluation points fall into.
[in]valuesMatrix values in row-major order.
[in]sizeMatrix size.
degreesValue of degrees.
nbasfuncsValue of nbasfuncs.
Returns
Result of the operation.

◆ to_tensor() [1/6]

template<typename T , std::size_t N>
auto iganet::utils::to_tensor ( const std::array< T, N > &  array,
const iganet::Options< T > &  options 
)
inline

Provides the to_tensor operation.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
arrayValue of array.
optionsConfiguration options.
Returns
Result of the operation.

◆ to_tensor() [2/6]

template<typename T , std::size_t N>
auto iganet::utils::to_tensor ( const std::array< T, N > &  array,
torch::IntArrayRef  sizes = torch::IntArrayRef{-1},
const iganet::Options< T > &  options = iganet::Options<T>{} 
)
inline

Converts a std::array to torch::Tensor.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
arrayValue of array.
sizesValue of sizes.
optionsConfiguration options.
Returns
Result of the operation.

◆ to_tensor() [3/6]

template<typename T >
auto iganet::utils::to_tensor ( const std::vector< T > &  vector,
const iganet::Options< T > &  options 
)
inline

Provides the to_tensor operation.

Template Parameters
TTemplate parameter T.
Parameters
vectorValue of vector.
optionsConfiguration options.
Returns
Result of the operation.

◆ to_tensor() [4/6]

template<typename T >
auto iganet::utils::to_tensor ( const std::vector< T > &  vector,
torch::IntArrayRef  sizes = torch::IntArrayRef{-1},
const iganet::Options< T > &  options = iganet::Options<T>{} 
)
inline

Converts a std::vector to torch::Tensor.

Template Parameters
TTemplate parameter T.
Parameters
vectorValue of vector.
sizesValue of sizes.
optionsConfiguration options.
Returns
Result of the operation.

◆ to_tensor() [5/6]

template<typename T >
auto iganet::utils::to_tensor ( std::initializer_list< T > &  list,
const iganet::Options< T > &  options 
)
inline

Provides the to_tensor operation.

Template Parameters
TTemplate parameter T.
Parameters
listValue of list.
optionsConfiguration options.
Returns
Result of the operation.

◆ to_tensor() [6/6]

template<typename T >
auto iganet::utils::to_tensor ( std::initializer_list< T >  list,
torch::IntArrayRef  sizes = torch::IntArrayRef{-1},
const iganet::Options< T > &  options = iganet::Options<T>{} 
)
inline

Converts a std::initializer_list to torch::Tensor.

Template Parameters
TTemplate parameter T.
Parameters
listValue of list.
sizesValue of sizes.
optionsConfiguration options.
Returns
Result of the operation.

◆ to_tensorAccessor() [1/5]

template<typename T , std::size_t N, std::size_t... Dims>
auto iganet::utils::to_tensorAccessor ( const BlockTensor< torch::Tensor, Dims... > &  blocktensor,
c10::DeviceType  deviceType 
)

Provides the to_tensorAccessor operation.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
DimsTemplate parameter Dims.
Parameters
blocktensorValue of blocktensor.
deviceTypeValue of deviceType.
Returns
Result of the operation.

◆ to_tensorAccessor() [2/5]

template<typename T , std::size_t N, std::size_t M>
auto iganet::utils::to_tensorAccessor ( const TensorArray< M > &  tensorArray)

Converts a std::array of torch::Tensor objects to an array of torch::TensorAccessor objects.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
MTemplate parameter M.
Parameters
tensorArrayValue of tensorArray.
Returns
Result of the operation.

◆ to_tensorAccessor() [3/5]

template<typename T , std::size_t N, std::size_t M>
auto iganet::utils::to_tensorAccessor ( const TensorArray< M > &  tensorArray,
c10::DeviceType  deviceType 
)

Provides the to_tensorAccessor operation.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
MTemplate parameter M.
Parameters
tensorArrayValue of tensorArray.
deviceTypeValue of deviceType.
Returns
Result of the operation.

◆ to_tensorAccessor() [4/5]

template<typename T , std::size_t N>
auto iganet::utils::to_tensorAccessor ( const torch::Tensor &  tensor)

Converts a torch::Tensor object to a torch::TensorAccessor object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
tensorTensor to process.
Returns
Result of the operation.

◆ to_tensorAccessor() [5/5]

template<typename T , std::size_t N>
auto iganet::utils::to_tensorAccessor ( const torch::Tensor &  tensor,
c10::DeviceType  deviceType 
)

Provides the to_tensorAccessor operation.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
TTemplate parameter T.
NTemplate parameter N.
Parameters
tensorTensor to process.
deviceTypeValue of deviceType.
Returns
Result of the operation.

◆ to_tensorArray() [1/4]

template<typename... Ts, typename T >
constexpr TensorArray< sizeof...(Ts)> iganet::utils::to_tensorArray ( const iganet::Options< T > &  options,
std::initializer_list< Ts > &&...  lists 
)
inlineconstexpr

Provides the function operation.

Template Parameters
TsTemplate parameter Ts.
TTemplate parameter T.
Returns
Result of the operation.

◆ to_tensorArray() [2/4]

template<typename... Ts>
constexpr TensorArray< sizeof...(Ts)> iganet::utils::to_tensorArray ( std::initializer_list< Ts > &&...  lists)
inlineconstexpr

Converts a set of std::initializer_list objects to a TensorArray object.

Template Parameters
TsTemplate parameter Ts.
Returns
Result of the operation.

◆ to_tensorArray() [3/4]

template<typename... Ts, typename T >
constexpr TensorArray< sizeof...(Ts)> iganet::utils::to_tensorArray ( torch::IntArrayRef  sizes,
const iganet::Options< T > &  options,
std::initializer_list< Ts > &&...  lists 
)
inlineconstexpr

Provides the function operation.

Template Parameters
TsTemplate parameter Ts.
TTemplate parameter T.
Returns
Result of the operation.

◆ to_tensorArray() [4/4]

template<typename... Ts>
constexpr TensorArray< sizeof...(Ts)> iganet::utils::to_tensorArray ( torch::IntArrayRef  sizes,
std::initializer_list< Ts > &&...  lists 
)
inlineconstexpr

Provides the function operation.

Template Parameters
TsTemplate parameter Ts.
Returns
Result of the operation.

◆ to_vector() [1/2]

template<typename... Args>
auto iganet::utils::to_vector ( Args &&...  args)
inline

Converts a list of arguments into std::vector.

Template Parameters
ArgsTemplate parameter Args.
Parameters
argsValue of args.
Returns
Result of the operation.

◆ to_vector() [2/2]

template<typename T , std::size_t N>
std::vector< T > iganet::utils::to_vector ( std::array< T, N > &&  array)
inline

Converts a std::array object into std::vector.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
arrayValue of array.
Returns
Result of the operation.

◆ to_xml() [1/6]

template<typename T , std::size_t N>
pugi::xml_node & iganet::utils::to_xml ( const torch::Tensor &  tensor,
pugi::xml_node &  root,
std::string  tag,
int  id,
const std::string &  label,
int  index 
)
inline

Converts a torch::Tensor object to an XML object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
tensorTensor to process.
rootRoot XML node.
tagValue of tag.
idObject identifier.
labelObject label.
indexObject index.
Returns
Result of the operation.

◆ to_xml() [2/6]

template<typename T , std::size_t N>
pugi::xml_document iganet::utils::to_xml ( const torch::Tensor &  tensor,
std::string  tag = "Matrix",
int  id = 0,
const std::string &  label = "",
int  index = -1 
)
inline

Converts a torch::Tensor object to an XML document object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
tensorTensor to process.
tagValue of tag.
idObject identifier.
labelObject label.
indexObject index.
Returns
Result of the operation.

◆ to_xml() [3/6]

template<typename T , std::size_t N>
pugi::xml_node & iganet::utils::to_xml ( const torch::TensorAccessor< T, N > &  accessor,
torch::IntArrayRef  sizes,
pugi::xml_node &  root,
std::string  tag,
int  id,
const std::string &  label,
int  index 
)
inline

Converts a torch::TensorAccessor object to an XML object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
accessorValue of accessor.
sizesValue of sizes.
rootRoot XML node.
tagValue of tag.
idObject identifier.
labelObject label.
indexObject index.
Returns
Result of the operation.

◆ to_xml() [4/6]

template<typename T , std::size_t N>
pugi::xml_document iganet::utils::to_xml ( const torch::TensorAccessor< T, N > &  accessor,
torch::IntArrayRef  sizes,
std::string  tag = "Matrix",
int  id = 0,
const std::string &  label = "",
int  index = -1 
)
inline

Converts a torch::TensorAccessor object to an XML document object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
Parameters
accessorValue of accessor.
sizesValue of sizes.
tagValue of tag.
idObject identifier.
labelObject label.
indexObject index.
Returns
Result of the operation.

◆ to_xml() [5/6]

template<typename T , std::size_t N, std::size_t M>
pugi::xml_node & iganet::utils::to_xml ( const utils::TensorArray< M > &  tensors,
pugi::xml_node &  root,
std::string  tag,
int  id,
const std::string &  label 
)
inline

Converts a std::array of torch::Tensor objects to an XML object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
MTemplate parameter M.
Parameters
tensorsValue of tensors.
rootRoot XML node.
tagValue of tag.
idObject identifier.
labelObject label.
Returns
Result of the operation.

◆ to_xml() [6/6]

template<typename T , std::size_t N, std::size_t M>
pugi::xml_document iganet::utils::to_xml ( const utils::TensorArray< M > &  tensors,
std::string  tag = "Matrix",
int  id = 0,
const std::string &  label = "",
int  index = -1 
)
inline

Converts a std::array of torch::Tensor objects to an XML object.

Template Parameters
TTemplate parameter T.
NTemplate parameter N.
MTemplate parameter M.
Parameters
tensorsValue of tensors.
tagValue of tag.
idObject identifier.
labelObject label.
indexObject index.
Returns
Result of the operation.

◆ trunc()

template<typename T , std::size_t... Dims>
auto iganet::utils::trunc ( const BlockTensor< T, Dims... > &  input)
inline

Returns a new tensor with the truncated integer values of the elements of input.

Returns
Result of the operation.
Template Parameters
TBlock element type. *
DimsCompile-time block dimensions. *
Parameters
inputBlock tensor whose elements are transformed. *
Returns
A block tensor containing the transformed elements.

◆ VSlice() [1/2]

template<bool transpose = false, std::size_t N>
auto iganet::utils::VSlice ( const utils::TensorArray< N > &  index,
const std::array< int64_t, N > &  start_offset,
const std::array< int64_t, N > &  stop_offset,
const std::array< int64_t, N - 1 > &  leading_dim = make_array<int64_t, N - 1>(1) 
)
inline

Vectorized version of torch::indexing::Slice (see https://pytorch.org/cppdocs/notes/tensor_indexing.html).

Parameters
[in]indexarray of tensors of indices.
[in]start_offsetarray of starting value of the offset.
[in]stop_offsetarray of stopping value of the offset.
[in]leading_dimarray of leading dimension.
Template Parameters
transposeTemplate parameter transpose.
NTemplate parameter N.
Returns
Result of the operation.

◆ VSlice() [2/2]

template<bool transpose = false>
auto iganet::utils::VSlice ( torch::Tensor  index,
int64_t  start_offset,
int64_t  stop_offset 
)
inline

Vectorized version of torch::indexing::Slice (see https://pytorch.org/cppdocs/notes/tensor_indexing.html).

Creates a one-dimensional torch::Tensor object of size index.numel() * (stop_offset-start_offset) with the following content.

[ index[0]+start_offset, ..., index[N-1]+start_offset,
index[0]+start_offset+1, ..., index[N-1]+start_offset+1,
...
index[0]+stop_offset-1, ... index[N-1]+stop_offset-1 ]
Parameters
[in]indexTensor of indices.
[in]start_offsetStarting value of the offset.
[in]stop_offsetStopping value of the offset.
Template Parameters
transposeTemplate parameter transpose.
Returns
Result of the operation.

◆ xlogy()

template<typename T , typename U , std::size_t... Dims>
auto iganet::utils::xlogy ( const BlockTensor< T, Dims... > &  input,
const BlockTensor< U, Dims... > &  other 
)
inline

Computes input * log(other).

Template Parameters
TLeft block element type. *
URight block element type. *
DimsCompile-time block dimensions. *
Parameters
inputLeft block tensor. *
otherRight block tensor. *
Returns
A block tensor containing the element-wise results.

◆ zip()

template<typename... T>
auto iganet::utils::zip ( T &&...  seqs)

Provides the zip operation.

Parameters
seqsValue of seqs.
Returns
Result of the operation.

Variable Documentation

◆ is_tuple_of_tuples_v

template<class T >
constexpr auto iganet::utils::is_tuple_of_tuples_v = is_tuple_of_tuples<T>::value
inlineconstexpr

Alias for is_tuple_of_tuples::value.

◆ is_tuple_v

template<class T >
constexpr bool iganet::utils::is_tuple_v = is_tuple<T>::value
inlineconstexpr

◆ tuple_cat_v

template<typename... Tuples>
constexpr auto iganet::utils::tuple_cat_v = tuple_cat<Tuples...>::value
inlineconstexpr

Alias for tuple_cat::value.