Skip to content

Commit ce0ddc2

Browse files
committed
norm to work inplace
1 parent b4a6186 commit ce0ddc2

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
- allaxis*vals can now take 1-D ndarrays as start and endpoints
22
- PP operation for inverse Transform::t_spherical
33
- add PDL::Guide::NumPy doc (#361)
4+
- norm works inplace
45

56
2.103 2026-03-03
67
- fix regression in *linvals so takes ndarrays as start and end again

lib/PDL/Primitive.pd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ EOD
414414

415415
pp_def('norm',
416416
HandleBad => 1,
417+
Inplace => 1,
417418
Pars => 'vec(n); [o] norm(n)',
418419
GenericTypes => [ppdefs_all],
419420
Doc => 'Normalises a vector to unit Euclidean length

t/primitive-misc.t

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ subtest hist => sub {
1414
subtest norm => sub {
1515
my $x = pdl('[[i 2+3i] [4+5i 6+7i]]');
1616
is_pdl $x->norm,
17-
pdl(
17+
my $exp = pdl(
1818
[
1919
[ 0.267261 * i, 0.534522 + 0.801783 * i ],
2020
[ 0.356348 + 0.445435 * i, 0.534522 + 0.623609 * i ],
2121
]
2222
),
2323
'native complex norm works';
24+
$x->inplace->norm;
25+
is_pdl $x, $exp, 'norm works inplace';
2426
};
2527

2628
subtest glue => sub {

0 commit comments

Comments
 (0)