Skip to content
Snippets Groups Projects
Verified Commit 48456a75 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Switch to permutedims and define `grad` variable

parent b866d393
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,8 @@ slew_rate(::AbstractConstantGradientBlock) = zero(SVector{3, Float64}) ...@@ -38,7 +38,8 @@ slew_rate(::AbstractConstantGradientBlock) = zero(SVector{3, Float64})
qvec(cgb::AbstractConstantGradientBlock) = duration(cgb) .* gradient_strength(cgb) qvec(cgb::AbstractConstantGradientBlock) = duration(cgb) .* gradient_strength(cgb)
function bmat_gradient(cgb::AbstractConstantGradientBlock) function bmat_gradient(cgb::AbstractConstantGradientBlock)
return (grad .* grad') .* duration(cgb)^3 ./3 grad = gradient_strength(cgb)
return (grad .* permutedims(grad)) .* duration(cgb)^3 ./3
end end
function bmat_gradient(cgb::AbstractConstantGradientBlock, qstart) function bmat_gradient(cgb::AbstractConstantGradientBlock, qstart)
...@@ -46,9 +47,10 @@ function bmat_gradient(cgb::AbstractConstantGradientBlock, qstart) ...@@ -46,9 +47,10 @@ function bmat_gradient(cgb::AbstractConstantGradientBlock, qstart)
# qstart^2 * duration + # qstart^2 * duration +
# qstart * grad * duration^2 + # qstart * grad * duration^2 +
# grad * grad * duration^3 / 3 + # grad * grad * duration^3 / 3 +
grad = gradient_strength(cgb)
return ( return (
qstart .* qstart' .* duration(cgb) .+ qstart .* permutedims(qstart) .* duration(cgb) .+
qstart .* grad' .* duration(cgb)^2 .+ qstart .* permutedims(grad) .* duration(cgb)^2 .+
bmat_gradient(cgb) bmat_gradient(cgb)
) )
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment