Repository navigation
SwarmVariable reads a non-symmetric matrix back in the order it was written; global_evaluate stops transposing tensors - #988
Conversation
…d-trips global_evaluate returns the full array per node. A symmetric tensor stores only its independent components, so the remap's reshape raised and left the move part done. A MATRIX SwarmVariable packed by rows and unpacked by columns, so it did not read back what was written, and global_evaluate, which carries its answer on one, returned every non-symmetric tensor transposed. Part of #977. Underworld development team with AI support from Claude Code
… follow the layout The two errors that cancelled for a square matrix also cancelled in _refine_prolongate, _refine_restrict and the monotone limit, so those read a matrix transposed once global_evaluate was right. A single row or column still takes the plain reshape, which keeps assigning (N, dim, 1) to a vector. Underworld development team with AI support from Claude Code
Adversarial reviewTwo independent reviews, by reading code; neither ran anything. The first read the original commit; the second read it stacked with the #979 work. The follow-up commit was not re-reviewed. Fixed
Known and left
Attacks that found nothing
Issue verdicts: #977 still live, keep it open. Underworld development team with AI support from Claude Code |
Development's _evaluated_in_storage_layout (7bfdfaa) does what this branch's _values_in_data_layout did, with units, so the conflicts take development's helper, and the limiter takes development's per-entry bounds (this branch's reorder would now permute twice). What remains here is the swarm view of a full matrix and the symmetric-tensor tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Rebased on #982 and development 526edb9 (c4d31f9). Most of this PR is now on development. 7bfdfaa (2026-11-08, "global_evaluate returns a MATRIX in its components, and deform and refinement store every shape in its slot") added What remains:
Locally: test_0769 and test_0768 pass, 9 tests; test_0769 at np 2 passes. The title overstates the PR now, so I'll rename it when it's reviewed again. Underworld development team with AI support from Claude Code |
The two conflicts combine both sides: the evaluation stays at the non-dimensional coordinates the DM holds (this branch), and the result is laid out by development's _evaluated_in_storage_layout, which also reduces a dimensional evaluation to the non-dimensional values var.data holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SwarmVariablenow reads back a non-symmetricMATRIXorTENSORin the order it was written. That was whyglobal_evaluatereturned such tensors transposed. Part of #977. Stacked on #982, so merge #959 and #982 first.Scope after the development merge. When this PR was opened it also wrote remapped values in each variable's own layout and reordered the limiter's bounds. Development now has both, through #1002's
_evaluated_in_storage_layout. The merge keeps development's helper and drops this PR's_values_in_data_layout, since keeping both would permute twice. The source change is nowswarm.pyalone (+2 −1).What was wrong
global_evaluatecarries its answer on aMATRIXSwarmVariable, which packed by rows and unpacked by columns, soarraydid not read back what was written. Write[[1,2],[3,4]]and you read[[1,3],[2,4]], in serial too. On aMATRIXmesh variable the transposition cancelled against the C-order reshape, which is why it went unnoticed.The change
SwarmVariable._pack_array_to_data_formatfollows_data_layout. A single row or column keeps the plain reshape.Tests
tests/test_0769_remap_symmetric_tensor.pyand its parallel file are kept, covering the symmetric tensor,TENSOR,MATRIX, the swarm round trip,global_evaluateagainstevaluate, and the limiter.test_a_swarm_matrix_reads_back_what_was_writtenfails. The others now pass through development's helper, so that one test guards this change.test_0785units-deform case comes in from The mesh-move remap has no limiter by default, and a variable's kd-tree follows a mover #982, which sets its clamp explicitly.Who could be affected
Any code that called
global_evaluateon a non-symmetricTENSORexpression got a transposed answer. I found no caller that compensates for it. Non-squareMATRIXshapes other than a single row or column were not run.Not in this PR
Mesh.remesh, the main subject of #977, andpack_raw_data_to_petscare untouched, so #977 stays open.Checklist (UW3 Style Charter)
level_*andtier_*markers.array/mesh.X.coordsUnderworld development team with AI support from Claude Code