Skip to content

Bug in LangJulia generation #7

@jarlebring

Description

@jarlebring

LangJulia generator sometimes has incorrect usage of axpby!:

julia> (graph,_)=gen_ps([4.0;3.0]);
julia> gen_code("/tmp/bla.jl",graph,lang=LangJulia())
julia> include("/tmp/bla.jl");
julia> dummy(randn(3,3))
ERROR: MethodError: no method matching axpby!(::Float64, ::UniformScaling{Bool}, ::Float64, ::Array{Float64,2})
Closest candidates are:
  axpby!(::Number, ::Union{AbstractArray{T,1}, DenseArray{T,N} where N}, ::Number, ::Union{AbstractArray{T,1}, DenseArray{T,N} where N}) where T<:Union{Complex{Float32}, Complex{Float64}, Float32, Float64} at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/LinearAlgebra/src/blas.jl:566

However, if we enable explicit allocation of the I-matrix it works:

julia> gen_code("/tmp/bla.jl",graph,lang=LangJulia(true,false))

julia> include("/tmp/bla.jl");

julia> dummy(randn(3,3))
3×3 Array{Float64,2}:
  0.360612  -0.800875  0.650747
 -3.79275    3.97425   0.794266
  3.81051    0.342539  3.8338

The reason is: BLAS does not support usage of the built-in I operator. This should be fixable with if-statements in execute_operation!.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions