Class AsyCost¶
Defined in File asy_cost.hpp
Nested Relationships¶
Nested Types¶
Class Documentation¶
-
class AsyCost¶
Represents a symbolic asymptotic cost as a polynomial in the sizes of index spaces. A cost is a sum of terms, each of which is a rational multiplier times a product of space sizes raised to non-negative integer powers. Spaces are identified by
IndexSpace;AsyCostorders and prints them usingIndexSpace’s own ordering andbase_key(), and never consults anIndexSpaceRegistry.Examples (with
I,Adenoting two index spaces):AsyCost({{I, 2}, {A, 4}})represents $I^2 A^4$.AsyCost({{I, 2}, {A, 4}}, rational{1, 2})halves the numeric value above when extents are substituted.
Public Types
-
using ExponentMap = container::map<IndexSpace, std::size_t>¶
-
using ExtentMap = container::map<IndexSpace, std::size_t>¶
Public Functions
-
AsyCost()¶
Default construct to zero cost.
-
explicit AsyCost(ExponentMap exponents, rational prefactor = 1)¶
- Parameters:
exponents – Map from index space to its exponent in this term. Zero exponents may be supplied; they are dropped.
prefactor – Rational multiplier; defaults to 1.
-
double ops(ExtentMap const &extents = {}) const¶
Substitute each space in this cost by an extent and evaluate.
- Parameters:
extents – Map from index space to extent (size). A space appearing in this cost but absent from
extentsfalls back to itsIndexSpace::approximate_size(). Defaults to empty, in which case every space uses itsapproximate_size().- Returns:
Numerical value of the cost.
-
std::wstring to_latex() const¶
- Returns:
A LaTeX rendering of the whole cost: its terms joined by
+, most expensive first. The zero cost renders as0.
-
std::string text() const¶
- Returns:
A plain-text rendering of the whole cost: its terms joined by
+, most expensive first. The zero cost renders as0.
Public Static Functions
Friends