Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
dense_space.hpp
Go to the documentation of this file.
1
7#pragma once
8
10
11#include <cstddef>
12#include <string>
13#include <utility>
14
15namespace uni20
16{
17
22 public:
26 explicit DenseSpace(std::size_t extent, std::string label = {}) : extent_(extent), label_(std::move(label)) {}
27
30 auto extent() const -> std::size_t { return extent_; }
31
34 auto empty() const -> bool { return extent_ == 0; }
35
38 auto label() const -> std::string const& { return label_; }
39
42 void set_label(std::string label) { label_ = std::move(label); }
43
47 auto operator==(DenseSpace const& other) const -> bool = default;
48
49 private:
50 std::size_t extent_ = 0;
51 std::string label_;
52};
53
54static_assert(Space<DenseSpace>);
55static_assert(!SymmetrySpace<DenseSpace>);
56
57} // namespace uni20
Symmetry-neutral dense tensor space with one fixed extent.
Definition dense_space.hpp:21
auto label() const -> std::string const &
Return the semantic leg label.
Definition dense_space.hpp:38
auto empty() const -> bool
Return whether the dense space has zero extent.
Definition dense_space.hpp:34
DenseSpace(std::size_t extent, std::string label={})
Construct a dense space.
Definition dense_space.hpp:26
auto operator==(DenseSpace const &other) const -> bool=default
Compare dense extent and label.
void set_label(std::string label)
Replace the semantic leg label without changing the extent.
Definition dense_space.hpp:42
auto extent() const -> std::size_t
Return the dense extent.
Definition dense_space.hpp:30
Tensor-space value with a mutable semantic leg label.
Definition space.hpp:22
Space whose structure is interpreted in one explicit symmetry context.
Definition space.hpp:31
Definition qnum.hpp:403
Definition async/async.hpp:26
Defines the common tensor-space concepts.