Missing `\` method in Julia 1.0 (SparseMatrixCSC{Int64,Int64} \ Vector{Float64})

X::SparseMatrixCSC{Int64,Int64}
y::Vector{Float64}
X \ y
ERROR: MethodError: no method matching lu!(::SparseArrays.SparseMatrixCSC{Float64,Int64}, ::Val{false}; check=false)

Is there a replacement for it in Julia 1.0?

The example is not complete. x and y are not defined. If you would provide a complete example, Julia 0.7 would give you the answer.

One variant,

using Random: seed!, shuffle
using SparseArrays: sparse
seed!(0)
X = reshape(1:100, 50, 2) |> sparse;
y = shuffle(1:50);
X \ y
ERROR: MethodError: no method matching eps(::Type{Int64})

Another variant,

using SparseArrays: spdiagm
λ = 1600
y = 100 * log.([43606,43808,44201,44579,44681,45033,45295,45029,44238,43739,43784,43517,43952,45084,46442,46855,47871,48068,47955,48309,48504,48286,49319,50164,50475,50522,50365,49702,49158,48896,48882,49331,49963,50790,51262,51805,52295,52584,52601,52930,53157,53066,52932,52385,51300,50912,51506,52088,53016,53679,53429,54175,54458,54347,54228,53744,53662,53977,54388,54871,55276,55644,55977,56028,56322,56658,57077,57360,57898,58221,58903,59421,60003,60690,61490,62321,63192,64110,64644,65200,65530,65750,66164,66900,67295,67904,68487,69246,69905,70636,70917,71240,71452,71029,70948,70790,70859,71253,71617,72108,72945,73760,74263,75270,76285,76887,77276,78035,78296,78602,78611,77657,76649,76520,77230,78018,79049,79376,79892,80448,81391,82488,83532,84408,85461,86951,87618,88673,89480,90109,90325,90673,90994,90099,90210,90943,91210,91490,91479,90893,90432,89864,89183,88769,89090,90022,91247,92227,93429,94479,95344,96107,96843,97459,98045,98609,98935,99155,99934,100511,101164,101900,102646,103664,104487,105324,106009,106906,107619,108026,108365,108849,109647,109862,109525,109160,108577,108338,108340,108325,108368,108721,108966,109496,109998,110754,111451,112312,113248,114246,115254,116164,116913,117294,117887,118322,119002,119774,120427,121147,122000,122818,123605,124554,125177,126080,126774,127601,128244,129091,129791,130780,131608,132075,132377,132731,132752,132302,131793,131005,130713,130684,130526,130505,130238,130195,130281,130618,131158,131791,132120,132660,133169,133955,134593,135174,136049,136337,136883,137266,137785,138085,138116,138413,138268,137708,136781,134844,132527,131020,130260,129774,129896,130528,130372,130840,131295,131949,132372,132927,133761,134038,134552,135076,135712,136268,136862,137387,138014,138843,139579,140402,140972,141724,142300,143146,143733,144175]);
N = length(y);
H = spdiagm(-2 => fill(λ, N-2),
                -1 => vcat(-2λ, fill(-4λ, N - 3), -2λ),
                 0 => vcat(1 + λ, 1 + 5λ, fill(1 + 6λ, N-4),
                           1 + 5λ, 1 + λ),
                 1 => vcat(-2λ, fill(-4λ, N - 3), -2λ),
                 2 => fill(λ, N-2));
H \ y
ERROR: MethodError: no method matching lu!(::SparseArrays.SparseMatrixCSC{Float64,Int64}, ::Val{false}; check=false)
1 Like

Are you on Julia 1.0? I think Julia 0.7 hints at where the method has gone.

Tried it originally on Julia 0.7 (I was porting code from 0.6, but it had no help).

I can confirm that trying this code on 0.7 doesn’t help:

ufechner@tuxedo:~$ julia7
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0 (2018-08-08 06:46 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-pc-linux-gnu

julia> using Random: seed!, shuffle

julia> using SparseArrays: sparse

julia> seed!(0)
Random.MersenneTwister(UInt32[0x00000000], Random.DSFMT.DSFMT_state(Int32[748398797, 1073523691, -1738140313, 1073664641, -1492392947, 1073490074, -1625281839, 1073254801, 1875112882, 1073717145  …  943540191, 1073626624, 1091647724, 1073372234, -1273625233, -823628301, 835224507, 991807863, 382, 0]), [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0  …  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], UInt128[0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000  …  0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000, 0x00000000000000000000000000000000], 1002, 0)

julia> X = reshape(1:100, 50, 2) |> sparse;

julia> y = shuffle(1:50);

julia> X \ y
ERROR: MethodError: no method matching eps(::Type{Int64})
Closest candidates are:
  eps(::Dates.Time) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v0.7/Dates/src/types.jl:334
  eps(::Dates.Date) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v0.7/Dates/src/types.jl:333
  eps(::Dates.DateTime) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v0.7/Dates/src/types.jl:332
  ...
Stacktrace:
 [1] _default_tol(::SparseArrays.SparseMatrixCSC{Int64,Int64}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v0.7/SuiteSparse/src/spqr.jl:139
 [2] qr(::SparseArrays.SparseMatrixCSC{Int64,Int64}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v0.7/SuiteSparse/src/spqr.jl:201
 [3] \(::SparseArrays.SparseMatrixCSC{Int64,Int64}, ::Array{Int64,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v0.7/SparseArrays/src/linalg.jl:1043
 [4] top-level scope at none:0

The error message looks strange to me and is different from the error message on 1.0, though.

It actually also doesn’t work on 0.6, which means this method was never implemented:

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.2 (2017-12-13 18:08 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-pc-linux-gnu

julia> X = reshape(1:100, 50, 2) |> sparse;

julia> y = shuffle(1:50);

julia> X \ y
ERROR: MethodError: no method matching Base.SparseArrays.CHOLMOD.Sparse(::SparseMatrixCSC{Int64,Int64}, ::Int64)
Closest candidates are:
  Base.SparseArrays.CHOLMOD.Sparse(::Integer, ::Integer, ::Array{Int64,1}, ::Array{Int64,1}, ::Array{#s268,1} where #s268<:Union{Complex{Float64}, Float64}) at sparse/cholmod.jl:899
  Base.SparseArrays.CHOLMOD.Sparse(::Integer, ::Integer, ::Array{Int64,1}, ::Array{Int64,1}, ::Array{Tv<:Union{Complex{Float64}, Float64},1}, ::Any) where Tv<:Union{Complex{Float64}, Float64} at sparse/cholmod.jl:865
  Base.SparseArrays.CHOLMOD.Sparse(::SparseMatrixCSC{Tv<:Union{Complex{Float64}, Float64},Int64}, ::Integer) where Tv<:Union{Complex{Float64}, Float64} at sparse/cholmod.jl:913
Stacktrace:
 [1] \(::SparseMatrixCSC{Int64,Int64}, ::Array{Int64,1}) at ./sparse/linalg.jl:873

So I would suggest to file an issue on Github: