Repository navigation
Commit 4fe925d
authored
Return 0.0 for degenerate input in simplex_volume_in_embedding (#15)
The reference implementation treats a Cayley-Menger squared volume within
rounding noise of zero (> -1e-15) as a degenerate input with volume 0.0 and
only raises below that; this implementation raised for anything <= 0.
adaptive's curvature losses feed collinear/coplanar vertices whenever the
sampled function is locally flat, so with adaptive >= 1.5 auto-selecting
this backend, LearnerND runs with curvature_loss_function crashed where the
pure-Python backend returned a zero loss (7 known test failures noted in
adaptive#493).
- the general Cayley-Menger path now returns 0.0 in the reference's
(-EMBEDDED_VOLUME_SQ_EPS, 0] band and raises only below it
- 3 vertices in a >2D embedding use the Cayley-Menger form expanded in
squared distances instead of root-based Heron, so rounding near zero
behaves like the reference's numeric determinant and the same band
applies; in 2D the reference's Heron path (which raises on any negative
product) is mirrored unchanged
- 2 coincident vertices in a >2D embedding are a zero-length segment, like
the reference's Cayley-Menger path (2D keeps raising, as the reference
does for any 2-vertex input)
With this fix the full adaptive 1.5.0 test suite passes with the Rust
backend active (283 passed; previously 7 curvature-loss failures plus
test_learnernd_with_neighbor_aware_loss_runs in this repo), clearing the
way for adaptive to bump _MIN_RUST_VERSION and add a Rust-backend CI job.1 parent a8a02a4 commit 4fe925d
3 files changed
Lines changed: 138 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
622 | 622 | | |
623 | 623 | | |
624 | 624 | | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
625 | 633 | | |
626 | 634 | | |
627 | | - | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
628 | 638 | | |
629 | 639 | | |
630 | 640 | | |
631 | 641 | | |
632 | 642 | | |
633 | 643 | | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
640 | 658 | | |
641 | 659 | | |
642 | | - | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
643 | 674 | | |
644 | 675 | | |
645 | 676 | | |
| |||
660 | 691 | | |
661 | 692 | | |
662 | 693 | | |
663 | | - | |
664 | | - | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
665 | 699 | | |
666 | | - | |
| 700 | + | |
667 | 701 | | |
668 | 702 | | |
669 | 703 | | |
| |||
691 | 725 | | |
692 | 726 | | |
693 | 727 | | |
694 | | - | |
| 728 | + | |
695 | 729 | | |
696 | 730 | | |
697 | 731 | | |
698 | 732 | | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
699 | 772 | | |
700 | 773 | | |
701 | 774 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
777 | 777 | | |
778 | 778 | | |
779 | 779 | | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
780 | 819 | | |
781 | 820 | | |
782 | 821 | | |
| |||
0 commit comments