MCPcopy Create free account
hub / github.com/cvxpy/cvxpy / _aggregate_metrics

Method _aggregate_metrics

cvxpy/problems/problem.py:194–212  ·  view source on GitHub ↗

Aggregates and caches metrics for expression trees in self.args. So far metrics include the maximum dimensionality ('max_ndim') and whether all sub-expressions support C++ ('all_support_cpp').

(self)

Source from the content-addressed store, hash-verified

192
193 @perf.compute_once
194 def _aggregate_metrics(self) -> dict:
195 """
196 Aggregates and caches metrics for expression trees in self.args. So far
197 metrics include the maximum dimensionality ('max_ndim') and whether
198 all sub-expressions support C++ ('all_support_cpp').
199
200 """
201 max_ndim = self.ndim
202 cpp_support = self._supports_cpp()
203
204 for arg in [self._objective] + self._constraints:
205 max_ndim = max(max_ndim, arg._max_ndim())
206 cpp_support = cpp_support and arg._all_support_cpp()
207
208 metrics = {
209 "max_ndim": max_ndim,
210 "all_support_cpp": cpp_support
211 }
212 return metrics
213
214 @property
215 def value(self):

Callers

nothing calls this directly

Calls 4

_supports_cppMethod · 0.95
_all_support_cppMethod · 0.80
maxClass · 0.50
_max_ndimMethod · 0.45

Tested by

no test coverage detected