pepflow 0.1.2__tar.gz → 0.1.3a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {pepflow-0.1.2 → pepflow-0.1.3a1}/PKG-INFO +1 -1
  2. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/function.py +17 -0
  3. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/pep_context.py +6 -2
  4. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/point.py +11 -0
  5. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/scalar.py +11 -0
  6. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow.egg-info/PKG-INFO +1 -1
  7. {pepflow-0.1.2 → pepflow-0.1.3a1}/pyproject.toml +1 -1
  8. {pepflow-0.1.2 → pepflow-0.1.3a1}/LICENSE +0 -0
  9. {pepflow-0.1.2 → pepflow-0.1.3a1}/README.md +0 -0
  10. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/__init__.py +0 -0
  11. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/constants.py +0 -0
  12. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/constraint.py +0 -0
  13. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/expression_manager.py +0 -0
  14. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/function_test.py +0 -0
  15. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/interactive_constraint.py +0 -0
  16. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/pep.py +0 -0
  17. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/pep_context_test.py +0 -0
  18. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/pep_test.py +0 -0
  19. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/point_test.py +0 -0
  20. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/solver.py +0 -0
  21. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/solver_test.py +0 -0
  22. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow/utils.py +0 -0
  23. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow.egg-info/SOURCES.txt +0 -0
  24. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow.egg-info/dependency_links.txt +0 -0
  25. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow.egg-info/requires.txt +0 -0
  26. {pepflow-0.1.2 → pepflow-0.1.3a1}/pepflow.egg-info/top_level.txt +0 -0
  27. {pepflow-0.1.2 → pepflow-0.1.3a1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pepflow
3
- Version: 0.1.2
3
+ Version: 0.1.3a1
4
4
  Summary: PEPFlow: A framework for Performance Estimation Problem (PEP) Workflow
5
5
  Requires-Python: >=3.9
6
6
  Description-Content-Type: text/markdown
@@ -347,3 +347,20 @@ class SmoothConvexFunction(Function):
347
347
  self.smooth_convex_interpolability_constraints(i, j)
348
348
  )
349
349
  return interpolation_constraints
350
+
351
+ def interpolate_ineq(
352
+ self, p1_tag: str, p2_tag: str, pep_context: pc.PEPContext | None = None
353
+ ) -> pt.Scalar:
354
+ """Generate the interpolation inequality scalar by tags."""
355
+ if pep_context is None:
356
+ pep_context = pc.get_current_context()
357
+ if pep_context is None:
358
+ raise RuntimeError("Did you forget to specify a context?")
359
+ # TODO: we definitely need a more robust tag system
360
+ x1 = pep_context.get_by_tag(p1_tag)
361
+ x2 = pep_context.get_by_tag(p2_tag)
362
+ f1 = pep_context.get_by_tag(f"{self.tag}({p1_tag})")
363
+ f2 = pep_context.get_by_tag(f"{self.tag}({p2_tag})")
364
+ g1 = pep_context.get_by_tag(f"gradient_{self.tag}({p1_tag})")
365
+ g2 = pep_context.get_by_tag(f"gradient_{self.tag}({p2_tag})")
366
+ return f2 - f1 + g2 * (x1 - x2) + 1 / 2 * (g1 - g2) ** 2
@@ -52,6 +52,10 @@ class PEPContext:
52
52
  self.triplets: dict[Function, list[Triplet]] = defaultdict(list)
53
53
  self.opt_conditions: dict[Function, list[Constraint]] = defaultdict(list)
54
54
 
55
+ def set_as_current(self) -> PEPContext:
56
+ set_current_context(self)
57
+ return self
58
+
55
59
  def add_point(self, point: Point):
56
60
  self.points.append(point)
57
61
 
@@ -66,10 +70,10 @@ class PEPContext:
66
70
 
67
71
  def get_by_tag(self, tag: str) -> Point | Scalar:
68
72
  for p in self.points:
69
- if p.tag == tag:
73
+ if tag in p.tags:
70
74
  return p
71
75
  for s in self.scalars:
72
- if s.tag == tag:
76
+ if tag in s.tags:
73
77
  return s
74
78
  raise ValueError("Cannot find the point or scalar of given tag")
75
79
 
@@ -212,3 +212,14 @@ class Point:
212
212
  if not isinstance(other, Point):
213
213
  return NotImplemented
214
214
  return self.uid == other.uid
215
+
216
+ def eval(self, ctx: pc.PEPContext | None = None) -> np.ndarray:
217
+ from pepflow.expression_manager import ExpressionManager
218
+
219
+ # Note this can be inefficient.
220
+ if ctx is None:
221
+ ctx = pc.get_current_context()
222
+ if ctx is None:
223
+ raise RuntimeError("Did you forget to create a context?")
224
+ em = ExpressionManager(ctx)
225
+ return em.eval_point(self).vector
@@ -247,3 +247,14 @@ class Scalar:
247
247
 
248
248
  def eq(self, other, name: str) -> ctr.Constraint:
249
249
  return ctr.Constraint(self - other, comparator=utils.Comparator.EQ, name=name)
250
+
251
+ def eval(self, ctx: pc.PEPContext | None = None) -> EvaluatedScalar:
252
+ from pepflow.expression_manager import ExpressionManager
253
+
254
+ # Note this can be inefficient.
255
+ if ctx is None:
256
+ ctx = pc.get_current_context()
257
+ if ctx is None:
258
+ raise RuntimeError("Did you forget to create a context?")
259
+ em = ExpressionManager(ctx)
260
+ return em.eval_scalar(self)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pepflow
3
- Version: 0.1.2
3
+ Version: 0.1.3a1
4
4
  Summary: PEPFlow: A framework for Performance Estimation Problem (PEP) Workflow
5
5
  Requires-Python: >=3.9
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pepflow"
3
- version = "0.1.2"
3
+ version = "0.1.3a1"
4
4
  description = "PEPFlow: A framework for Performance Estimation Problem (PEP) Workflow"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.9"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes