einsums::compute_graph::outer_sum#
Note
Generated from the C++ headers by apiary --emit-cpp-docs-json.
Defined in header Einsums/ComputeGraph/Operations.hpp.
-
template<CoreBasicTensorConcept ResultType, CoreBasicTensorConcept VectorType>
requires std::is_same_v<typename ResultType::ValueType, typename VectorType::ValueType>
void outer_sum(ResultType *result, std::vector<const VectorType*> vectors, std::vector<double> coefficients)# Outer sum of N rank-1 vectors with per-axis coefficients.
Fills
resultwithresult(i_0, i_1, ..., i_{N-1}) = Σ_k coefficients[k] * vectors[k](i_k)Canonical use case is the MP2/CC energy denominator:
Δ(i,j,a,b) = ε_i + ε_j − ε_a − ε_b ↪ outer_sum(&Δ, {ε_occ, ε_occ, ε_virt, ε_virt}, {+1, +1, -1, -1})If
coefficientsis empty, defaults to all +1.Capture-aware: outside capture executes immediately; inside capture records a Custom node with each input vector and the result as dependencies.
result->rank()must equalvectors.size()andresult->dim(k)must equalvectors[k]->dim(0).