Opened 8 years ago

Closed 8 years ago

#17198 closed enhancement (fixed)

Accept several arguments in RealIntervalFieldElement.min and RealIntervalFieldElement.max

Reported by: Clemens Heuberger Owned by:
Priority: major Milestone: sage-6.4
Component: numerical Keywords: RIF
Cc: Sara Kropf Merged in:
Authors: Clemens Heuberger Reviewers: Daniel Krenn
Report Upstream: N/A Work issues:
Branch: 27080b5 (Commits, GitHub, GitLab) Commit: 27080b5dc54b5b4183f4ebe947b21efd45416ebf
Dependencies: Stopgaps:

Status badges

Description (last modified by Clemens Heuberger)

Python's min and max are not suitable for RealIntervalFieldElement, as those are not linearly ordered; the existing methods RealIntervalFieldElement.min and RealIntervalFieldElement.max only compute the minimum or maximum of self and other.

This ticket rewrites the methods RealIntervalFieldElement.min and RealIntervalFieldElement.max to accept an arbitrary number of arguments.

Change History (9)

comment:1 Changed 8 years ago by Clemens Heuberger

Branch: u/cheuberg/rings/RIF-min-max

comment:2 Changed 8 years ago by Clemens Heuberger

Commit: c8f852352d100f04f6c1a489d8fc7ec185ca4dee
Status: newneeds_review

New commits:

c8f8523Trac #17198: New functions max_RIF and min_RIF

comment:3 Changed 8 years ago by Jeroen Demeyer

I think it would be more useful to have these as methods on RIF elements.

comment:4 Changed 8 years ago by Clemens Heuberger

My reasoning for having it as a function as opposed to methods on RIF elements where:

  1. There are methods .min and .max performing the operation for the minimum and maximum of two elements
  2. I think that the functions as proposed here are easier to use, e.g., the infinity norm of a vector of real intervals could simply be written as max_RIF(abs(r) for r in v).

Therefore, I felt that having those as functions in the module real_mpfi (and not importing those in the global name space) is appropriate.

comment:5 Changed 8 years ago by git

Commit: c8f852352d100f04f6c1a489d8fc7ec185ca4dee27080b5dc54b5b4183f4ebe947b21efd45416ebf

Branch pushed to git repo; I updated commit sha1. New commits:

27080b5Trac #17198: Rewrote methods .min and .max to handle more than two elements

comment:6 in reply to:  3 Changed 8 years ago by Clemens Heuberger

Description: modified (diff)
Summary: New functions max_RIF and min_RIFAccept several arguments in RealIntervalFieldElement.min and RealIntervalFieldElement.max

Replying to jdemeyer:

I think it would be more useful to have these as methods on RIF elements.

I now rewrote the original methods of RealIntervalField to achieve what I intended with the functions.

comment:7 Changed 8 years ago by Daniel Krenn

Reviewers: Daniel Krenn

Looks good. Merges cleanly on 6.5.rc0. I'm still waiting for "make ptestlong" to finish...

comment:8 Changed 8 years ago by Daniel Krenn

Status: needs_reviewpositive_review

comment:9 Changed 8 years ago by Volker Braun

Branch: u/cheuberg/rings/RIF-min-max27080b5dc54b5b4183f4ebe947b21efd45416ebf
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.