Skip to content

Conversation

@liblaf
Copy link
Contributor

@liblaf liblaf bot commented Sep 2, 2025

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ BASH shellcheck 1 0 0 0.02s
✅ BASH shfmt 1 0 0 0 0.05s
⚠️ COPYPASTE jscpd yes 89 no 3.84s
⚠️ JSON jsonlint 9 1 0 0.16s
✅ JSON prettier 9 0 0 0 0.37s
✅ JSON v8r 9 0 0 4.86s
⚠️ MARKDOWN markdownlint 5 2 35 0 0.92s
⚠️ PYTHON ruff yes yes 1 no 0.45s
⚠️ SPELL cspell 205 2 0 5.57s
✅ YAML prettier 4 0 0 0 0.43s
✅ YAML v8r 4 0 0 5.13s
✅ YAML yamllint 4 0 0 0.36s

Detailed Issues

⚠️ SPELL / cspell - 2 errors
.gitignore:203:3     - Unknown word (pvsm)       -- *.pvsm
	 Suggestions: [ppsm, poms, pms, vps, palm]
docs/design.md:12:169    - Unknown word (roboticists) -- specifically targeting roboticists and simulation researchers
	 Suggestions: [roboticist, robotics's, robotics, robotisms]
CSpell: Files checked: 202, Issues found: 2 in 2 files.


You can skip this misspellings by defining the following .cspell.json file at the root of your repository
Of course, please correct real typos before :)

{
    "version": "0.2",
    "language": "en",
    "ignorePaths": [
        "**/node_modules/**",
        "**/vscode-extension/**",
        "**/.git/**",
        "**/.pnpm-lock.json",
        ".vscode",
        "package-lock.json",
        "megalinter-reports"
    ],
    "words": [
        "pvsm",
        "roboticists"
    ]
}


