Skip to content

Calling exp on a ScalarOperator throws a conversion error #258

@Azercoco

Description

@Azercoco

Describe the bug 🐞

The function exp causes an error when called on ScalarOperator and should probably return another ScalarOperator.

Expected behavior

exp should be defined since has_exp(ScalarOperator) = true

Minimal Reproducible Example 👇

File error.jl

using SciMLOperators

a = ScalarOperator(2.0)
println(has_exp(a)) # print true
b = exp(a) # -> causes the error, should probably ScalarOperator(exp(2.0))

Error & Stacktrace ⚠️

ERROR: MethodError: Cannot `convert` an object of type 
  ScalarOperator{Float64, SciMLOperators.FilterKwargs{typeof(SciMLOperators.DEFAULT_UPDATE_FUNC), Tuple{}}} to an object of type 
  AbstractMatrix
The function `convert` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  convert(::Type{T}, ::T) where T
   @ Base Base.jl:126
  convert(::Type{T}, ::LinearAlgebra.Factorization) where T<:AbstractArray
   @ LinearAlgebra ***\.julia\juliaup\julia-1.11.1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\LinearAlgebra\src\factorization.jl:104
  convert(::Type{T}, ::T) where T<:AbstractArray
   @ Base abstractarray.jl:16
  ...

Stacktrace:
 [1] (Matrix)(L::ScalarOperator{Float64, SciMLOperators.FilterKwargs{typeof(SciMLOperators.DEFAULT_UPDATE_FUNC), Tuple{}}})
   @ SciMLOperators ***\.julia\packages\SciMLOperators\KVzmP\src\interface.jl:371
 [2] exp(L::ScalarOperator{Float64, SciMLOperators.FilterKwargs{typeof(SciMLOperators.DEFAULT_UPDATE_FUNC), Tuple{}}})
   @ SciMLOperators ***\.julia\packages\SciMLOperators\KVzmP\src\interface.jl:408
 [3] top-level scope
   @ ***\error.jl:5

Environment (please complete the following information):

I used a temp environement

  • Output of using Pkg; Pkg.status()
  [c0aeaf25] SciMLOperators v0.3.12
  • Output of using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
  [7d9f7c33] Accessors v0.1.38
  [79e6a3ab] Adapt v4.1.1
  [4fba245c] ArrayInterface v7.16.0
  [a33af91c] CompositionsBase v0.1.2
  [187b0558] ConstructionBase v1.5.8
  [ffbed154] DocStringExtensions v0.9.3
  [3587e190] InverseFunctions v0.1.17
  [1914dd2f] MacroTools v0.5.13
  [ae029012] Requires v1.3.0
  [c0aeaf25] SciMLOperators v0.3.12
  [56f22d72] Artifacts v1.11.0
  [2a0f44e3] Base64 v1.11.0
  [76f85450] LibGit2 v1.11.0
  [8f399da3] Libdl v1.11.0
  [37e2e46d] LinearAlgebra v1.11.0
  [d6f4376e] Markdown v1.11.0
  [ca575930] NetworkOptions v1.2.0
  [de0858da] Printf v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v0.7.0
  [cf7118a7] UUIDs v1.11.0
  [4ec0a83e] Unicode v1.11.0
  [e66e0078] CompilerSupportLibraries_jll v1.1.1+0
  [e37daf67] LibGit2_jll v1.7.2+0
  [29816b5a] LibSSH2_jll v1.11.0+1
  [c8ffd9c3] MbedTLS_jll v2.28.6+0
  [4536629a] OpenBLAS_jll v0.3.27+1
  [8e850b90] libblastrampoline_jll v5.11.0+0
  • Output of versioninfo()
ulia Version 1.11.1
Commit 8f5b7ca12a (2024-10-16 10:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × 11th Gen Intel(R) Core(TM) i9-11900F @ 2.50GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, rocketlake)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions