BandedMatrices.jl icon indicating copy to clipboard operation
BandedMatrices.jl copied to clipboard

Can't do BandedMatrix{BigFloat} \ Vector

Open putianyi889 opened this issue 6 years ago • 3 comments

>B=BandedMatrix{BigFloat}(ones(3,3), (0,0))
3×3 BandedMatrix{BigFloat,Array{BigFloat,2},Base.OneTo{Int64}}:
 1.0   ⋅    ⋅ 
  ⋅   1.0   ⋅ 
  ⋅    ⋅   1.0

> b=BigFloat[1,2,3]
3-element Array{BigFloat,1}:
 1.0
 2.0
 3.0

> B\b
UndefVarError: banded_lufact! not defined

Stacktrace:
 [1] #lu!#18(::Bool, ::Function, ::BandedMatrix{BigFloat,Array{BigFloat,2},Base.OneTo{Int64}}, ::Val{true}) at C:\Users\putianyi888\.julia\packages\BandedMatrices\aWAyS\src\banded\BandedLU.jl:91
 [2] #lu#19 at .\none:0 [inlined]
 [3] lu at C:\Users\putianyi888\.julia\packages\BandedMatrices\aWAyS\src\banded\BandedLU.jl:97 [inlined] (repeats 2 times)
 [4] factorize at C:\Users\putianyi888\.julia\packages\BandedMatrices\aWAyS\src\banded\linalg.jl:80 [inlined]
 [5] _copyto!(::LazyArrays.DenseColumnMajor, ::Array{BigFloat,1}, ::LazyArrays.Applied{LazyArrays.LayoutApplyStyle{Tuple{BandedMatrices.BandedColumns{LazyArrays.DenseColumnMajor},LazyArrays.DenseColumnMajor}},typeof(\),Tuple{BandedMatrix{BigFloat,Array{BigFloat,2},Base.OneTo{Int64}},Array{BigFloat,1}}}) at C:\Users\putianyi888\.julia\packages\BandedMatrices\aWAyS\src\banded\linalg.jl:9
 [6] copyto! at C:\Users\putianyi888\.julia\packages\LazyArrays\TF9V0\src\lazyapplying.jl:40 [inlined]
 [7] materialize at C:\Users\putianyi888\.julia\packages\LazyArrays\TF9V0\src\linalg\inv.jl:79 [inlined]
 [8] apply at C:\Users\putianyi888\.julia\packages\LazyArrays\TF9V0\src\lazyapplying.jl:20 [inlined]
 [9] \(::BandedMatrix{BigFloat,Array{BigFloat,2},Base.OneTo{Int64}}, ::Array{BigFloat,1}) at C:\Users\putianyi888\.julia\packages\LazyArrays\TF9V0\src\linalg\lazymul.jl:77
 [10] top-level scope at In[42]:1

putianyi889 avatar Aug 04 '19 20:08 putianyi889

This is because LU calls LAPACK, there's not yet a native Julia implementation. (I'm not going to do it: the idea of implementing pivoting is painful to think about.) The error message could be better.

Can you try qr(B)\b? that should work.

dlfivefifty avatar Aug 04 '19 21:08 dlfivefifty

qr works.

putianyi889 avatar Aug 04 '19 21:08 putianyi889

Ah ok. So the easy fix is to make qr the default apart from BlasFloats

dlfivefifty avatar Aug 04 '19 21:08 dlfivefifty