You can also copy-paste megalinter-reports/LINTER_DEFAULT at the root of your repository
⚠️ COPYPASTE / jscpd - 89 errors
Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [76:2 - 81:5] (5 lines, 93 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [32:6 - 37:4]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [77:6 - 82:10] (5 lines, 89 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [61:10 - 66:10]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/kernel.py [33:49 - 39:4] (6 lines, 73 tokens)
   src/liblaf/apple/energy/elastic/phace_active/kernel.py [13:35 - 19:4]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/kernel.py [80:6 - 86:10] (6 lines, 74 tokens)
   src/liblaf/apple/energy/elastic/phace_active/kernel.py [56:6 - 62:10]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/kernel.py [86:10 - 95:10] (9 lines, 81 tokens)
   src/liblaf/apple/energy/elastic/phace_active/kernel.py [19:4 - 28:4]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/func.py [67:1 - 82:43] (15 lines, 147 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/func.py [43:1 - 58:44]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/func.py [84:1 - 97:9] (13 lines, 211 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/func.py [60:1 - 73:9]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [14:13 - 38:35] (24 lines, 273 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [14:8 - 38:36]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [40:9 - 53:49] (13 lines, 171 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [38:3 - 51:50]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [55:9 - 69:45] (14 lines, 196 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [53:9 - 67:46]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [71:9 - 85:45] (14 lines, 202 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [69:9 - 83:46]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap_active/func.py [80:6 - 87:8] (7 lines, 85 tokens)
   src/liblaf/apple/energy/elastic/arap_active/func.py [56:6 - 63:8]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap_active/_arap_active.py [29:5 - 41:34] (12 lines, 156 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [26:9 - 38:36]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap_active/_arap_active.py [42:11 - 56:48] (14 lines, 183 tokens)
   src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [39:8 - 51:50]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap_active/_arap_active.py [57:11 - 68:10] (11 lines, 114 tokens)
   src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [54:8 - 63:2]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap_active/_arap_active.py [74:11 - 89:44] (15 lines, 214 tokens)
   src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [70:8 - 83:46]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap/func.py [35:5 - 41:7] (6 lines, 131 tokens)
   src/liblaf/apple/energy/elastic/arap_active/func.py [60:5 - 66:17]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap/func.py [49:5 - 55:7] (6 lines, 139 tokens)
   src/liblaf/apple/energy/elastic/arap_active/func.py [84:5 - 90:17]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap/_arap.py [22:5 - 33:27] (11 lines, 143 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [27:18 - 38:36]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap/_arap.py [33:2 - 46:41] (13 lines, 176 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [38:8 - 51:50]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap/_arap.py [46:2 - 61:37] (15 lines, 215 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [52:8 - 67:46]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap/_arap.py [61:5 - 75:37] (14 lines, 202 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [69:9 - 83:46]

Clone found (python):
 - src/liblaf/apple/energy/collision/vert_face/kernel.py [124:38 - 132:4] (8 lines, 94 tokens)
   src/liblaf/apple/energy/collision/vert_face/kernel.py [79:38 - 87:7]

Clone found (python):
 - src/liblaf/apple/energy/collision/vert_face/kernel.py [173:44 - 181:10] (8 lines, 94 tokens)
   src/liblaf/apple/energy/collision/vert_face/kernel.py [79:38 - 87:7]

Clone found (python):
 - src/liblaf/apple/energy/collision/vert_face/kernel.py [226:2 - 233:10] (7 lines, 90 tokens)
   src/liblaf/apple/energy/collision/vert_face/kernel.py [80:7 - 87:7]

Clone found (python):
 - exp/2025/04/30/fat-muscle/src/20-simulate.py [17:5 - 30:6] (13 lines, 138 tokens)
   exp/2025/04/30/human-head/src/10-simulate.py [18:5 - 31:8]

Clone found (python):
 - exp/2025/04/30/fat-muscle/src/20-simulate.py [48:2 - 58:6] (10 lines, 136 tokens)
   exp/2025/04/30/human-head/src/10-simulate.py [47:2 - 57:8]

Clone found (python):
 - exp/2025/04/30/fat-muscle/src/20-simulate.py [59:6 - 72:3] (13 lines, 109 tokens)
   exp/2025/04/30/human-head/src/10-simulate.py [58:8 - 71:4]

Clone found (python):
 - exp/2025/04/30/cubic/src/10-gen.py [21:4 - 44:4] (23 lines, 196 tokens)
   exp/2025/04/30/human-head/src/10-simulate.py [24:7 - 46:9]

Clone found (python):
 - exp/2025/04/30/cubic/src/10-gen.py [44:2 - 71:2] (27 lines, 305 tokens)
   exp/2025/04/30/fat-muscle/src/20-simulate.py [46:3 - 73:2]

Clone found (python):
 - src/liblaf/apple/struct/dictutils/_array_dict.py [21:14 - 30:5] (9 lines, 123 tokens)
   src/liblaf/apple/struct/dictutils/_node_container.py [14:8 - 24:5]

Clone found (python):
 - src/liblaf/apple/struct/dictutils/_array_dict.py [42:6 - 58:44] (16 lines, 124 tokens)
   src/liblaf/apple/struct/dictutils/_node_container.py [36:4 - 52:40]

Clone found (python):
 - src/liblaf/apple/func/elastic/phace_static.py [69:1 - 76:30] (7 lines, 99 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/func.py [60:1 - 67:6]

Clone found (python):
 - src/liblaf/apple/func/elastic/phace_static.py [76:30 - 82:9] (6 lines, 109 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/func.py [67:35 - 73:9]

Clone found (python):
 - src/liblaf/apple/func/elastic/arap.py [34:30 - 46:30] (12 lines, 179 tokens)
   src/liblaf/apple/energy/elastic/arap/func.py [34:35 - 46:35]

Clone found (python):
 - src/liblaf/apple/func/elastic/arap.py [46:30 - 53:2] (7 lines, 181 tokens)
   src/liblaf/apple/energy/elastic/arap/func.py [46:35 - 55:2]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [13:5 - 34:25] (21 lines, 187 tokens)
   src/liblaf/apple/energy/elastic/arap/_arap.py [12:5 - 38:7]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [34:25 - 47:39] (13 lines, 176 tokens)
   src/liblaf/apple/energy/elastic/arap/_arap.py [33:27 - 51:7]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [47:39 - 62:35] (15 lines, 215 tokens)
   src/liblaf/apple/energy/elastic/arap/_arap.py [46:41 - 67:7]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [62:35 - 76:35] (14 lines, 210 tokens)
   src/liblaf/apple/energy/elastic/arap/_arap.py [61:37 - 83:7]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [94:39 - 100:8] (6 lines, 73 tokens)
   src/liblaf/apple/energy/elastic/arap/kernel.py [22:41 - 28:39]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [105:35 - 112:8] (7 lines, 87 tokens)
   src/liblaf/apple/energy/elastic/arap/kernel.py [33:37 - 40:35]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [119:35 - 127:8] (8 lines, 101 tokens)
   src/liblaf/apple/energy/elastic/arap/kernel.py [47:37 - 55:35]

Clone found (python):
 - src/liblaf/apple/optim/_minimize.py [14:5 - 25:3] (11 lines, 136 tokens)
   src/liblaf/apple/optim/optimizer.py [36:2 - 47:8]

Clone found (python):
 - src/liblaf/apple/energy/zero.py [44:10 - 53:10] (9 lines, 97 tokens)
   src/liblaf/apple/energy/zero.py [37:4 - 44:10]

Clone found (python):
 - examples/dynamics/collision/collision-bunny-bunny/main.py [1:1 - 14:5] (13 lines, 115 tokens)
   examples/dynamics/collision/collision-bunny-sphere/main.py [1:1 - 14:4]

Clone found (python):
 - examples/dynamics/collision/collision-bunny-bunny/main.py [22:5 - 84:78] (62 lines, 768 tokens)
   examples/dynamics/collision/collision-bunny-sphere/main.py [22:5 - 84:8]

Clone found (python):
 - examples/dynamics/collision/collision-bunny-bunny/main.py [87:5 - 114:2] (27 lines, 319 tokens)
   examples/dynamics/collision/collision-bunny-sphere/main.py [84:4 - 111:2]

Clone found (python):
 - examples/dynamics/collision/collision-bunny/main.py [21:5 - 35:7] (14 lines, 116 tokens)
   examples/dynamics/collision/collision-bunny-bunny/main.py [17:5 - 31:4]

Clone found (python):
 - examples/dynamics/collision/collision-bunny/main.py [58:1 - 67:4] (9 lines, 151 tokens)
   examples/dynamics/collision/collision-bunny-sphere/main.py [31:1 - 40:3]

Clone found (python):
 - examples/dynamics/collision/collision-bunny/main.py [67:3 - 77:9] (10 lines, 124 tokens)
   examples/dynamics/collision/collision-bunny-sphere/main.py [40:3 - 49:6]

Clone found (python):
 - examples/dynamics/collision/collision-bunny/main.py [81:9 - 88:5] (7 lines, 101 tokens)
   examples/dynamics/collision/collision-bunny-sphere/main.py [52:9 - 59:7]

Clone found (python):
 - examples/dynamics/collision/collision-bunny/main.py [90:4 - 100:5] (10 lines, 128 tokens)
   examples/dynamics/collision/collision-bunny-sphere/main.py [58:2 - 68:4]

Clone found (python):
 - examples/dynamics/collision/collision-bunny/main.py [100:2 - 116:4] (16 lines, 181 tokens)
   examples/dynamics/collision/collision-bunny-sphere/main.py [68:2 - 84:10]

Clone found (python):
 - examples/dynamics/collision/collision-bunny/main.py [116:6 - 132:5] (16 lines, 200 tokens)
   examples/dynamics/collision/collision-bunny-sphere/main.py [87:5 - 103:13]

Clone found (python):
 - examples/dynamics/collision/collision-box/main.py [1:1 - 50:5] (49 lines, 490 tokens)
   examples/dynamics/collision/collision-bunny/main.py [1:1 - 50:3]

Clone found (python):
 - examples/dynamics/collision/collision-box/main.py [52:9 - 79:28] (27 lines, 359 tokens)
   examples/dynamics/collision/collision-bunny/main.py [54:2 - 81:3]

Clone found (python):
 - examples/dynamics/collision/collision-box/main.py [78:9 - 96:75] (18 lines, 224 tokens)
   examples/dynamics/collision/collision-bunny-sphere/main.py [49:10 - 96:8]

Clone found (python):
 - examples/dynamics/collision/collision-box/main.py [104:5 - 142:10] (38 lines, 481 tokens)
   examples/dynamics/collision/collision-bunny/main.py [97:8 - 105:12]

Clone found (python):
 - examples/phace/wind/main.py [126:5 - 136:6] (10 lines, 141 tokens)
   examples/dynamics/collision/inter-collision/main.py [132:2 - 142:7]

Clone found (python):
 - examples/phace/wind/main.py [139:9 - 152:2] (13 lines, 156 tokens)
   examples/dynamics/collision/inter-collision/main.py [142:9 - 155:2]

Clone found (python):
 - examples/phace/open-mouth/main.py [9:1 - 19:9] (10 lines, 102 tokens)
   examples/phace/wind/main.py [8:1 - 18:8]

Clone found (python):
 - examples/phace/open-mouth/main.py [24:5 - 36:10] (12 lines, 96 tokens)
   examples/dynamics/collision/collision-bunny-bunny/main.py [19:5 - 31:5]

Clone found (python):
 - examples/phace/open-mouth/main.py [25:2 - 55:8] (30 lines, 317 tokens)
   examples/phace/wind/main.py [30:2 - 60:11]

Clone found (python):
 - examples/phace/open-mouth/main.py [95:2 - 105:17] (10 lines, 145 tokens)
   examples/dynamics/collision/inter-collision/main.py [132:2 - 136:22]

Clone found (python):
 - examples/phace/open-mouth/main.py [105:2 - 119:7] (14 lines, 153 tokens)
   examples/phace/wind/main.py [138:9 - 155:5]

Clone found (python):
 - examples/phace/grin/main.py [1:1 - 12:6] (11 lines, 103 tokens)
   examples/phace/wind/main.py [1:1 - 12:7]

Clone found (python):
 - examples/phace/grin/main.py [19:5 - 36:8] (17 lines, 144 tokens)
   examples/phace/open-mouth/main.py [20:5 - 42:8]

Clone found (python):
 - examples/phace/dynamics/main.py [1:1 - 14:29] (13 lines, 106 tokens)
   examples/phace/wind/main.py [1:1 - 15:6]

Clone found (python):
 - examples/phace/dynamics/main.py [35:5 - 53:14] (18 lines, 166 tokens)
   examples/phace/wind/main.py [32:5 - 44:21]

Clone found (python):
 - examples/phace/dynamics/main.py [53:14 - 66:2] (13 lines, 146 tokens)
   examples/phace/grin/main.py [44:21 - 56:2]

Clone found (python):
 - examples/phace/dynamics/main.py [90:10 - 97:2] (7 lines, 79 tokens)
   examples/phace/grin/main.py [90:6 - 97:2]

Clone found (python):
 - examples/phace/dynamics/main.py [107:5 - 117:5] (10 lines, 139 tokens)
   examples/phace/grin/main.py [101:5 - 111:18]

Clone found (python):
 - examples/phace/dynamics/main.py [118:5 - 126:15] (8 lines, 101 tokens)
   examples/phace/grin/main.py [112:18 - 120:13]

Clone found (python):
 - examples/phace/collide-ball/main.py [9:1 - 18:4] (9 lines, 95 tokens)
   examples/phace/wind/main.py [9:1 - 19:4]

Clone found (python):
 - examples/phace/collide-ball/main.py [12:7 - 35:6] (23 lines, 197 tokens)
   examples/phace/grin/main.py [12:4 - 41:13]

Clone found (python):
 - examples/phace/collide-ball/main.py [35:6 - 42:13] (7 lines, 122 tokens)
   examples/phace/wind/main.py [41:13 - 48:11]

Clone found (python):
 - examples/phace/close-mouth/main.py [1:1 - 22:8] (21 lines, 180 tokens)
   examples/phace/open-mouth/main.py [1:1 - 21:6]

Clone found (python):
 - examples/phace/close-mouth/main.py [29:5 - 57:8] (28 lines, 313 tokens)
   examples/phace/wind/main.py [32:5 - 60:11]

Clone found (python):
 - examples/phace/close-mouth/main.py [101:5 - 140:17] (39 lines, 452 tokens)
   examples/phace/open-mouth/main.py [55:5 - 124:5]

Clone found (python):
 - examples/phace/close-mouth/main.py [140:5 - 165:2] (25 lines, 353 tokens)
   examples/phace/open-mouth/main.py [94:5 - 155:2]

Clone found (python):
 - examples/dynamics/free-falling/main.py [25:2 - 58:4] (33 lines, 360 tokens)
   examples/dynamics/collision/collision-bunny/main.py [24:2 - 57:7]

Clone found (python):
 - examples/dynamics/free-falling/main.py [78:5 - 84:3] (6 lines, 86 tokens)
   examples/dynamics/collision/collision-bunny/main.py [75:5 - 81:3]

Clone found (python):
 - examples/dynamics/free-falling/main.py [137:5 - 151:10] (14 lines, 138 tokens)
   examples/dynamics/collision/collision-bunny-sphere/main.py [69:5 - 83:10]

Clone found (python):
 - examples/static/stretch.py [12:5 - 19:2] (7 lines, 107 tokens)
   examples/static/random/main.py [19:5 - 25:3]

Clone found (python):
 - examples/static/stretch.py [28:9 - 39:3] (11 lines, 124 tokens)
   examples/static/random/main.py [40:9 - 51:8]

Clone found (python):
 - examples/static/stretch.py [49:1 - 54:6] (5 lines, 83 tokens)
   examples/static/random/main.py [60:17 - 65:6]

Clone found (python):
 - examples/static/stretch.py [67:5 - 77:10] (10 lines, 115 tokens)
   examples/static/random/main.py [73:5 - 83:6]

Clone found (python):
 - marimo/gradients.py [1:1 - 16:7] (15 lines, 90 tokens)
   marimo/hess-quad.py [1:1 - 16:2]

┌────────┬────────────────┬─────────────┬──────────────┬──────────────┬──────────────────┬───────────────────┐
│ Format │ Files analyzed │ Total lines │ Total tokens │ Clones found │ Duplicated lines │ Duplicated tokens │
├────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ python │ 141            │ 8838        │ 91800        │ 89           │ 1283 (14.52%)    │ 15293 (16.66%)    │
├────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ bash   │ 11             │ 231         │ 1513         │ 0            │ 0 (0%)           │ 0 (0%)            │
├────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ Total: │ 152            │ 9069        │ 93313        │ 89           │ 1283 (14.15%)    │ 15293 (16.39%)    │
└────────┴────────────────┴─────────────┴──────────────┴──────────────┴──────────────────┴───────────────────┘
Found 89 clones.
HTML report saved to megalinter-reports/copy-paste/html/
ERROR: jscpd found too many duplicates (14.15%) over threshold (0%)
Error: ERROR: jscpd found too many duplicates (14.15%) over threshold (0%)
    at ThresholdReporter.report (/node-deps/node_modules/@jscpd/finder/dist/index.js:612:13)
    at /node-deps/node_modules/@jscpd/finder/dist/index.js:110:18
    at Array.forEach (<anonymous>)
    at /node-deps/node_modules/@jscpd/finder/dist/index.js:109:22
    at async /node-deps/node_modules/jscpd/dist/jscpd.js:351:5
⚠️ JSON / jsonlint - 1 error
File: pyrightconfig.json
Parse error on line 17, column 4:
...": "information"  // "reportAttributeAc...
----------------------^
Unexpected token "/"
⚠️ MARKDOWN / markdownlint - 35 errors
CHANGELOG.md:29 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:40 MD024/no-duplicate-heading Multiple headings with the same content [Context: "💥 BREAKING CHANGES"]
CHANGELOG.md:44 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:50 MD024/no-duplicate-heading Multiple headings with the same content [Context: "💥 BREAKING CHANGES"]
CHANGELOG.md:75 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:96 MD024/no-duplicate-heading Multiple headings with the same content [Context: "⬆️ Dependencies"]
CHANGELOG.md:101 MD024/no-duplicate-heading Multiple headings with the same content [Context: "♻ Code Refactoring"]
CHANGELOG.md:118 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:125 MD024/no-duplicate-heading Multiple headings with the same content [Context: "⬆️ Dependencies"]
CHANGELOG.md:131 MD024/no-duplicate-heading Multiple headings with the same content [Context: "♻ Code Refactoring"]
CHANGELOG.md:138 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:142 MD024/no-duplicate-heading Multiple headings with the same content [Context: "⬆️ Dependencies"]
CHANGELOG.md:147 MD024/no-duplicate-heading Multiple headings with the same content [Context: "♻ Code Refactoring"]
CHANGELOG.md:154 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:159 MD024/no-duplicate-heading Multiple headings with the same content [Context: "⬆️ Dependencies"]
CHANGELOG.md:163 MD024/no-duplicate-heading Multiple headings with the same content [Context: "♻ Code Refactoring"]
CHANGELOG.md:171 MD024/no-duplicate-heading Multiple headings with the same content [Context: "❤️ New Contributors"]
CHANGELOG.md:178 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:182 MD024/no-duplicate-heading Multiple headings with the same content [Context: "👷 Build System"]
CHANGELOG.md:186 MD024/no-duplicate-heading Multiple headings with the same content [Context: "❤️ New Contributors"]
docs/denotation.md:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## Denotation"]
docs/README.md:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "{% include "../README.md" %}"]
README.md:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "<div align="center" markdown><..."]
README.md:3:1 MD045/no-alt-text Images should have alternate text (alt text)
README.md:4:1 MD045/no-alt-text Images should have alternate text (alt text)
README.md:5:1 MD045/no-alt-text Images should have alternate text (alt text)
README.md:26:1 MD045/no-alt-text Images should have alternate text (alt text)
README.md:36:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:50:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:58:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:70:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:78:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:80:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:84:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:100:2 MD045/no-alt-text Images should have alternate text (alt text)
⚠️ PYTHON / ruff - 1 error
F841 Local variable `lip_bottom_pv` is assigned to but never used
  --> examples/phace/close-mouth/main.py:62:5
   |
60 |         surface_pv.point_data["is-lip-top"], adjacent_cells=False
61 |     ).extract_surface()
62 |     lip_bottom_pv: pv.PolyData = surface_pv.extract_points(
   |     ^^^^^^^^^^^^^
63 |         surface_pv.point_data["is-lip-bottom"], adjacent_cells=False
64 |     ).extract_surface()
   |
help: Remove assignment to unused variable `lip_bottom_pv`

Found 1 error.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).

See detailed reports in MegaLinter artifacts

MegaLinter is graciously provided by OX Security

@liblaf liblaf bot added autofix Apply linters automatic fixes. automerge Merge the pull request once unit tests and other checks pass. labels Sep 2, 2025
@liblaf liblaf bot assigned liblaf Sep 2, 2025
@liblaf liblaf bot requested a review from liblaf September 2, 2025 11:21
@liblaf
Copy link
Contributor Author

liblaf bot commented Sep 2, 2025

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ BASH shellcheck 1 0 0 0.02s
✅ BASH shfmt 1 0 0 0 0.03s
⚠️ COPYPASTE jscpd yes 89 no 4.01s
⚠️ JSON jsonlint 9 1 0 0.16s
✅ JSON prettier 9 0 0 0 0.39s
✅ JSON v8r 9 0 0 4.87s
⚠️ MARKDOWN markdownlint 5 0 35 0 1.05s
⚠️ PYTHON ruff yes yes 1 no 0.35s
⚠️ SPELL cspell 204 2 0 5.67s
✅ YAML prettier 3 0 0 0 0.37s
✅ YAML v8r 3 0 0 4.82s
✅ YAML yamllint 3 0 0 0.37s

Detailed Issues

⚠️ SPELL / cspell - 2 errors
.gitignore:203:3     - Unknown word (pvsm)       -- *.pvsm
	 Suggestions: [ppsm, poms, pms, vps, palm]
docs/design.md:12:169    - Unknown word (roboticists) -- specifically targeting roboticists and simulation researchers
	 Suggestions: [roboticist, robotics's, robotics, robotisms]
CSpell: Files checked: 201, Issues found: 2 in 2 files.


You can skip this misspellings by defining the following .cspell.json file at the root of your repository
Of course, please correct real typos before :)

{
    "version": "0.2",
    "language": "en",
    "ignorePaths": [
        "**/node_modules/**",
        "**/vscode-extension/**",
        "**/.git/**",
        "**/.pnpm-lock.json",
        ".vscode",
        "package-lock.json",
        "megalinter-reports"
    ],
    "words": [
        "pvsm",
        "roboticists"
    ]
}


You can also copy-paste megalinter-reports/LINTER_DEFAULT at the root of your repository
⚠️ COPYPASTE / jscpd - 89 errors
Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [76:2 - 81:5] (5 lines, 93 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [32:6 - 37:4]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [77:6 - 82:10] (5 lines, 89 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [61:10 - 66:10]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/kernel.py [33:49 - 39:4] (6 lines, 73 tokens)
   src/liblaf/apple/energy/elastic/phace_active/kernel.py [13:35 - 19:4]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/kernel.py [80:6 - 86:10] (6 lines, 74 tokens)
   src/liblaf/apple/energy/elastic/phace_active/kernel.py [56:6 - 62:10]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/kernel.py [86:10 - 95:10] (9 lines, 81 tokens)
   src/liblaf/apple/energy/elastic/phace_active/kernel.py [19:4 - 28:4]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/func.py [67:1 - 82:43] (15 lines, 147 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/func.py [43:1 - 58:44]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/func.py [84:1 - 97:9] (13 lines, 211 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/func.py [60:1 - 73:9]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [14:13 - 38:35] (24 lines, 273 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [14:8 - 38:36]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [40:9 - 53:49] (13 lines, 171 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [38:3 - 51:50]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [55:9 - 69:45] (14 lines, 196 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [53:9 - 67:46]

Clone found (python):
 - src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [71:9 - 85:45] (14 lines, 202 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [69:9 - 83:46]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap_active/func.py [80:6 - 87:8] (7 lines, 85 tokens)
   src/liblaf/apple/energy/elastic/arap_active/func.py [56:6 - 63:8]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap_active/_arap_active.py [29:5 - 41:34] (12 lines, 156 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [26:9 - 38:36]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap_active/_arap_active.py [42:11 - 56:48] (14 lines, 183 tokens)
   src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [39:8 - 51:50]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap_active/_arap_active.py [57:11 - 68:10] (11 lines, 114 tokens)
   src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [54:8 - 63:2]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap_active/_arap_active.py [74:11 - 89:44] (15 lines, 214 tokens)
   src/liblaf/apple/energy/elastic/phace_active/_phace_active.py [70:8 - 83:46]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap/func.py [35:5 - 41:7] (6 lines, 131 tokens)
   src/liblaf/apple/energy/elastic/arap_active/func.py [60:5 - 66:17]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap/func.py [49:5 - 55:7] (6 lines, 139 tokens)
   src/liblaf/apple/energy/elastic/arap_active/func.py [84:5 - 90:17]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap/_arap.py [22:5 - 33:27] (11 lines, 143 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [27:18 - 38:36]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap/_arap.py [33:2 - 46:41] (13 lines, 176 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [38:8 - 51:50]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap/_arap.py [46:2 - 61:37] (15 lines, 215 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [52:8 - 67:46]

Clone found (python):
 - src/liblaf/apple/energy/elastic/arap/_arap.py [61:5 - 75:37] (14 lines, 202 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/_phace_passive.py [69:9 - 83:46]

Clone found (python):
 - src/liblaf/apple/energy/collision/vert_face/kernel.py [124:38 - 132:4] (8 lines, 94 tokens)
   src/liblaf/apple/energy/collision/vert_face/kernel.py [79:38 - 87:7]

Clone found (python):
 - src/liblaf/apple/energy/collision/vert_face/kernel.py [173:44 - 181:10] (8 lines, 94 tokens)
   src/liblaf/apple/energy/collision/vert_face/kernel.py [79:38 - 87:7]

Clone found (python):
 - src/liblaf/apple/energy/collision/vert_face/kernel.py [226:2 - 233:10] (7 lines, 90 tokens)
   src/liblaf/apple/energy/collision/vert_face/kernel.py [80:7 - 87:7]

Clone found (python):
 - exp/2025/04/30/fat-muscle/src/20-simulate.py [17:5 - 30:6] (13 lines, 138 tokens)
   exp/2025/04/30/human-head/src/10-simulate.py [18:5 - 31:8]

Clone found (python):
 - exp/2025/04/30/fat-muscle/src/20-simulate.py [48:2 - 58:6] (10 lines, 136 tokens)
   exp/2025/04/30/human-head/src/10-simulate.py [47:2 - 57:8]

Clone found (python):
 - exp/2025/04/30/fat-muscle/src/20-simulate.py [59:6 - 72:3] (13 lines, 109 tokens)
   exp/2025/04/30/human-head/src/10-simulate.py [58:8 - 71:4]

Clone found (python):
 - exp/2025/04/30/cubic/src/10-gen.py [21:4 - 44:4] (23 lines, 196 tokens)
   exp/2025/04/30/human-head/src/10-simulate.py [24:7 - 46:9]

Clone found (python):
 - exp/2025/04/30/cubic/src/10-gen.py [44:2 - 71:2] (27 lines, 305 tokens)
   exp/2025/04/30/fat-muscle/src/20-simulate.py [46:3 - 73:2]

Clone found (python):
 - src/liblaf/apple/struct/dictutils/_array_dict.py [21:14 - 30:5] (9 lines, 123 tokens)
   src/liblaf/apple/struct/dictutils/_node_container.py [14:8 - 24:5]

Clone found (python):
 - src/liblaf/apple/struct/dictutils/_array_dict.py [42:6 - 58:44] (16 lines, 124 tokens)
   src/liblaf/apple/struct/dictutils/_node_container.py [36:4 - 52:40]

Clone found (python):
 - src/liblaf/apple/func/elastic/phace_static.py [69:1 - 76:30] (7 lines, 99 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/func.py [60:1 - 67:6]

Clone found (python):
 - src/liblaf/apple/func/elastic/phace_static.py [76:30 - 82:9] (6 lines, 109 tokens)
   src/liblaf/apple/energy/elastic/phace_passive/func.py [67:35 - 73:9]

Clone found (python):
 - src/liblaf/apple/func/elastic/arap.py [34:30 - 46:30] (12 lines, 179 tokens)
   src/liblaf/apple/energy/elastic/arap/func.py [34:35 - 46:35]

Clone found (python):
 - src/liblaf/apple/func/elastic/arap.py [46:30 - 53:2] (7 lines, 181 tokens)
   src/liblaf/apple/energy/elastic/arap/func.py [46:35 - 55:2]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [13:5 - 34:25] (21 lines, 187 tokens)
   src/liblaf/apple/energy/elastic/arap/_arap.py [12:5 - 38:7]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [34:25 - 47:39] (13 lines, 176 tokens)
   src/liblaf/apple/energy/elastic/arap/_arap.py [33:27 - 51:7]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [47:39 - 62:35] (15 lines, 215 tokens)
   src/liblaf/apple/energy/elastic/arap/_arap.py [46:41 - 67:7]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [62:35 - 76:35] (14 lines, 210 tokens)
   src/liblaf/apple/energy/elastic/arap/_arap.py [61:37 - 83:7]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [94:39 - 100:8] (6 lines, 73 tokens)
   src/liblaf/apple/energy/elastic/arap/kernel.py [22:41 - 28:39]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [105:35 - 112:8] (7 lines, 87 tokens)
   src/liblaf/apple/energy/elastic/arap/kernel.py [33:37 - 40:35]

Clone found (python):
 - src/liblaf/apple/energy/elastic/_arap.py [119:35 - 127:8] (8 lines, 101 tokens)
   src/liblaf/apple/energy/elastic/arap/kernel.py [47:37 - 55:35]

Clone found (python):
 - src/libl

(Truncated to 8000 characters out of 16923)
⚠️ JSON / jsonlint - 1 error
File: pyrightconfig.json
Parse error on line 17, column 4:
...": "information"  // "reportAttributeAc...
----------------------^
Unexpected token "/"
⚠️ MARKDOWN / markdownlint - 35 errors
CHANGELOG.md:29 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:40 MD024/no-duplicate-heading Multiple headings with the same content [Context: "💥 BREAKING CHANGES"]
CHANGELOG.md:44 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:50 MD024/no-duplicate-heading Multiple headings with the same content [Context: "💥 BREAKING CHANGES"]
CHANGELOG.md:75 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:96 MD024/no-duplicate-heading Multiple headings with the same content [Context: "⬆️ Dependencies"]
CHANGELOG.md:101 MD024/no-duplicate-heading Multiple headings with the same content [Context: "♻ Code Refactoring"]
CHANGELOG.md:118 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:125 MD024/no-duplicate-heading Multiple headings with the same content [Context: "⬆️ Dependencies"]
CHANGELOG.md:131 MD024/no-duplicate-heading Multiple headings with the same content [Context: "♻ Code Refactoring"]
CHANGELOG.md:138 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:142 MD024/no-duplicate-heading Multiple headings with the same content [Context: "⬆️ Dependencies"]
CHANGELOG.md:147 MD024/no-duplicate-heading Multiple headings with the same content [Context: "♻ Code Refactoring"]
CHANGELOG.md:154 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:159 MD024/no-duplicate-heading Multiple headings with the same content [Context: "⬆️ Dependencies"]
CHANGELOG.md:163 MD024/no-duplicate-heading Multiple headings with the same content [Context: "♻ Code Refactoring"]
CHANGELOG.md:171 MD024/no-duplicate-heading Multiple headings with the same content [Context: "❤️ New Contributors"]
CHANGELOG.md:178 MD024/no-duplicate-heading Multiple headings with the same content [Context: "✨ Features"]
CHANGELOG.md:182 MD024/no-duplicate-heading Multiple headings with the same content [Context: "👷 Build System"]
CHANGELOG.md:186 MD024/no-duplicate-heading Multiple headings with the same content [Context: "❤️ New Contributors"]
docs/denotation.md:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## Denotation"]
docs/README.md:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "{% include "../README.md" %}"]
README.md:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "<div align="center" markdown><..."]
README.md:3:1 MD045/no-alt-text Images should have alternate text (alt text)
README.md:4:1 MD045/no-alt-text Images should have alternate text (alt text)
README.md:5:1 MD045/no-alt-text Images should have alternate text (alt text)
README.md:26:1 MD045/no-alt-text Images should have alternate text (alt text)
README.md:36:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:50:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:58:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:70:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:78:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:80:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:84:2 MD045/no-alt-text Images should have alternate text (alt text)
README.md:100:2 MD045/no-alt-text Images should have alternate text (alt text)
⚠️ PYTHON / ruff - 1 error
F841 Local variable `lip_bottom_pv` is assigned to but never used
  --> examples/phace/close-mouth/main.py:62:5
   |
60 |         surface_pv.point_data["is-lip-top"], adjacent_cells=False
61 |     ).extract_surface()
62 |     lip_bottom_pv: pv.PolyData = surface_pv.extract_points(
   |     ^^^^^^^^^^^^^
63 |         surface_pv.point_data["is-lip-bottom"], adjacent_cells=False
64 |     ).extract_surface()
   |
help: Remove assignment to unused variable `lip_bottom_pv`

Found 1 error.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).

See detailed reports in MegaLinter artifacts

MegaLinter is graciously provided by OX Security

@codecov
Copy link

codecov bot commented Sep 2, 2025

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
9 2 7 0
View the top 1 failed test(s) by shortest run time
tests.optim.test_scipy::test_optimizer_scipy[x00]
Stack Traces | 0.002s run time
x0 = Array([1.3, 0.7, 0.8, 1.9, 1.2], dtype=float32)

    @pytest.mark.parametrize("x0", [jnp.asarray([1.3, 0.7, 0.8, 1.9, 1.2])])
    def test_optimizer_scipy(x0: jax.Array) -> None:
        optimizer = optim.OptimizerScipy()
>       result: optim.OptimizeResult = optimizer.minimize(
            fun=scipy.optimize.rosen,
            x0=x0,
            jac=scipy.optimize.rosen_der,
            hessp=scipy.optimize.rosen_hess_prod,
        )

optimizer  = OptimizerScipy()
x0         = Array([1.3, 0.7, 0.8, 1.9, 1.2], dtype=float32)

tests/optim/test_scipy.py:13: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../apple/optim/optimizer.py:65: in minimize
    result: OptimizeResult = self._minimize_impl(problem, x0, args, **kwargs)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        args       = ()
        callback   = None
        fun        = <function rosen at 0x7f1f54727600>
        fun_and_jac = None
        hess       = None
        hess_diag  = None
        hess_quad  = None
        hessp      = <function rosen_hess_prod at 0x7f1f547277e0>
        jac        = <function rosen_der at 0x7f1f547276a0>
        jac_and_hess_diag = None
        kwargs     = {}
        problem    = OptimizationProblem(
  fun=<function rosen>,
  jac=<function rosen_der>,
  hessp=<function rosen_hess_prod>
)
        self       = OptimizerScipy()
        timer      = Timer(name='OptimizerScipy', clocks=('perf',), timings=defaultdict(<class 'list'>, {'perf': [0.00039232600001071205]})...6fcb8dd0 for function at 0x7f1f6fcca7a0>, cb_finish=<FunctionWrapper at 0x7f1f6fcb8e40 for function at 0x7f1f6fccb420>)
        x0         = Array([1.3, 0.7, 0.8, 1.9, 1.2], dtype=float32)
.../apple/optim/_scipy.py:29: in _minimize_impl
    scipy_result: scipy.optimize.OptimizeResult = scipy.optimize.minimize(
        args       = ()
        kwargs     = {}
        problem    = OptimizationProblem(
  fun=<function rosen>,
  jac=<function rosen_der>,
  hessp=<function rosen_hess_prod>
)
        self       = OptimizerScipy()
        x0         = Array([1.3, 0.7, 0.8, 1.9, 1.2], dtype=float32)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fun = <function rosen at 0x7f1e641d7c40>
x0 = array([1.3, 0.7, 0.8, 1.9, 1.2], dtype=float32), args = ()
method = 'trust-constr', jac = <function rosen_der at 0x7f1e641d7ba0>
hess = None, hessp = <function rosen_hess_prod at 0x7f1e64208040>, bounds = None
constraints = [], tol = None, callback = None
options = _CountingAttr(counter=130, _default=Factory(factory=<function OptimizerScipy.<lambda> at 0x7f1f52841940>, takes_self=False), repr=True, eq=True, order=True, hash=None, init=True, on_setattr=None, alias=None, metadata={})

    def minimize(fun, x0, args=(), method=None, jac=None, hess=None,
                 hessp=None, bounds=None, constraints=(), tol=None,
                 callback=None, options=None):
        """Minimization of scalar function of one or more variables.
    
        Parameters
        ----------
        fun : callable
            The objective function to be minimized::
    
                fun(x, *args) -> float
    
            where ``x`` is a 1-D array with shape (n,) and ``args``
            is a tuple of the fixed parameters needed to completely
            specify the function.
    
            Suppose the callable has signature ``f0(x, *my_args, **my_kwargs)``, where
            ``my_args`` and ``my_kwargs`` are required positional and keyword arguments.
            Rather than passing ``f0`` as the callable, wrap it to accept
            only ``x``; e.g., pass ``fun=lambda x: f0(x, *my_args, **my_kwargs)`` as the
            callable, where ``my_args`` (tuple) and ``my_kwargs`` (dict) have been
            gathered before invoking this function.
        x0 : ndarray, shape (n,)
            Initial guess. Array of real elements of size (n,),
            where ``n`` is the number of independent variables.
        args : tuple, optional
            Extra arguments passed to the objective function and its
            derivatives (`fun`, `jac` and `hess` functions).
        method : str or callable, optional
            Type of solver.  Should be one of
    
            - 'Nelder-Mead' :ref:`(see here) <optimize.minimize-neldermead>`
            - 'Powell'      :ref:`(see here) <optimize.minimize-powell>`
            - 'CG'          :ref:`(see here) <optimize.minimize-cg>`
            - 'BFGS'        :ref:`(see here) <optimize.minimize-bfgs>`
            - 'Newton-CG'   :ref:`(see here) <optimize.minimize-newtoncg>`
            - 'L-BFGS-B'    :ref:`(see here) <optimize.minimize-lbfgsb>`
            - 'TNC'         :ref:`(see here) <optimize.minimize-tnc>`
            - 'COBYLA'      :ref:`(see here) <optimize.minimize-cobyla>`
            - 'COBYQA'      :ref:`(see here) <optimize.minimize-cobyqa>`
            - 'SLSQP'       :ref:`(see here) <optimize.minimize-slsqp>`
            - 'trust-constr':ref:`(see here) <optimize.minimize-trustconstr>`
            - 'dogleg'      :ref:`(see here) <optimize.minimize-dogleg>`
            - 'trust-ncg'   :ref:`(see here) <optimize.minimize-trustncg>`
            - 'trust-exact' :ref:`(see here) <optimize.minimize-trustexact>`
            - 'trust-krylov' :ref:`(see here) <optimize.minimize-trustkrylov>`
            - custom - a callable object, see below for description.
    
            If not given, chosen to be one of ``BFGS``, ``L-BFGS-B``, ``SLSQP``,
            depending on whether or not the problem has constraints or bounds.
        jac : {callable,  '2-point', '3-point', 'cs', bool}, optional
            Method for computing the gradient vector. Only for CG, BFGS,
            Newton-CG, L-BFGS-B, TNC, SLSQP, dogleg, trust-ncg, trust-krylov,
            trust-exact and trust-constr.
            If it is a callable, it should be a function that returns the gradient
            vector::
    
                jac(x, *args) -> array_like, shape (n,)
    
            where ``x`` is an array with shape (n,) and ``args`` is a tuple with
            the fixed parameters. If `jac` is a Boolean and is True, `fun` is
            assumed to return a tuple ``(f, g)`` containing the objective
            function and the gradient.
            Methods 'Newton-CG', 'trust-ncg', 'dogleg', 'trust-exact', and
            'trust-krylov' require that either a callable be supplied, or that
            `fun` return the objective and gradient.
            If None or False, the gradient will be estimated using 2-point finite
            difference estimation with an absolute step size.
            Alternatively, the keywords  {'2-point', '3-point', 'cs'} can be used
            to select a finite difference scheme for numerical estimation of the
            gradient with a relative step size. These finite difference schemes
            obey any specified `bounds`.
        hess : {callable, '2-point', '3-point', 'cs', HessianUpdateStrategy}, optional
            Method for computing the Hessian matrix. Only for Newton-CG, dogleg,
            trust-ncg, trust-krylov, trust-exact and trust-constr.
            If it is callable, it should return the Hessian matrix::
    
                hess(x, *args) -> {LinearOperator, spmatrix, array}, (n, n)
    
            where ``x`` is a (n,) ndarray and ``args`` is a tuple with the fixed
            parameters.
            The keywords {'2-point', '3-point', 'cs'} can also be used to select
            a finite difference scheme for numerical estimation of the hessian.
            Alternatively, objects implementing the `HessianUpdateStrategy`
            interface can be used to approximate the Hessian. Available
            quasi-Newton methods implementing this interface are:
    
            - `BFGS`
            - `SR1`
    
            Not all of the options are available for each of the methods; for
            availability refer to the notes.
        hessp : callable, optional
            Hessian of objective function times an arbitrary vector p. Only for
            Newton-CG, trust-ncg, trust-krylov, trust-constr.
            Only one of `hessp` or `hess` needs to be given. If `hess` is
            provided, then `hessp` will be ignored. `hessp` must compute the
            Hessian times an arbitrary vector::
    
                hessp(x, p, *args) ->  ndarray shape (n,)
    
            where ``x`` is a (n,) ndarray, ``p`` is an arbitrary vector with
            dimension (n,) and ``args`` is a tuple with the fixed
            parameters.
        bounds : sequence or `Bounds`, optional
            Bounds on variables for Nelder-Mead, L-BFGS-B, TNC, SLSQP, Powell,
            trust-constr, COBYLA, and COBYQA methods. There are two ways to specify
            the bounds:
    
            1. Instance of `Bounds` class.
            2. Sequence of ``(min, max)`` pairs for each element in `x`. None
               is used to specify no bound.
    
        constraints : {Constraint, dict} or List of {Constraint, dict}, optional
            Constraints definition. Only for COBYLA, COBYQA, SLSQP and trust-constr.
    
            Constraints for 'trust-constr', 'cobyqa', and 'cobyla' are defined as a single
            object or a list of objects specifying constraints to the optimization problem.
            Available constraints are:
    
            - `LinearConstraint`
            - `NonlinearConstraint`
    
            Constraints for COBYLA, SLSQP are defined as a list of dictionaries.
            Each dictionary with fields:
    
            type : str
                Constraint type: 'eq' for equality, 'ineq' for inequality.
            fun : callable
                The function defining the constraint.
            jac : callable, optional
                The Jacobian of `fun` (only for SLSQP).
            args : sequence, optional
                Extra arguments to be passed to the function and Jacobian.
    
            Equality constraint means that the constraint function result is to
            be zero whereas inequality means that it is to be non-negative.
    
        tol : float, optional
            Tolerance for termination. When `tol` is specified, the selected
            minimization algorithm sets some relevant solver-specific tolerance(s)
            equal to `tol`. For detailed control, use solver-specific
            options.
        options : dict, optional
            A dictionary of solver options. All methods except `TNC` accept the
            following generic options:
    
            maxiter : int
                Maximum number of iterations to perform. Depending on the
                method each iteration may use several function evaluations.
    
                For `TNC` use `maxfun` instead of `maxiter`.
            disp : bool
                Set to True to print convergence messages.
    
            For method-specific options, see :func:`show_options()`.
        callback : callable, optional
            A callable called after each iteration.
    
            All methods except TNC and SLSQP support a callable with
            the signature::
    
                callback(intermediate_result: OptimizeResult)
    
            where ``intermediate_result`` is a keyword parameter containing an
            `OptimizeResult` with attributes ``x`` and ``fun``, the present values
            of the parameter vector and objective function. Not all attributes of
            `OptimizeResult` may be present. The name of the parameter must be
            ``intermediate_result`` for the callback to be passed an `OptimizeResult`.
            These methods will also terminate if the callback raises ``StopIteration``.
    
            All methods except trust-constr (also) support a signature like::
    
                callback(xk)
    
            where ``xk`` is the current parameter vector.
    
            Introspection is used to determine which of the signatures above to
            invoke.
    
        Returns
        -------
        res : OptimizeResult
            The optimization result represented as a ``OptimizeResult`` object.
            Important attributes are: ``x`` the solution array, ``success`` a
            Boolean flag indicating if the optimizer exited successfully and
            ``message`` which describes the cause of the termination. See
            `OptimizeResult` for a description of other attributes.
    
        See also
        --------
        minimize_scalar : Interface to minimization algorithms for scalar
            univariate functions
        show_options : Additional options accepted by the solvers
    
        Notes
        -----
        This section describes the available solvers that can be selected by the
        'method' parameter. The default method is *BFGS*.
    
        **Unconstrained minimization**
    
        Method :ref:`CG <optimize.minimize-cg>` uses a nonlinear conjugate
        gradient algorithm by Polak and Ribiere, a variant of the
        Fletcher-Reeves method described in [5]_ pp.120-122. Only the
        first derivatives are used.
    
        Method :ref:`BFGS <optimize.minimize-bfgs>` uses the quasi-Newton
        method of Broyden, Fletcher, Goldfarb, and Shanno (BFGS) [5]_
        pp. 136. It uses the first derivatives only. BFGS has proven good
        performance even for non-smooth optimizations. This method also
        returns an approximation of the Hessian inverse, stored as
        `hess_inv` in the OptimizeResult object.
    
        Method :ref:`Newton-CG <optimize.minimize-newtoncg>` uses a
        Newton-CG algorithm [5]_ pp. 168 (also known as the truncated
        Newton method). It uses a CG method to the compute the search
        direction. See also *TNC* method for a box-constrained
        minimization with a similar algorithm. Suitable for large-scale
        problems.
    
        Method :ref:`dogleg <optimize.minimize-dogleg>` uses the dog-leg
        trust-region algorithm [5]_ for unconstrained minimization. This
        algorithm requires the gradient and Hessian; furthermore the
        Hessian is required to be positive definite.
    
        Method :ref:`trust-ncg <optimize.minimize-trustncg>` uses the
        Newton conjugate gradient trust-region algorithm [5]_ for
        unconstrained minimization. This algorithm requires the gradient
        and either the Hessian or a function that computes the product of
        the Hessian with a given vector. Suitable for large-scale problems.
    
        Method :ref:`trust-krylov <optimize.minimize-trustkrylov>` uses
        the Newton GLTR trust-region algorithm [14]_, [15]_ for unconstrained
        minimization. This algorithm requires the gradient
        and either the Hessian or a function that computes the product of
        the Hessian with a given vector. Suitable for large-scale problems.
        On indefinite problems it requires usually less iterations than the
        `trust-ncg` method and is recommended for medium and large-scale problems.
    
        Method :ref:`trust-exact <optimize.minimize-trustexact>`
        is a trust-region method for unconstrained minimization in which
        quadratic subproblems are solved almost exactly [13]_. This
        algorithm requires the gradient and the Hessian (which is
        *not* required to be positive definite). It is, in many
        situations, the Newton method to converge in fewer iterations
        and the most recommended for small and medium-size problems.
    
        **Bound-Constrained minimization**
    
        Method :ref:`Nelder-Mead <optimize.minimize-neldermead>` uses the
        Simplex algorithm [1]_, [2]_. This algorithm is robust in many
        applications. However, if numerical computation of derivative can be
        trusted, other algorithms using the first and/or second derivatives
        information might be preferred for their better performance in
        general.
    
        Method :ref:`L-BFGS-B <optimize.minimize-lbfgsb>` uses the L-BFGS-B
        algorithm [6]_, [7]_ for bound constrained minimization.
    
        Method :ref:`Powell <optimize.minimize-powell>` is a modification
        of Powell's method [3]_, [4]_ which is a conjugate direction
        method. It performs sequential one-dimensional minimizations along
        each vector of the directions set (`direc` field in `options` and
        `info`), which is updated at each iteration of the main
        minimization loop. The function need not be differentiable, and no
        derivatives are taken. If bounds are not provided, then an
        unbounded line search will be used. If bounds are provided and
        the initial guess is within the bounds, then every function
        evaluation throughout the minimization procedure will be within
        the bounds. If bounds are provided, the initial guess is outside
        the bounds, and `direc` is full rank (default has full rank), then
        some function evaluations during the first iteration may be
        outside the bounds, but every function evaluation after the first
        iteration will be within the bounds. If `direc` is not full rank,
        then some parameters may not be optimized and the solution is not
        guaranteed to be within the bounds.
    
        Method :ref:`TNC <optimize.minimize-tnc>` uses a truncated Newton
        algorithm [5]_, [8]_ to minimize a function with variables subject
        to bounds. This algorithm uses gradient information; it is also
        called Newton Conjugate-Gradient. It differs from the *Newton-CG*
        method described above as it wraps a C implementation and allows
        each variable to be given upper and lower bounds.
    
        **Constrained Minimization**
    
        Method :ref:`COBYLA <optimize.minimize-cobyla>` uses the PRIMA
        implementation [19]_ of the
        Constrained Optimization BY Linear Approximation (COBYLA) method
        [9]_, [10]_, [11]_. The algorithm is based on linear
        approximations to the objective function and each constraint.
    
        Method :ref:`COBYQA <optimize.minimize-cobyqa>` uses the Constrained
        Optimization BY Quadratic Approximations (COBYQA) method [18]_. The
        algorithm is a derivative-free trust-region SQP method based on quadratic
        approximations to the objective function and each nonlinear constraint. The
        bounds are treated as unrelaxable constraints, in the sense that the
        algorithm always respects them throughout the optimization process.
    
        Method :ref:`SLSQP <optimize.minimize-slsqp>` uses Sequential
        Least SQuares Programming to minimize a function of several
        variables with any combination of bounds, equality and inequality
        constraints. The method wraps the SLSQP Optimization subroutine
        originally implemented by Dieter Kraft [12]_. Note that the
        wrapper handles infinite values in bounds by converting them into
        large floating values.
    
        Method :ref:`trust-constr <optimize.minimize-trustconstr>` is a
        trust-region algorithm for constrained optimization. It switches
        between two implementations depending on the problem definition.
        It is the most versatile constrained minimization algorithm
        implemented in SciPy and the most appropriate for large-scale problems.
        For equality constrained problems it is an implementation of Byrd-Omojokun
        Trust-Region SQP method described in [17]_ and in [5]_, p. 549. When
        inequality constraints are imposed as well, it switches to the trust-region
        interior point method described in [16]_. This interior point algorithm,
        in turn, solves inequality constraints by introducing slack variables
        and solving a sequence of equality-constrained barrier problems
        for progressively smaller values of the barrier parameter.
        The previously described equality constrained SQP method is
        used to solve the subproblems with increasing levels of accuracy
        as the iterate gets closer to a solution.
    
        **Finite-Difference Options**
    
        For Method :ref:`trust-constr <optimize.minimize-trustconstr>`
        the gradient and the Hessian may be approximated using
        three finite-difference schemes: {'2-point', '3-point', 'cs'}.
        The scheme 'cs' is, potentially, the most accurate but it
        requires the function to correctly handle complex inputs and to
        be differentiable in the complex plane. The scheme '3-point' is more
        accurate than '2-point' but requires twice as many operations. If the
        gradient is estimated via finite-differences the Hessian must be
        estimated using one of the quasi-Newton strategies.
    
        **Method specific options for the** `hess` **keyword**
    
        +--------------+------+----------+-------------------------+-----+
        | method/Hess  | None | callable | '2-point/'3-point'/'cs' | HUS |
        +==============+======+==========+=========================+=====+
        | Newton-CG    | x    | (n, n)   | x                       | x   |
        |              |      | LO       |                         |     |
        +--------------+------+----------+-------------------------+-----+
        | dogleg       |      | (n, n)   |                         |     |
        +--------------+------+----------+-------------------------+-----+
        | trust-ncg    |      | (n, n)   | x                       | x   |
        +--------------+------+----------+-------------------------+-----+
        | trust-krylov |      | (n, n)   | x                       | x   |
        +--------------+------+----------+-------------------------+-----+
        | trust-exact  |      | (n, n)   |                         |     |
        +--------------+------+----------+-------------------------+-----+
        | trust-constr | x    | (n, n)   |  x                      | x   |
        |              |      | LO       |                         |     |
        |              |      | sp       |                         |     |
        +--------------+------+----------+-------------------------+-----+
    
        where LO=LinearOperator, sp=Sparse matrix, HUS=HessianUpdateStrategy
    
        **Custom minimizers**
    
        It may be useful to pass a custom minimization method, for example
        when using a frontend to this method such as `scipy.optimize.basinhopping`
        or a different library.  You can simply pass a callable as the ``method``
        parameter.
    
        The callable is called as ``method(fun, x0, args, **kwargs, **options)``
        where ``kwargs`` corresponds to any other parameters passed to `minimize`
        (such as `callback`, `hess`, etc.), except the `options` dict, which has
        its contents also passed as `method` parameters pair by pair.  Also, if
        `jac` has been passed as a bool type, `jac` and `fun` are mangled so that
        `fun` returns just the function values and `jac` is converted to a function
        returning the Jacobian.  The method shall return an `OptimizeResult`
        object.
    
        The provided `method` callable must be able to accept (and possibly ignore)
        arbitrary parameters; the set of parameters accepted by `minimize` may
        expand in future versions and then these parameters will be passed to
        the method.  You can find an example in the scipy.optimize tutorial.
    
        References
        ----------
        .. [1] Nelder, J A, and R Mead. 1965. A Simplex Method for Function
            Minimization. The Computer Journal 7: 308-13.
        .. [2] Wright M H. 1996. Direct search methods: Once scorned, now
            respectable, in Numerical Analysis 1995: Proceedings of the 1995
            Dundee Biennial Conference in Numerical Analysis (Eds. D F
            Griffiths and G A Watson). Addison Wesley Longman, Harlow, UK.
            191-208.
        .. [3] Powell, M J D. 1964. An efficient method for finding the minimum of
           a function of several variables without calculating derivatives. The
           Computer Journal 7: 155-162.
        .. [4] Press W, S A Teukolsky, W T Vetterling and B P Flannery.
           Numerical Recipes (any edition), Cambridge University Press.
        .. [5] Nocedal, J, and S J Wright. 2006. Numerical Optimization.
           Springer New York.
        .. [6] Byrd, R H and P Lu and J. Nocedal. 1995. A Limited Memory
           Algorithm for Bound Constrained Optimization. SIAM Journal on
           Scientific and Statistical Computing 16 (5): 1190-1208.
        .. [7] Zhu, C and R H Byrd and J Nocedal. 1997. L-BFGS-B: Algorithm
           778: L-BFGS-B, FORTRAN routines for large scale bound constrained
           optimization. ACM Transactions on Mathematical Software 23 (4):
           550-560.
        .. [8] Nash, S G. Newton-Type Minimization Via the Lanczos Method.
           1984. SIAM Journal of Numerical Analysis 21: 770-778.
        .. [9] Powell, M J D. A direct search optimization method that models
           the objective and constraint functions by linear interpolation.
           1994. Advances in Optimization and Numerical Analysis, eds. S. Gomez
           and J-P Hennart, Kluwer Academic (Dordrecht), 51-67.
        .. [10] Powell M J D. Direct search algorithms for optimization
           calculations. 1998. Acta Numerica 7: 287-336.
        .. [11] Powell M J D. A view of algorithms for optimization without
           derivatives. 2007.Cambridge University Technical Report DAMTP
           2007/NA03
        .. [12] Kraft, D. A software package for sequential quadratic
           programming. 1988. Tech. Rep. DFVLR-FB 88-28, DLR German Aerospace
           Center -- Institute for Flight Mechanics, Koln, Germany.
        .. [13] Conn, A. R., Gould, N. I., and Toint, P. L.
           Trust region methods. 2000. Siam. pp. 169-200.
        .. [14] F. Lenders, C. Kirches, A. Potschka: "trlib: A vector-free
           implementation of the GLTR method for iterative solution of
           the trust region problem", :arxiv:`1611.04718`
        .. [15] N. Gould, S. Lucidi, M. Roma, P. Toint: "Solving the
           Trust-Region Subproblem using the Lanczos Method",
           SIAM J. Optim., 9(2), 504--525, (1999).
        .. [16] Byrd, Richard H., Mary E. Hribar, and Jorge Nocedal. 1999.
            An interior point algorithm for large-scale nonlinear  programming.
            SIAM Journal on Optimization 9.4: 877-900.
        .. [17] Lalee, Marucha, Jorge Nocedal, and Todd Plantenga. 1998. On the
            implementation of an algorithm for large-scale equality constrained
            optimization. SIAM Journal on Optimization 8.3: 682-706.
        .. [18] Ragonneau, T. M. *Model-Based Derivative-Free Optimization Methods
            and Software*. PhD thesis, Department of Applied Mathematics, The Hong
            Kong Polytechnic University, Hong Kong, China, 2022. URL:
            https://theses.lib.polyu.edu..../handle/200/12294.
        .. [19] Zhang, Z. "PRIMA: Reference Implementation for Powell's Methods with
            Modernization and Amelioration", https://www.libprima.net,
            :doi:`10.5281/zenodo.8052654`
        .. [20] Karush-Kuhn-Tucker conditions,
            https://en.wikipedia.org/wiki/Karush%E2%80%93Kuhn%E2%80%93Tucker_conditions
    
        Examples
        --------
        Let us consider the problem of minimizing the Rosenbrock function. This
        function (and its respective derivatives) is implemented in `rosen`
        (resp. `rosen_der`, `rosen_hess`) in the `scipy.optimize`.
    
        >>> from scipy.optimize import minimize, rosen, rosen_der
    
        A simple application of the *Nelder-Mead* method is:
    
        >>> x0 = [1.3, 0.7, 0.8, 1.9, 1.2]
        >>> res = minimize(rosen, x0, method='Nelder-Mead', tol=1e-6)
        >>> res.x
        array([ 1.,  1.,  1.,  1.,  1.])
    
        Now using the *BFGS* algorithm, using the first derivative and a few
        options:
    
        >>> res = minimize(rosen, x0, method='BFGS', jac=rosen_der,
        ...                options={'gtol': 1e-6, 'disp': True})
        Optimization terminated successfully.
                 Current function value: 0.000000
                 Iterations: 26
                 Function evaluations: 31
                 Gradient evaluations: 31
        >>> res.x
        array([ 1.,  1.,  1.,  1.,  1.])
        >>> print(res.message)
        Optimization terminated successfully.
        >>> res.hess_inv
        array([
            [ 0.00749589,  0.01255155,  0.02396251,  0.04750988,  0.09495377],  # may vary
            [ 0.01255155,  0.02510441,  0.04794055,  0.09502834,  0.18996269],
            [ 0.02396251,  0.04794055,  0.09631614,  0.19092151,  0.38165151],
            [ 0.04750988,  0.09502834,  0.19092151,  0.38341252,  0.7664427 ],
            [ 0.09495377,  0.18996269,  0.38165151,  0.7664427,   1.53713523]
        ])
    
        Next, consider a minimization problem with several constraints (namely
        Example 16.4 from [5]_). The objective function is:
    
        >>> fun = lambda x: (x[0] - 1)**2 + (x[1] - 2.5)**2
    
        There are three constraints defined as:
    
        >>> cons = ({'type': 'ineq', 'fun': lambda x:  x[0] - 2 * x[1] + 2},
        ...         {'type': 'ineq', 'fun': lambda x: -x[0] - 2 * x[1] + 6},
        ...         {'type': 'ineq', 'fun': lambda x: -x[0] + 2 * x[1] + 2})
    
        And variables must be positive, hence the following bounds:
    
        >>> bnds = ((0, None), (0, None))
    
        The optimization problem is solved using the SLSQP method as:
    
        >>> res = minimize(fun, (2, 0), method='SLSQP', bounds=bnds, constraints=cons)
    
        It should converge to the theoretical solution ``[1.4 ,1.7]``. *SLSQP* also
        returns the multipliers that are used in the solution of the problem. These
        multipliers, when the problem constraints are linear, can be thought of as the
        Karush-Kuhn-Tucker (KKT) multipliers, which are a generalization
        of Lagrange multipliers to inequality-constrained optimization problems ([20]_).
    
        Notice that at the solution, the first constraint is active. Let's evaluate the
        function at solution:
    
        >>> cons[0]['fun'](res.x)
        np.float64(1.4901224698604665e-09)
    
        Also, notice that at optimality there is a non-zero multiplier:
    
        >>> res.multipliers
        array([0.8, 0. , 0. ])
    
        This can be understood as the local sensitivity of the optimal value of the
        objective function with respect to changes in the first constraint. If we
        tighten the constraint by a small amount ``eps``:
    
        >>> eps = 0.01
        >>> cons[0]['fun'] = lambda x: x[0] - 2 * x[1] + 2 - eps
    
        we expect the optimal value of the objective function to increase by
        approximately ``eps * res.multipliers[0]``:
    
        >>> eps * res.multipliers[0]  # Expected change in f0
        np.float64(0.008000000027153205)
        >>> f0 = res.fun  # Keep track of the previous optimal value
        >>> res = minimize(fun, (2, 0), method='SLSQP', bounds=bnds, constraints=cons)
        >>> f1 = res.fun  # New optimal value
        >>> f1 - f0
        np.float64(0.008019998807885509)
    
        """
        x0 = np.atleast_1d(np.asarray(x0))
    
        if x0.ndim != 1:
            raise ValueError("'x0' must only have one dimension.")
    
        if x0.dtype.kind in np.typecodes["AllInteger"]:
            x0 = np.asarray(x0, dtype=float)
    
        if not isinstance(args, tuple):
            args = (args,)
    
        if method is None:
            # Select automatically
            if constraints:
                method = 'SLSQP'
            elif bounds is not None:
                method = 'L-BFGS-B'
            else:
                method = 'BFGS'
    
        if callable(method):
            meth = "_custom"
        else:
            meth = method.lower()
    
        if options is None:
            options = {}
        # check if optional parameters are supported by the selected method
        # - jac
        if meth in ('nelder-mead', 'powell', 'cobyla', 'cobyqa') and bool(jac):
            warn(f'Method {method} does not use gradient information (jac).',
                 RuntimeWarning, stacklevel=2)
        # - hess
        if meth not in ('newton-cg', 'dogleg', 'trust-ncg', 'trust-constr',
                        'trust-krylov', 'trust-exact', '_custom') and hess is not None:
            warn(f'Method {method} does not use Hessian information (hess).',
                 RuntimeWarning, stacklevel=2)
        # - hessp
        if meth not in ('newton-cg', 'trust-ncg', 'trust-constr',
                        'trust-krylov', '_custom') \
           and hessp is not None:
            warn(f'Method {method} does not use Hessian-vector product'
                 ' information (hessp).',
                 RuntimeWarning, stacklevel=2)
        # - constraints or bounds
        if (meth not in ('cobyla', 'cobyqa', 'slsqp', 'trust-constr', '_custom') and
                np.any(constraints)):
            warn(f'Method {method} cannot handle constraints.',
                 RuntimeWarning, stacklevel=2)
        if meth not in (
                'nelder-mead', 'powell', 'l-bfgs-b', 'cobyla', 'cobyqa', 'slsqp',
                'tnc', 'trust-constr', '_custom') and bounds is not None:
            warn(f'Method {method} cannot handle bounds.',
                 RuntimeWarning, stacklevel=2)
        # - return_all
        if (meth in ('l-bfgs-b', 'tnc', 'cobyla', 'cobyqa', 'slsqp') and
                options.get('return_all', False)):
            warn(f'Method {method} does not support the return_all option.',
                 RuntimeWarning, stacklevel=2)
    
        # check gradient vector
        if callable(jac):
            pass
        elif jac is True:
            # fun returns func and grad
            fun = MemoizeJac(fun)
            jac = fun.derivative
        elif (jac in FD_METHODS and
              meth in ['trust-constr', 'bfgs', 'cg', 'l-bfgs-b', 'tnc', 'slsqp']):
            # finite differences with relative step
            pass
        elif meth in ['trust-constr']:
            # default jac calculation for this method
            jac = '2-point'
        elif jac is None or bool(jac) is False:
            # this will cause e.g. LBFGS to use forward difference, absolute step
            jac = None
        else:
            # default if jac option is not understood
            jac = None
    
        # set default tolerances
        if tol is not None:
            options = dict(options)
            if meth == 'nelder-mead':
                options.setdefault('xatol', tol)
                options.setdefault('fatol', tol)
            if meth in ('newton-cg', 'powell', 'tnc'):
                options.setdefault('xtol', tol)
            if meth in ('powell', 'l-bfgs-b', 'tnc', 'slsqp'):
                options.setdefault('ftol', tol)
            if meth in ('bfgs', 'cg', 'l-bfgs-b', 'tnc', 'dogleg',
                        'trust-ncg', 'trust-exact', 'trust-krylov'):
                options.setdefault('gtol', tol)
            if meth in ('cobyla', '_custom'):
                options.setdefault('tol', tol)
            if meth == 'cobyqa':
                options.setdefault('final_tr_radius', tol)
            if meth == 'trust-constr':
                options.setdefault('xtol', tol)
                options.setdefault('gtol', tol)
                options.setdefault('barrier_tol', tol)
    
        if meth == '_custom':
            # custom method called before bounds and constraints are 'standardised'
            # custom method should be able to accept whatever bounds/constraints
            # are provided to it.
            return method(fun, x0, args=args, jac=jac, hess=hess, hessp=hessp,
                          bounds=bounds, constraints=constraints,
                          callback=callback, **options)
    
        constraints = standardize_constraints(constraints, x0, meth)
    
        remove_vars = False
        if bounds is not None:
            # convert to new-style bounds so we only have to consider one case
            bounds = standardize_bounds(bounds, x0, 'new')
            bounds = _validate_bounds(bounds, x0, meth)
    
            if meth in {"tnc", "slsqp", "l-bfgs-b"}:
                # These methods can't take the finite-difference derivatives they
                # need when a variable is fixed by the bounds. To avoid this issue,
                # remove fixed variables from the problem.
                # NOTE: if this list is expanded, then be sure to update the
                # accompanying tests and test_optimize.eb_data. Consider also if
                # default OptimizeResult will need updating.
    
                # determine whether any variables are fixed
                i_fixed = (bounds.lb == bounds.ub)
    
                if np.all(i_fixed):
                    # all the parameters are fixed, a minimizer is not able to do
                    # anything
                    return _optimize_result_for_equal_bounds(
                        fun, bounds, meth, args=args, constraints=constraints
                    )
    
                # determine whether finite differences are needed for any grad/jac
                fd_needed = (not callable(jac))
                for con in constraints:
                    if not callable(con.get('jac', None)):
                        fd_needed = True
    
                # If finite differences are ever used, remove all fixed variables
                # Always remove fixed variables for TNC; see gh-14565
                remove_vars = i_fixed.any() and (fd_needed or meth == "tnc")
                if remove_vars:
                    x_fixed = (bounds.lb)[i_fixed]
                    x0 = x0[~i_fixed]
                    bounds = _remove_from_bounds(bounds, i_fixed)
                    fun = _Remove_From_Func(fun, i_fixed, x_fixed)
    
                    if callable(callback):
                        sig = inspect.signature(callback)
                        if set(sig.parameters) == {'intermediate_result'}:
                            # callback(intermediate_result)
                            print(callback)
                            callback = _Patch_Callback_Equal_Variables(
                                callback, i_fixed, x_fixed
                            )
                        else:
                            # callback(x)
                            callback = _Remove_From_Func(callback, i_fixed, x_fixed)
    
                    if callable(jac):
                        jac = _Remove_From_Func(jac, i_fixed, x_fixed, remove=1)
    
                    # make a copy of the constraints so the user's version doesn't
                    # get changed. (Shallow copy is ok)
                    constraints = [con.copy() for con in constraints]
                    for con in constraints:  # yes, guaranteed to be a list
                        con['fun'] = _Remove_From_Func(con['fun'], i_fixed,
                                                       x_fixed, min_dim=1,
                                                       remove=0)
                        if callable(con.get('jac', None)):
                            con['jac'] = _Remove_From_Func(con['jac'], i_fixed,
                                                           x_fixed, min_dim=2,
                                                           remove=1)
            bounds = standardize_bounds(bounds, x0, meth)
    
        # selects whether to use callback(x) or callback(intermediate_result)
        callback = _wrap_callback(callback, meth)
    
        if meth == 'nelder-mead':
            res = _minimize_neldermead(fun, x0, args, callback, bounds=bounds,
                                       **options)
        elif meth == 'powell':
            res = _minimize_powell(fun, x0, args, callback, bounds, **options)
        elif meth == 'cg':
            res = _minimize_cg(fun, x0, args, jac, callback, **options)
        elif meth == 'bfgs':
            res = _minimize_bfgs(fun, x0, args, jac, callback, **options)
        elif meth == 'newton-cg':
            res = _minimize_newtoncg(fun, x0, args, jac, hess, hessp, callback,
                                     **options)
        elif meth == 'l-bfgs-b':
            res = _minimize_lbfgsb(fun, x0, args, jac, bounds,
                                   callback=callback, **options)
        elif meth == 'tnc':
            res = _minimize_tnc(fun, x0, args, jac, bounds, callback=callback,
                                **options)
        elif meth == 'cobyla':
            res = _minimize_cobyla(fun, x0, args, constraints, callback=callback,
                                   bounds=bounds, **options)
        elif meth == 'cobyqa':
            res = _minimize_cobyqa(fun, x0, args, bounds, constraints, callback,
                                   **options)
        elif meth == 'slsqp':
            res = _minimize_slsqp(fun, x0, args, jac, bounds,
                                  constraints, callback=callback, **options)
        elif meth == 'trust-constr':
>           res = _minimize_trustregion_constr(fun, x0, args, jac, hess, hessp,
                                               bounds, constraints,
E                                              TypeError: scipy.optimize._trustregion_constr.minimize_trustregion_constr._minimize_trustregion_constr() argument after ** must be a mapping, not _CountingAttr

args       = ()
bounds     = None
callback   = None
constraints = []
fun        = <function rosen at 0x7f1e641d7c40>
hess       = None
hessp      = <function rosen_hess_prod at 0x7f1e64208040>
jac        = <function rosen_der at 0x7f1e641d7ba0>
meth       = 'trust-constr'
method     = 'trust-constr'
options    = _CountingAttr(counter=130, _default=Factory(factory=<function OptimizerScipy.<lambda> at 0x7f1f52841940>, takes_self=False), repr=True, eq=True, order=True, hash=None, init=True, on_setattr=None, alias=None, metadata={})
remove_vars = False
tol        = None
x0         = array([1.3, 0.7, 0.8, 1.9, 1.2], dtype=float32)

.venv/lib/python3.13.../scipy/optimize/_minimize.py:799: TypeError
View the full list of 1 ❄️ flaky tests
tests.optim.test_pncg::test_optimizer_pncg[x00]

Flake rate in main: 41.18% (Passed 10 times, Failed 7 times)

Stack Traces | 0.003s run time
x0 = Array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.], dtype=float32)

    @pytest.mark.parametrize("x0", [jnp.ones((10,))])
    def test_optimizer_pncg(x0: jax.Array) -> None:
        optimizer = optim.PNCG(maxiter=10**4)
>       result: optim.OptimizeResult = optimizer.minimize(
            fun=fun, x0=x0, jac=jac, hess_diag=hess_diag, hess_quad=hess_quad
        )

optimizer  = PNCG(maxiter=10000)
x0         = Array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.], dtype=float32)

tests/optim/test_pncg.py:32: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../apple/optim/optimizer.py:65: in minimize
    result: OptimizeResult = self._minimize_impl(problem, x0, args, **kwargs)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        args       = ()
        callback   = None
        fun        = _JitWrapper(
  fn='fun', filter_warning=False, donate_first=False, donate_rest=False
)
        fun_and_jac = None
        hess       = None
        hess_diag  = _JitWrapper(
  fn='hess_diag', filter_warning=False, donate_first=False, donate_rest=False
)
        hess_quad  = _JitWrapper(
  fn='hess_quad', filter_warning=False, donate_first=False, donate_rest=False
)
        hessp      = None
        jac        = _JitWrapper(
  fn='jac', filter_warning=False, donate_first=False, donate_rest=False
)
        jac_and_hess_diag = None
        kwargs     = {}
        problem    = OptimizationProblem(
  fun=_JitWrapper(
    fn='fun', filter_warning=False, donate_first=False, donate_rest=False
  ),...lse
  ),
  hess_quad=_JitWrapper(
    fn='hess_quad', filter_warning=False, donate_first=False, donate_rest=False
  )
)
        self       = PNCG(maxiter=10000)
        timer      = Timer(name='PNCG', clocks=('perf',), timings=defaultdict(<class 'list'>, {'perf': [0.0002482060000090769]}), _start_ti...6fcb8dd0 for function at 0x7f1f6fcca7a0>, cb_finish=<FunctionWrapper at 0x7f1f6fcb8e40 for function at 0x7f1f6fccb420>)
        x0         = Array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.], dtype=float32)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = PNCG(maxiter=10000)
problem = OptimizationProblem(
  fun=_JitWrapper(
    fn='fun', filter_warning=False, donate_first=False, donate_rest=False
  ),...lse
  ),
  hess_quad=_JitWrapper(
    fn='hess_quad', filter_warning=False, donate_first=False, donate_rest=False
  )
)
x0 = Array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.], dtype=float32), args = ()
kwargs = {}

    @override
    def _minimize_impl(
        self,
        problem: OptimizationProblem,
        x0: Float[ArrayLike, " N"],
        args: Sequence,
        **kwargs,
    ) -> OptimizeResult:
        assert callable(problem.hess_quad)
>       assert callable(problem.jac_and_hess_diag)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       AssertionError

args       = ()
kwargs     = {}
problem    = OptimizationProblem(
  fun=_JitWrapper(
    fn='fun', filter_warning=False, donate_first=False, donate_rest=False
  ),...lse
  ),
  hess_quad=_JitWrapper(
    fn='hess_quad', filter_warning=False, donate_first=False, donate_rest=False
  )
)
self       = PNCG(maxiter=10000)
x0         = Array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.], dtype=float32)

.../apple/optim/pncg.py:54: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autofix Apply linters automatic fixes. automerge Merge the pull request once unit tests and other checks pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants