Skip to content

Commit a38e452

Browse files
committed
restore abs for complex for symplicity
1 parent db03df0 commit a38e452

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

src/madl_complex.mad

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ local is_complex = \a -> istype(complex, a)
5252
local is_scalar = \a -> type(a) == 'number' or istype(complex, a)
5353

5454
-- generic functions
55+
M.abs = \x -> _C.mad_cnum_abs_r (x.re, x.im)
5556
M.ceil = \x -> complex(ceil (x.re), ceil (x.im))
5657
M.floor = \x -> complex(floor(x.re), floor(x.im))
5758
M.frac = \x -> complex(frac (x.re), frac (x.im))

src/madl_gtpsa.mad

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,7 @@ MR.erfcx = \x -> exp(z^2)*erfc(z)
13821382

13831383
-- ctpsa functions ------------------------------------------------------------o
13841384

1385-
MC.abs = \ error("invalid operation 'abs' on complex GTPSA")
1385+
MC.abs = \x,r -> MC.cabs(x, r)
13861386

13871387
function MC.cabs (x, r)
13881388
r = chksiz(r,x) or tpsa_alloc(x.d, x.mo)

src/madl_matrix.mad

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,8 +1406,6 @@ MR.carg = \ error("invalid argument #1 (cmatrix expected)")
14061406
MR.rect = \ error("invalid argument #1 (cmatrix expected)")
14071407
MR.polar = \ error("invalid argument #1 (cmatrix expected)")
14081408

1409-
MC.abs = \ error("invalid argument #1 (matrix expected)")
1410-
14111409
-- special folds --------------------------------------------------------------o
14121410

14131411
local all = \p,r,x -> lbool(land(r, p(x)))

0 commit comments

Comments
 (0)