Skip to content

Commit

Permalink
auxiliary -> aux
Browse files Browse the repository at this point in the history
  • Loading branch information
evaleev committed Nov 17, 2024
1 parent dd88460 commit 4f3cd68
Show file tree
Hide file tree
Showing 14 changed files with 106 additions and 112 deletions.
32 changes: 15 additions & 17 deletions SeQuant/core/abstract_tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ class AbstractTensor {
}
/// accesses aux (invariant) indices
/// @return view of a contiguous range of Index objects
virtual const_any_view_randsz _auxiliary() const {
throw missing_instantiation_for("_auxiliary");
virtual const_any_view_randsz _aux() const {
throw missing_instantiation_for("_aux");
}
/// accesses bra and ket indices
/// view of a not necessarily contiguous range of Index objects
Expand All @@ -129,8 +129,8 @@ class AbstractTensor {
throw missing_instantiation_for("_ket_rank");
}
/// @return the number of aux indices
virtual std::size_t _auxiliary_rank() const {
throw missing_instantiation_for("_auxiliary_rank");
virtual std::size_t _aux_rank() const {
throw missing_instantiation_for("_aux_rank");
}
/// @return the permutational symmetry of the vector space indices of
/// the tensor
Expand Down Expand Up @@ -184,11 +184,11 @@ class AbstractTensor {
virtual any_view_randsz _ket_mutable() {
throw missing_instantiation_for("_ket_mutable");
}
/// @return mutable view of auxiliary indices
/// @return mutable view of aux indices
/// @warning this is used for mutable access, flush memoized state before
/// returning!
virtual any_view_randsz _auxiliary_mutable() {
throw missing_instantiation_for("_auxiliary_mutable");
virtual any_view_randsz _aux_mutable() {
throw missing_instantiation_for("_aux_mutable");
}

friend class TensorCanonicalizer;
Expand All @@ -199,14 +199,12 @@ class AbstractTensor {
/// @{
inline auto bra(const AbstractTensor& t) { return t._bra(); }
inline auto ket(const AbstractTensor& t) { return t._ket(); }
inline auto auxiliary(const AbstractTensor& t) { return t._auxiliary(); }
inline auto aux(const AbstractTensor& t) { return t._aux(); }
inline auto braket(const AbstractTensor& t) { return t._braket(); }
inline auto indices(const AbstractTensor& t) { return t._indices(); }
inline auto bra_rank(const AbstractTensor& t) { return t._bra_rank(); }
inline auto ket_rank(const AbstractTensor& t) { return t._ket_rank(); }
inline auto auxiliary_rank(const AbstractTensor& t) {
return t._auxiliary_rank();
}
inline auto aux_rank(const AbstractTensor& t) { return t._aux_rank(); }
inline auto symmetry(const AbstractTensor& t) { return t._symmetry(); }
inline auto braket_symmetry(const AbstractTensor& t) {
return t._braket_symmetry();
Expand All @@ -222,12 +220,12 @@ inline auto to_latex(const AbstractTensor& t) { return t._to_latex(); }
/// Type trait for checking whether a given class fulfills the Tensor interface
/// requirements Object @c t of a type that meets the concept must satisfy the
/// following:
/// - @c bra(t) , @c ket(t), @c auxiliary(t), @c braket(t) and
/// - @c bra(t) , @c ket(t), @c aux(t), @c braket(t) and
/// @c indices(t) are valid expressions and evaluate to a range of Index
/// objects;
/// - @c bra_rank(t), @c ket_rank(t) and @c auxiliary_rank(t) are valid
/// expression and return sizes of the @c bra(t), @c ket(t) and @c
/// auxiliary(t) ranges, respectively;
/// - @c bra_rank(t), @c ket_rank(t) and @c aux_rank(t) are valid
/// expression and return sizes of the @c bra(t), @c ket(t) and
/// @c aux(t) ranges, respectively;
/// - @c symmetry(t) is a valid expression and evaluates to a Symmetry
/// object that describes the symmetry of bra/ket of a
/// _particle-symmetric_ @c t ;
Expand All @@ -251,12 +249,12 @@ struct is_tensor
: std::bool_constant<
std::is_invocable_v<decltype(bra), T> &&
std::is_invocable_v<decltype(ket), T> &&
std::is_invocable_v<decltype(auxiliary), T> &&
std::is_invocable_v<decltype(aux), T> &&
std::is_invocable_v<decltype(braket), T> &&
std::is_invocable_v<decltype(indices), T> &&
std::is_invocable_v<decltype(bra_rank), T> &&
std::is_invocable_v<decltype(ket_rank), T> &&
std::is_invocable_v<decltype(auxiliary_rank), T> &&
std::is_invocable_v<decltype(aux_rank), T> &&
std::is_invocable_v<decltype(symmetry), T> &&
std::is_invocable_v<decltype(braket_symmetry), T> &&
std::is_invocable_v<decltype(particle_symmetry), T> &&
Expand Down
7 changes: 3 additions & 4 deletions SeQuant/core/eval_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ ExprPtr make_sum(EvalExpr const& left, EvalExpr const& right) noexcept {
auto ts = tensor_symmetry_sum(left, right);
auto ps = particle_symmetry(ts);
auto bks = get_default_context().braket_symmetry();
return ex<Tensor>(L"I", t1.bra(), t1.ket(), t1.auxiliary(), ts, bks, ps);
return ex<Tensor>(L"I", t1.bra(), t1.ket(), t1.aux(), ts, bks, ps);
}

ExprPtr make_prod(EvalExpr const& left, EvalExpr const& right) noexcept {
Expand Down Expand Up @@ -379,9 +379,8 @@ ExprPtr make_imed(EvalExpr const& left, EvalExpr const& right,

assert(op == EvalOp::Prod && "scalar + tensor not supported");
auto const& t = right.expr()->as<Tensor>();
return ex<Tensor>(Tensor{L"I", t.bra(), t.ket(), t.auxiliary(),
t.symmetry(), t.braket_symmetry(),
t.particle_symmetry()});
return ex<Tensor>(Tensor{L"I", t.bra(), t.ket(), t.aux(), t.symmetry(),
t.braket_symmetry(), t.particle_symmetry()});

} else if (lres == ResultType::Tensor && rres == ResultType::Scalar) {
// tensor (*) scalar
Expand Down
8 changes: 4 additions & 4 deletions SeQuant/core/export/itf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void one_electron_integral_remapper(

auto braIndices = tensor.bra();
auto ketIndices = tensor.ket();
assert(tensor.auxiliary().empty());
assert(tensor.aux().empty());

IndexTypeComparer cmp;

Expand All @@ -273,7 +273,7 @@ void one_electron_integral_remapper(
}

expr = ex<Tensor>(tensor.label(), std::move(braIndices),
std::move(ketIndices), tensor.auxiliary());
std::move(ketIndices), tensor.aux());
}

template <typename Container>
Expand Down Expand Up @@ -317,7 +317,7 @@ void two_electron_integral_remapper(
// Copy indices as we might have to mutate them
auto braIndices = tensor.bra();
auto ketIndices = tensor.ket();
assert(tensor.auxiliary().empty());
assert(tensor.aux().empty());

IndexTypeComparer cmp;

Expand Down Expand Up @@ -408,7 +408,7 @@ void two_electron_integral_remapper(
}

expr = ex<Tensor>(std::move(tensorLabel), std::move(braIndices),
std::move(ketIndices), tensor.auxiliary());
std::move(ketIndices), tensor.aux());
}

void integral_remapper(ExprPtr &expr, std::wstring_view oneElectronIntegralName,
Expand Down
8 changes: 3 additions & 5 deletions SeQuant/core/op.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ class NormalOperator : public Operator<S>,
ranges::views::transform(
[](auto &&op) -> const Index & { return op.index(); });
}
AbstractTensor::const_any_view_randsz _auxiliary() const override final {
AbstractTensor::const_any_view_randsz _aux() const override final {
return {};
}
AbstractTensor::const_any_view_rand _braket() const override final {
Expand All @@ -842,7 +842,7 @@ class NormalOperator : public Operator<S>,
}
std::size_t _bra_rank() const override final { return nannihilators(); }
std::size_t _ket_rank() const override final { return ncreators(); }
std::size_t _auxiliary_rank() const override final { return 0; }
std::size_t _aux_rank() const override final { return 0; }
Symmetry _symmetry() const override final {
return (S == Statistics::FermiDirac
? (get_default_context(S).spbasis() == SPBasis::spinorbital
Expand Down Expand Up @@ -890,9 +890,7 @@ class NormalOperator : public Operator<S>,
ranges::views::transform(
[](auto &&op) -> Index & { return op.index(); });
}
AbstractTensor::any_view_randsz _auxiliary_mutable() override final {
return {};
}
AbstractTensor::any_view_randsz _aux_mutable() override final { return {}; }
};

static_assert(
Expand Down
4 changes: 2 additions & 2 deletions SeQuant/core/parse/deparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ std::wstring deparse(Tensor const& tensor, bool annot_sym) {
if (tensor.ket_rank() > 0) {
deparsed += L";" + details::deparse_indices(tensor.ket());
}
if (tensor.auxiliary_rank() > 0) {
if (tensor.aux_rank() > 0) {
if (tensor.ket_rank() == 0) {
deparsed += L";";
}
deparsed += L";" + details::deparse_indices(tensor.auxiliary());
deparsed += L";" + details::deparse_indices(tensor.aux());
}
deparsed += L"}";

Expand Down
Loading

0 comments on commit 4f3cd68

Please sign in to comment.