Skip to content

Commit 51fceec

Browse files
authored
Enable specialization when dividing by scalars (#143)
1 parent 1b83965 commit 51fceec

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BlockSparseArrays"
22
uuid = "2c9a651f-6452-4ace-a6ac-809f4280fbb4"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.7.8"
4+
version = "0.7.9"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/abstractblocksparsearray/map.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,15 @@ function Base.isreal(a::AnyAbstractBlockSparseArray)
111111
return @interface interface(a) isreal(a)
112112
end
113113

114+
# Helps with specialization of block operations by avoiding
115+
# having anonymous functions constructed inside the map/broadcast
116+
# code logic.
114117
function Base.:*(x::Number, a::AnyAbstractBlockSparseArray)
115118
return map(Base.Fix1(*, x), a)
116119
end
117120
function Base.:*(a::AnyAbstractBlockSparseArray, x::Number)
118121
return map(Base.Fix2(*, x), a)
119122
end
123+
function Base.:/(a::AnyAbstractBlockSparseArray, x::Number)
124+
return map(Base.Fix2(/, x), a)
125+
end

0 commit comments

Comments
 (0)