core¶
error_checking¶
Defines error checking policies for tensors and quantities.
This file provides an enumeration for specifying error checking policies and a helper struct for determining the resulting policy when combining two policies in an expression.
-
namespace squint¶
Enums
-
enum class error_checking : uint8_t¶
Enumeration to specify the error checking policy for tensors and quantities.
This enum class is used as a template parameter to control whether error checking is enabled or disabled for tensor and quantity operations.
Values:
-
enumerator enabled¶
Error checking is enabled
-
enumerator disabled¶
Error checking is disabled
-
enumerator enabled¶
-
template<error_checking ErrorChecking1, error_checking ErrorChecking2>
struct resulting_error_checking¶ - #include <squint/core/error_checking.hpp>
Helper struct to determine the resulting error checking policy.
This struct is used to determine the resulting error checking policy when combining two error checking policies in an expression. The resulting policy is enabled if at least one of the input policies is enabled.
- Template Parameters:
ErrorChecking1 – The first error checking policy.
ErrorChecking2 – The second error checking policy.
Public Static Attributes
-
static constexpr auto value = ErrorChecking1 == error_checking::enabled || ErrorChecking2 == error_checking::enabled ? error_checking::enabled : error_checking::disabled¶
The resulting error checking policy.
This static constexpr member holds the resulting error checking policy. It is set to enabled if either ErrorChecking1 or ErrorChecking2 is enabled, and disabled otherwise.
-
enum class error_checking : uint8_t¶
concepts¶
Defines concepts for tensors and quantities.
This file provides concepts for tensor-like types and quantities. These concepts are used to constrain template parameters in the library.
-
namespace squint
Specific Concepts¶
-
template<class T>
concept rational¶ - #include <squint/core/concepts.hpp>
Concept for the standard library ratio template type.
This concept ensures that a type T is an instance of std::ratio.
- tparam T:
The type to check against the rational concept.
-
template<class U>
concept dimensional¶ - #include <squint/core/concepts.hpp>
Concept for a physical dimension.
This concept defines the requirements for a type to be considered a valid physical dimension. It must have rational exponents for each of the seven SI base dimensions.
- tparam U:
The type to check against the dimensional concept.
-
template<class U>
concept dimensionless¶ - #include <squint/core/concepts.hpp>
Concept for a dimensionless physical dimension.
This concept checks if all dimension exponents are zero.
- tparam U:
The type to check against the dimensionless concept.
-
template<typename T>
concept tensorial¶ - #include <squint/core/concepts.hpp>
Base concept for tensor-like types.
This concept defines the basic requirements for a type to be considered a tensor.
- tparam T:
The type to check against the tensorial concept.
-
template<typename T>
concept floating_point¶ - #include <squint/core/concepts.hpp>
Concept for floating-point types.
- tparam T:
The type to check.
-
template<typename T>
concept arithmetic¶ - #include <squint/core/concepts.hpp>
Concept for arithmetic types.
- tparam T:
The type to check.
-
template<typename T>
concept quantitative¶ - #include <squint/core/concepts.hpp>
Concept for quantity types.
This concept defines the requirements for a type to be considered a quantity.
- tparam T:
The type to check against the quantitative concept.
-
template<typename T>
concept scalar¶ - #include <squint/core/concepts.hpp>
Concept for scalar-like types.
This concept includes both arithmetic types and quantitative types.
- tparam T:
The type to check.
-
template<typename T>
concept dimensionless_quantity¶ - #include <squint/core/concepts.hpp>
Concept for dimensionless quantity types.
- tparam T:
The type to check.
-
template<typename T>
concept dimensionless_scalar¶ - #include <squint/core/concepts.hpp>
Concept for dimensionless scalar types.
This concept includes both arithmetic types and dimensionless quantity types.
- tparam T:
The type to check.
- squint::compile_time_shape
- #include <squint/core/concepts.hpp>
Concept for compile-time shapes.
This concept checks if a type is an index sequence.
- tparam T:
The type to check.
- squint::runtime_shape
- #include <squint/core/concepts.hpp>
Concept for runtime shapes.
This concept checks if a type is a vector of size_t.
- tparam T:
The type to check.
-
template<typename T>
concept fixed_shape¶ - #include <squint/core/concepts.hpp>
Concept for tensors with a fixed shape.
- tparam T:
The type to check.
-
template<typename T>
concept dynamic_shape¶ - #include <squint/core/concepts.hpp>
Concept for tensors with a dynamic shape.
- tparam T:
The type to check.
-
template<typename T>
concept fixed_tensor¶ - #include <squint/core/concepts.hpp>
-
template<typename T>
concept dynamic_tensor¶ - #include <squint/core/concepts.hpp>
-
template<typename T>
concept const_tensor¶ - #include <squint/core/concepts.hpp>
Concept for constant tensors.
- tparam T:
The type to check.
-
template<typename T>
concept owning_tensor¶ - #include <squint/core/concepts.hpp>
Concept for owning tensors.
- tparam T:
The type to check.
-
template<typename T>
concept error_checking_enabled¶ - #include <squint/core/concepts.hpp>
Concept for types with error checking enabled.
- tparam T:
The type to check.
-
template<typename T>
concept host_tensor¶ - #include <squint/core/concepts.hpp>
Concept for tensors residing in host memory.
- tparam T:
The type to check.
-
template<typename T>
concept fixed_contiguous_tensor¶ - #include <squint/core/concepts.hpp>
Concept for fixed and contiguous tensors.
- tparam T:
The type to check.
memory¶
Defines
-
NO_UNIQUE_ADDRESS¶
-
namespace squint
Enums
-
enum class memory_space : uint8_t¶
Enumeration to specify the memory space of tensors.
This enum class is used as a template parameter to control where tensor data is stored. It affects the performance of certain operations and the compatibility with external libraries.
Values:
-
enumerator host¶
-
enumerator device¶
-
enumerator host¶
-
enum class ownership_type : uint8_t¶
Enumeration to specify the ownership of tensors.
This enum class is used as a template parameter to control the ownership of tensor data.
owner: the tensor owns the data and is responsible for its deallocation.
reference: the tensor does not own the data and should not deallocate it.
Values:
-
enumerator owner¶
-
enumerator reference¶
-
enum class memory_space : uint8_t¶
layout¶
Defines memory layout options for tensors.
This file provides an enumeration for specifying the memory layout of tensors in the Squint library. The layout determines how multi-dimensional tensor data is arranged in contiguous memory.
-
namespace squint
Typedefs
-
using dynamic = std::vector<std::size_t>¶
Enums
-
enum class layout : uint8_t¶
Enumeration to specify the memory layout of tensors.
This enum class is used as a template parameter to control how tensor data is arranged in memory. It affects the performance of certain operations and the compatibility with external libraries.
Values:
-
enumerator row_major¶
Row-major layout: elements of a row are contiguous in memory
-
enumerator column_major¶
Column-major layout: elements of a column are contiguous in memory
-
enumerator row_major¶
Variables
-
template<std::size_t Idx, layout Layout, std::size_t... Dims>
struct compute_single_stride<Idx, Layout, std::index_sequence<Dims...>>¶ - #include <squint/core/layout.hpp>
Public Types
-
using reversed_shape = reverse_sequence_t<std::index_sequence<Dims...>>¶
-
using reversed_shape = reverse_sequence_t<std::index_sequence<Dims...>>¶
-
template<layout Layout, std::size_t... Is, std::size_t... Dims>
struct compute_strides<Layout, std::index_sequence<Is...>, std::index_sequence<Dims...>>¶ - #include <squint/core/layout.hpp>
-
template<std::size_t... Strides, std::size_t... Shape>
struct is_column_major_t<std::index_sequence<Strides...>, std::index_sequence<Shape...>>¶ - #include <squint/core/layout.hpp>
-
template<std::size_t... Strides, std::size_t... Shape>
struct is_row_major_t<std::index_sequence<Strides...>, std::index_sequence<Shape...>>¶ - #include <squint/core/layout.hpp>
-
template<std::size_t Start, std::size_t End, std::size_t... Dims>
struct product_range<Start, End, std::index_sequence<Dims...>>¶ - #include <squint/core/layout.hpp>
Public Static Functions
-
struct strides¶
- #include <squint/core/layout.hpp>
Helper to compute the strides of a tensor shape.
This template computes the strides of a tensor shape with optional layout. The strides are computed as the product of all dimensions before the current dimension in the specified layout.
Public Types
-
template<typename Shape>
using row_major = typename compute_strides<layout::row_major, std::make_index_sequence<Shape::size()>, Shape>::type¶
-
template<typename Shape>
using column_major = typename compute_strides<layout::column_major, std::make_index_sequence<Shape::size()>, Shape>::type¶
-
template<typename Shape>
-
using dynamic = std::vector<std::size_t>¶