Commit eb38e343 authored by Alberto Ramos's avatar Alberto Ramos

Minor optiomizations

parent ae7be701
...@@ -30,22 +30,22 @@ for op in (:+, :-, :*, :/, :^, :atan, :hypot) ...@@ -30,22 +30,22 @@ for op in (:+, :-, :*, :/, :^, :atan, :hypot)
if (length(a.der) > length(b.der)) if (length(a.der) > length(b.der))
p = similar(a.prop) p = similar(a.prop)
d = similar(a.der) d = similar(a.der)
for i in 1:length(b.der) @inbounds for i in 1:length(b.der)
d[i] = grad[1]*a.der[i] + grad[2]*b.der[i] d[i] = grad[1]*a.der[i] + grad[2]*b.der[i]
p[i] = a.prop[i] || b.prop[i] p[i] = a.prop[i] || b.prop[i]
end end
for i in length(b.der)+1:length(a.der) @inbounds for i in length(b.der)+1:length(a.der)
d[i] = grad[1]*a.der[i] d[i] = grad[1]*a.der[i]
p[i] = a.prop[i] p[i] = a.prop[i]
end end
else else
p = similar(b.prop) p = similar(b.prop)
d = similar(b.der) d = similar(b.der)
for i in 1:length(a.der) @inbounds for i in 1:length(a.der)
d[i] = grad[1]*a.der[i] + grad[2]*b.der[i] d[i] = grad[1]*a.der[i] + grad[2]*b.der[i]
p[i] = a.prop[i] || b.prop[i] p[i] = a.prop[i] || b.prop[i]
end end
for i in length(a.der)+1:length(b.der) @inbounds for i in length(a.der)+1:length(b.der)
d[i] = grad[2]*b.der[i] d[i] = grad[2]*b.der[i]
p[i] = b.prop[i] p[i] = b.prop[i]
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment