Skip to content

Support for custom types? #23

Open
@juliohm

Description

@juliohm

Can this package handle custom types in a Hilbert space?

import Base: +, *

struct Foo
  x::Float64
  y::Float64
end

+(f1::Foo, f2::Foo) = Foo(f1.x + f2.x, f1.y + f2.y)
*(a::Real, f::Foo) = Foo(a * f.x, a * f.y)

g(x) = Foo(x[1], x[2])
lb, ub = [1,3], [2, 4]
x = chebpoints((10,20), lb, ub)
c = chebinterp(g.(x), lb, ub)
ERROR: MethodError: no method matching zero(::Type{Any})

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions