Skip to content

Commit

Permalink
Fixed #51: Fun(f->Float64[0.0],50)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty committed Dec 6, 2014
1 parent 61f592c commit 43d2921
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Fun/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Fun{T<:Union(Int64,Complex{Int64})}(coefs::Vector{T},d::FunctionSpace)=Fun(float
function Fun(f::Function,d::DomainSpace,n::Integer)
pts=points(d,n)
f1=f(pts[1])


if isa(f1,Vector) && !isa(d,VectorDomainSpace)
return Fun(f,VectorDomainSpace(d,length(f1)),n)
end


T=typeof(f1)

vals=T[f(x) for x in pts]
Expand Down Expand Up @@ -76,7 +83,7 @@ function zerocfsFun(f::Function,d::DomainSpace)
#TODO: reuse function values?
f0=f(first(domain(d)))

if !isa(d,VectorDomainSpace) && isa(f0,Vector) #TODO: is 0. going to always be in canonical?
if !isa(d,VectorDomainSpace) && isa(f0,Vector)
return zerocfsFun(f,VectorDomainSpace(d,length(f0)))
end

Expand Down

0 comments on commit 43d2921

Please sign in to comment.