Skip to content

Commit

Permalink
Fix P::LE::NR2::Field, as it modified haydock coeffs. inadvertently
Browse files Browse the repository at this point in the history
  • Loading branch information
wlmb committed Dec 4, 2024
1 parent 3be5dbd commit 6c7e4f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- Modify P::LE::NR2::Field so as not to modify Haydock coefficients
inadvertently
0.023 2024-10-02
- Add tests for modules ST
- Add tensorial modules ST, to deal with anisotropic components
Expand Down
7 changes: 7 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# -*- mode: org; -*-

* TODO [2024-12-04 Wed] Field modifies silently haydock coefficients
We found P::LE::NR2::Field uses cgtsv, a routine that modifies its
arguments. We used to pass a subdiagonal and supradiagonal which are
both given by the b coefficients. We used the same ndarray, so when
the subdiagonal is modified, the supradiagonal is erroneously
modified. The results were wrong.
* TODO [2024-11-01 Fri] It seems WE::S::Green doesn't compute antisymmetric part. Fix and test.
* DONE [2021-09-30 Sun] Add example/test with non Cartesian coordinates
* TODO [2021-09-25 Sat] Check if it is clear that complexCoeffs is equivalent to non is_hermitian
* DONE Return as, bs, b2s as pdl instead of array?
Expand Down
4 changes: 2 additions & 2 deletions lib/Photonic/LE/NR2/Field.pm
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ sub _build_field {
# At first take D=|0>
my $diag=$u - $as->(0:$nh-1);
# rotate complex zero from first to last element.
my $subdiag=-$bs->(0:$nh-1)->rotate(-1)->r2C;
my $supradiag=$subdiag;
my $subdiag=-$bs->(0:$nh-1)->copy->rotate(-1)->r2C;
my $supradiag=$subdiag->copy;
my $rhs=PDL->zeroes($nh);
$rhs->((0)).=1;
$rhs=$rhs->r2C;
Expand Down

0 comments on commit 6c7e4f7

Please sign in to comment.