Opened 9 months ago

Last modified 6 weeks ago

#27448 needs_work enhancement

compute normal vectors of surface faces of polyhedron

Reported by: dkrenn Owned by:
Priority: major Milestone: sage-8.9
Component: geometry Keywords:
Cc: Merged in:
Authors: Daniel Krenn Reviewers: Vincent Delecroix
Report Upstream: N/A Work issues:
Branch: u/dkrenn/surface-normal (Commits) Commit: 8f23aa949086e9cb358a2d50b67ad85f2efb7fdd
Dependencies: Stopgaps:

Description


Change History (26)

comment:1 Changed 9 months ago by dkrenn

  • Branch set to u/dkrenn/surface-normal

comment:2 Changed 9 months ago by dkrenn

  • Commit set to 297ff0033b0e6a568e50d9466ac4fccc2cd60805
  • Status changed from new to needs_review

New commits:

297ff00Trac #27448: compute normal vectors of face

comment:3 Changed 9 months ago by git

  • Commit changed from 297ff0033b0e6a568e50d9466ac4fccc2cd60805 to d0b6b79ae32affd6124af88e4a37ad0047f84713

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

d0b6b79Trac #27448: simplify methods and restrict to one algorithm for all

comment:4 follow-up: Changed 9 months ago by chapoton

    Invalid Python 3 syntax found:
    invalid syntax (face.py, line 587)

comment:5 Changed 9 months ago by git

  • Commit changed from d0b6b79ae32affd6124af88e4a37ad0047f84713 to acb48f667435c8e76cc82383da878b4f1ebfca3a

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

acb48f6Trac #27448: Py3 exception

comment:6 in reply to: ↑ 4 Changed 9 months ago by dkrenn

Replying to chapoton:

    Invalid Python 3 syntax found:
    invalid syntax (face.py, line 587)

Indeed, missed this one. Thanks, is now corrected.

comment:7 follow-up: Changed 9 months ago by chapoton

please add one example with vertices in AA

comment:8 follow-up: Changed 9 months ago by vdelecroix

Why is it cached!?

comment:9 follow-up: Changed 9 months ago by vdelecroix

  • Status changed from needs_review to needs_info

What is that intended for?

        if T.base_ring() in (AA, QQbar):
            def exactify(c):
                c.exactify()
                try:
                    return QQ(c)
                except (ValueError, TypeError):
                    return c
            T = T.apply_map(lambda c: exactify(c))

If it is of any use, it should be carefully explained in the code.

comment:10 follow-up: Changed 9 months ago by vdelecroix

Isn't it a big waste to compute the matrix T each time you ask for a normal vector. Wouldn't it make more sense to compute it once and for all?

comment:11 follow-up: Changed 9 months ago by vdelecroix

Documentation must include examples with unbounded faces. Especially the degenerate case where the polyhedron is a vector space.

comment:12 Changed 9 months ago by embray

  • Milestone changed from sage-8.7 to sage-8.8

Ticket retargeted after milestone closed (if you don't believe this ticket is appropriate for the Sage 8.8 release please retarget manually)

comment:13 Changed 8 months ago by git

  • Commit changed from acb48f667435c8e76cc82383da878b4f1ebfca3a to 8f23aa949086e9cb358a2d50b67ad85f2efb7fdd

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

4b7a774Trac #27448: cache matrix
53e3b14Trac #27448: refactor imports
82e7613Trac #27448: more careful use of exactify
0c359ceTrac #27448: move more code around (fixup caching)
919bebfTrac #27448: explain purpose of exactify-code
769ba63Trac #27448 doctest for unbounded polyhedron
8f23aa9Trac #27448: doctest for polyhedron with vertices in AA

comment:14 in reply to: ↑ 7 Changed 8 months ago by dkrenn

Replying to chapoton:

please add one example with vertices in AA

Done in
8f23aa9Trac #27448: doctest for polyhedron with vertices in AA

comment:15 in reply to: ↑ 8 Changed 8 months ago by dkrenn

Replying to vdelecroix:

Why is it cached!?

Because for my computation (related to #27447) it reduced the computation time by a factor 7 or 8.

comment:16 in reply to: ↑ 9 Changed 8 months ago by dkrenn

Replying to vdelecroix:

What is that intended for?

        if T.base_ring() in (AA, QQbar):
            def exactify(c):
                c.exactify()
                try:
                    return QQ(c)
                except (ValueError, TypeError):
                    return c
            T = T.apply_map(lambda c: exactify(c))

If it is of any use, it should be carefully explained in the code.

Code commented in
919bebfTrac #27448: explain purpose of exactify-code

comment:17 in reply to: ↑ 10 Changed 8 months ago by dkrenn

Replying to vdelecroix:

Isn't it a big waste to compute the matrix T each time you ask for a normal vector. Wouldn't it make more sense to compute it once and for all?

Indeed. Done in
4b7a774Trac #27448: cache matrix

but also see the other commits (some more changes were done).

comment:18 in reply to: ↑ 11 Changed 8 months ago by dkrenn

Replying to vdelecroix:

Documentation must include examples with unbounded faces. Especially the degenerate case where the polyhedron is a vector space.

Done in
769ba63Trac #27448 doctest for unbounded polyhedron

comment:19 Changed 8 months ago by dkrenn

  • Status changed from needs_info to needs_review

comment:20 Changed 8 months ago by dkrenn

All comments are incorporated, so please review again.

comment:21 Changed 8 months ago by vdelecroix

I don't understand something. According to the comment When the polyhedron is rational, ... We correct this below. the following should not fail

c.exactify()
try:
    return QQ(c)

comment:22 Changed 8 months ago by vdelecroix

There is no example of polyhedra defined over a number field such as QuadraticField(2) or NumberField(x^3 - 2, 'a', embedding=AA(2)^(1/3)).

comment:23 Changed 8 months ago by vdelecroix

If the matrix T is supposed to belong to the ground field, isn't there a more direct way to compute it wihtout going through A that might involve a lot of different square roots?

comment:24 Changed 8 months ago by vdelecroix

  • Reviewers set to Vincent Delecroix
  • Status changed from needs_review to needs_work

comment:25 Changed 6 months ago by embray

  • Milestone changed from sage-8.8 to sage-8.9

Tickets still needing working or clarification should be moved to the next release milestone at the soonest (please feel free to revert if you think the ticket is close to being resolved).

comment:26 Changed 6 weeks ago by jipilab

Please have a look at the related #17215.

Also, it seems that in the doctests, the older version of the repr for faces is used... This should be updated.

Note: See TracTickets for help on using tickets.