Skip to content

Commit

Permalink
fixeltype in collocation!
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Aug 9, 2018
1 parent ca1d29d commit 96defff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/codim1lc/problem.jl
Expand Up @@ -5,6 +5,7 @@ using StaticArrays: SVector, SMatrix, Size

using Jacobi: lagrange, zgj, wgj
using ..PolyUtils: dlagrange
using ..ArrayUtils: fixeltype

using ..CompatUtils: @required
import ..Continuations: get_prob_cache, get_u0, residual!, residual_jacobian!,
Expand Down Expand Up @@ -250,7 +251,10 @@ end
= get_samples(cache, u, j) # xₚ(τₖ)
x =* lpv' # x(ζ) = x(τ) * ℓ
dx =* lpd' # x'(ζ) = x'(τ) * ℓ
return x, dx
return (
fixeltype(eltype(u), x), # TODO: don't
fixeltype(eltype(u), dx),
)
end
# TODO: store ℓ (not ℓᵀ) in lpv? (Why not?)

Expand Down
8 changes: 2 additions & 6 deletions src/utils/array_utils.jl
Expand Up @@ -55,18 +55,14 @@ fixeltype(::Type{T}, v::AbstractArray{T}) where {T} = v
end
end

#=
@generated function fixeltype(::Type{E}, M::SMatrix) where {E}
s = Size(M)
S1 = s[1]
S2 = s[2]
@generated function fixeltype(::Type{E}, M::SMatrix{S1, S2, Any}
) where {E, S1, S2}
L = S1 * S2
values = [:(M[$i]) for i in 1:L]
quote
SMatrix{$S1, $S2, $E}($(values...))
end
end
=#

isalmostzero(xs::AbstractArray, atol) = all(x -> isalmostzero(x, atol), xs)
isalmostzero(x, atol) = abs(x) < atol
Expand Down

0 comments on commit 96defff

Please sign in to comment.