Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VectorFun #51

Closed
goretkin opened this issue Dec 2, 2014 · 7 comments
Closed

VectorFun #51

goretkin opened this issue Dec 2, 2014 · 7 comments

Comments

@goretkin
Copy link
Contributor

goretkin commented Dec 2, 2014

I'm trying to construct a vector-valued Fun as follows, but it doesn't seem to be a proper Fun. (It seems to work with FFun, though)

julia> y0 = Fun(x->[1.0, 0.0])
Fun{VectorDomainSpace{2,UltrasphericalSpace{0},Float64},Float64}([1.0],VectorDomainSpace{2,UltrasphericalSpace{0},Float64}(UltrasphericalSpace{0}(Interval{Float64}(-1.0,1.0))))

julia> y0[1.0]
ERROR: BoundsError()
 in clenshaw at /Users/goretkin/.julia/v0.3/ApproxFun/src/LinearAlgebra/clenshaw.jl:28
 in evaluate at /Users/goretkin/.julia/v0.3/ApproxFun/src/Multivariate/VectorFun.jl:69
 in getindex at /Users/goretkin/.julia/v0.3/ApproxFun/src/Fun/Fun.jl:69
@goretkin
Copy link
Contributor Author

goretkin commented Dec 2, 2014

weird. y = Fun(x->[0.0, 1.0] ) doesn't cause the same error

@goretkin
Copy link
Contributor Author

goretkin commented Dec 2, 2014

I understand the reason behind using [] indexing on Funs, to emphasize that these are infinite dimensional vectors, but vectors nonetheless. I think, though, it might be interesting to consider using () to index the Fun variable, and [] to access elements of multi-dimensional valued Funs (like vector valued Funs, not multivariate Funs)

@dlfivefifty
Copy link
Member

Yes I agree. The real reason for overriding [] is it wasn’t impossible to override() in 0.3. But it should be in 0.4.

In the meantime, you vec(f) will convert it vector-valued Fun to a vector of scalar-valued funs, so you can do e.g. vec(f)[1][.1]

Sheehan

On 2 Dec 2014, at 10:48 am, Gustavo Goretkin notifications@github.com wrote:

I understand the reason behind using [] indexing on Funs, to emphasize that these are infinite dimensional vectors, but vectors nonetheless. I think, though, it might be interesting to consider using () to index the Fun variable, and [] to access elements of multi-dimensional valued Funs (like vector valued Funs, not multivariate Funs)


Reply to this email directly or view it on GitHub #51 (comment).

@goretkin
Copy link
Contributor Author

goretkin commented Dec 2, 2014

Good to know that!

@goretkin
Copy link
Contributor Author

goretkin commented Dec 2, 2014

Here is a different error when trying to construct a vector-valued fun

julia> Fun(x->Float64[0.0], 50)
ERROR: `plan_r2r` has no method matching plan_r2r(::Array{Array{Float64,1},1}, ::Int32, ::UnitRange{Int64}, ::Uint32, ::Float64)
 in chebyshevtransform at /Users/goretkin/.julia/v0.3/ApproxFun/src/LinearAlgebra/chebyshevtransform.jl:27
 in transform at /Users/goretkin/.julia/v0.3/ApproxFun/src/Spaces/Ultraspherical/ChebyshevSpace.jl:22
 in Fun at /Users/goretkin/.julia/v0.3/ApproxFun/src/Fun/constructors.jl:10
 in Fun at /Users/goretkin/.julia/v0.3/ApproxFun/src/Fun/constructors.jl:26

@goretkin
Copy link
Contributor Author

goretkin commented Dec 2, 2014

Sorry for the rapid-fire. Is there a way to convert from an Array of scalar-valued Funs to a Vector Fun? the opposite of vec()

@dlfivefifty
Copy link
Member

devec()

Sent from my iPhone

On 2 Dec 2014, at 11:37 am, Gustavo Goretkin notifications@github.com wrote:

Sorry for the rapid-fire. Is there a way to convert from an Array of scalar-valued Funs to a Vector Fun? the opposite of vec()


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants