Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Namespaces | Functions
block_tensor_linear.hpp File Reference

Defines structure-preserving linear operations on BlockTensor values. More...

#include <uni20/async/debug_scheduler.hpp>
#include <uni20/config.hpp>
#include <uni20/core/math.hpp>
#include <uni20/core/scalar_concepts.hpp>
#include <uni20/linalg/async/transform.hpp>
#include <uni20/linalg/elementwise_functions.hpp>
#include <uni20/mdspan/mdspec.hpp>
#include <uni20/symmetry/block_tensor.hpp>
#include <uni20/symmetry/block_tensor_concepts.hpp>
#include <uni20/tensor/copy_into.hpp>
#include <uni20/tensor/reductions.hpp>
#include <uni20/tensor/transform.hpp>
#include <algorithm>
#include <array>
#include <cmath>
#include <concepts>
#include <cstddef>
#include <memory>
#include <optional>
#include <span>
#include <stdexcept>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for block_tensor_linear.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  uni20
 

Functions

template<class OutputStorage = void, BlockTensorView Lhs, BlockTensorView Rhs>
requires detail::CompatibleBlockTensorValues<Lhs, Rhs> && SparseBlockStorage<detail::selected_linear_storage_t<OutputStorage, Lhs>> && detail::CompatibleLinearOutputStorage<detail::selected_linear_storage_t<OutputStorage, Lhs>, Lhs, Rhs>
auto uni20::add (Lhs const &lhs, Rhs const &rhs)
 Return the sum of two BlockTensor values using the union of stored keys.
 
template<MutableBlockTensorView Output, BlockTensorView Lhs, BlockTensorView Rhs>
requires detail::CompatibleBlockTensorValues<Output, Lhs> && detail::CompatibleBlockTensorValues<Output, Rhs> && detail::CompatibleLinearOutputRepresentation<Output, Lhs, Rhs> && ((!MutableAsyncBlockTensorView<Output> && !AsyncBlockTensorView<Lhs> && !AsyncBlockTensorView<Rhs>) || (MutableAsyncBlockTensorView<Output> && AsyncBlockTensorView<Lhs> && AsyncBlockTensorView<Rhs>))
void uni20::add (Output &output, Lhs const &lhs, Rhs const &rhs)
 Overwrite a fixed BlockTensor output with the sum of two values.
 
template<MutableBlockTensorView Output, BlockTensorView Input>
requires detail::CompatibleBlockTensorValues<Output, Input> && detail::CompatibleLinearOutputRepresentation<Output, Input> && ((!MutableAsyncBlockTensorView<Output> && !AsyncBlockTensorView<Input>) || (MutableAsyncBlockTensorView<Output> && AsyncBlockTensorView<Input>))
void uni20::add_inplace (Output &output, Input const &input)
 Add one BlockTensor value to an existing output in place.
 
template<MutableBlockTensorView Output, class Scalar , BlockTensorView Input>
requires detail::CompatibleBlockTensorValues<Output, Input> && detail::CompatibleLinearOutputRepresentation<Output, Input> && ((!MutableAsyncBlockTensorView<Output> && !AsyncBlockTensorView<Input>) || (MutableAsyncBlockTensorView<Output> && AsyncBlockTensorView<Input>))
void uni20::assign_scale (Output &output, Scalar factor, Input const &input)
 Overwrite a fixed BlockTensor output with a scaled input value.
 
template<MutableBlockTensorView Output, class Scalar , BlockTensorView Input>
requires detail::CompatibleBlockTensorValues<Output, Input> && detail::CompatibleLinearOutputRepresentation<Output, Input> && ((!MutableAsyncBlockTensorView<Output> && !AsyncBlockTensorView<Input>) || (MutableAsyncBlockTensorView<Output> && AsyncBlockTensorView<Input>))
void uni20::axpy (Output &output, Scalar factor, Input const &input)
 Compute output += factor * input without changing either key pattern.
 
template<MutableBlockTensorView Output, BlockTensorView Input>
requires detail::CompatibleBlockTensorValues<Output, Input> && detail::CompatibleLinearOutputRepresentation<Output, Input> && ((!MutableAsyncBlockTensorView<Output> && !AsyncBlockTensorView<Input>) || (MutableAsyncBlockTensorView<Output> && AsyncBlockTensorView<Input>))
void uni20::copy (Output &output, Input const &input)
 Copy a BlockTensor value into an existing fixed output structure.
 
template<BlockTensorView Lhs, BlockTensorView Rhs>
requires detail::CompatibleBlockTensorValues<Lhs, Rhs> && RealOrComplex<block_tensor_value_t<Lhs>> && ((!AsyncBlockTensorView<Lhs> && !AsyncBlockTensorView<Rhs>) || (AsyncBlockTensorView<Lhs> && AsyncBlockTensorView<Rhs>))
auto uni20::inner_product (Lhs const &lhs, Rhs const &rhs)
 Return the BlockTensor inner product in a host rank-zero Tensor.
 
template<BlockTensorView Lhs, BlockTensorView Rhs>
requires detail::CompatibleBlockTensorValues<Lhs, Rhs> && RealOrComplex<block_tensor_value_t<Lhs>> && ((!AsyncBlockTensorView<Lhs> && !AsyncBlockTensorView<Rhs>) || (AsyncBlockTensorView<Lhs> && AsyncBlockTensorView<Rhs>))
auto uni20::inner_product_host (Lhs const &lhs, Rhs const &rhs) -> block_tensor_value_t< Lhs >
 Return the conjugate-linear BlockTensor inner product as a host scalar.
 
template<BlockTensorView Tensor>
requires RealOrComplex<block_tensor_value_t<Tensor>>
auto uni20::norm (Tensor const &tensor)
 Return the Euclidean BlockTensor norm in a host rank-zero Tensor.
 
template<BlockTensorView Tensor>
requires RealOrComplex<block_tensor_value_t<Tensor>>
auto uni20::norm_host (Tensor const &tensor) -> make_real_t< block_tensor_value_t< Tensor > >
 Return the Euclidean BlockTensor norm as a host scalar.
 
template<MutableBlockTensorView Tensor, class Scalar >
void uni20::scale (Tensor &tensor, Scalar factor)
 Multiply every stored numerical block by a scalar in place.
 
template<MutableBlockTensorView Tensor>
void uni20::set_zero (Tensor &tensor)
 Set every stored numerical block to zero without changing structure.
 

Detailed Description

Defines structure-preserving linear operations on BlockTensor values.