Skip to content

Commit c2d3afd

Browse files
committed
typos; init constant
1 parent 0595115 commit c2d3afd

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/mathfuns.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ for (meth, libnm, modu) in [
101101
IMPLEMENT_TWO_ARG_FUNC(modu, meth, libnm)
102102
end
103103

104-
const TWO = Basic(2)
105104
function abs2!(a::Basic, x::Basic)
105+
TWO = Basic(2) # put in init
106106
a = abs!(a, x)
107107
a = pow!(a, x, TWO)
108108
a

src/mathops.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function sum!(a::Basic, v::CVecBasic)
4747
end
4848
function sum(v::CVecBasic)
4949
a = Basic()
50-
sum!(a, b)
50+
sum!(a, v)
5151
end
5252

5353
+(b1::Basic, b2::Basic, b3::Basic, bs...) = sum(convert(CVecBasic, [b1, b2, b3, bs...]))
@@ -67,7 +67,7 @@ function prod!(a::Basic, v::CVecBasic)
6767
end
6868
function prod(v::CVecBasic)
6969
a = Basic()
70-
prod!(a, b)
70+
prod!(a, v)
7171
end
7272

7373
*(b1::Basic, b2::Basic, b3::Basic, bs::Vararg{Number, N}) where {N} = prod(convert(CVecBasic, [b1, b2, b3, bs...]))

test/runtests.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,20 +356,19 @@ end
356356
end
357357

358358
@vars a x y
359-
@testset "non-allocating methods" begin
359+
@testset "non-allocating(ish) methods" begin
360360
SymEngine.sin!(a,x); SymEngine.cos!(a,x); SymEngine.abs!(a,x)
361361
SymEngine.pow!(a,x,x);
362362
SymEngine.add!(a,x,x);SymEngine.mul!(a,x,x)
363363
SymEngine.sub!(a,x,x);SymEngine.div!(a,x,x)
364364
@test (@allocations SymEngine.sin!(a,x)) == 0
365365
@test (@allocations SymEngine.cos!(a,x)) == 0
366-
@test (@allocations SymEngine.abs2!(a,x)) == 0
367366
@test (@allocations SymEngine.pow!(a,x,x)) == 0
368367

369368
# still allocates 1 (or 2)
370369
@test (@allocations SymEngine.add!(a,x,y)) < (@allocations x+y)
371370
@test (@allocations SymEngine.sub!(a,x,y)) < (@allocations x-y)
372371
@test (@allocations SymEngine.mul!(a,x,y)) < (@allocations x*y)
373372
@test (@allocations SymEngine.div!(a,x,y)) < (@allocations x/y)
374-
373+
@test (@allocations SymEngine.abs2!(a,x)) < (@allocations abs2(x))
375374
end

0 commit comments

Comments
 (0)