-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BigFloat matrix in partialschur() does not work #94
Comments
Thanks, I will look into that. There should be a fallback for this in Julia base when the |
Ref: JuliaLang/julia#29634 and |
Workaround if you really need it and don't care about performance so much: Write your own fallback. import LinearAlgebra.BLAS.gemv!
function gemv!(C,alpha,A,X,beta,Y)
if (C=='N')
Y[:]=alpha*A*X+beta*Y
elseif (C=='T')
Y[:]=alpha*transpose(A)*X+beta*Y
elseif (C=='C')
Y[:]=alpha*A'*X+beta*Y
else
error("Unknown transpose character")
end
end Output: julia> mwe()
10×10 SparseMatrixCSC{Float64,Int64} with 28 stored entries:
[1 , 1] = 2.0
[2 , 1] = -1.0
[1 , 2] = -1.0
[2 , 2] = 2.0
[3 , 2] = -1.0
[2 , 3] = -1.0
[3 , 3] = 2.0
[4 , 3] = -1.0
[3 , 4] = -1.0
[4 , 4] = 2.0
[5 , 4] = -1.0
[4 , 5] = -1.0
⋮
[7 , 6] = -1.0
[6 , 7] = -1.0
[7 , 7] = 2.0
[8 , 7] = -1.0
[7 , 8] = -1.0
[8 , 8] = 2.0
[9 , 8] = -1.0
[8 , 9] = -1.0
[9 , 9] = 2.0
[10, 9] = -1.0
[9 , 10] = -1.0
[10, 10] = 2.0
PartialSchur decomposition (Float64) of dimension 10
eigenvalues:
10-element Array{Complex{Float64},1}:
0.08101405277100521 + 0.0im
0.3174929343376377 + 0.0im
0.6902785321094296 + 0.0im
1.1691699739962276 + 0.0im
1.7153703234534308 + 0.0im
2.284629676546571 + 0.0im
2.830830026003773 + 0.0im
3.3097214678905718 + 0.0im
3.682507065662364 + 0.0im
3.918985947228997 + 0.0im
10×10 SparseMatrixCSC{BigFloat,Int64} with 28 stored entries:
[1 , 1] = 2.0
[2 , 1] = -1.0
[1 , 2] = -1.0
[2 , 2] = 2.0
[3 , 2] = -1.0
[2 , 3] = -1.0
[3 , 3] = 2.0
[4 , 3] = -1.0
[3 , 4] = -1.0
[4 , 4] = 2.0
[5 , 4] = -1.0
[4 , 5] = -1.0
⋮
[7 , 6] = -1.0
[6 , 7] = -1.0
[7 , 7] = 2.0
[8 , 7] = -1.0
[7 , 8] = -1.0
[8 , 8] = 2.0
[9 , 8] = -1.0
[8 , 9] = -1.0
[9 , 9] = 2.0
[10, 9] = -1.0
[9 , 10] = -1.0
[10, 10] = 2.0
PartialSchur decomposition (BigFloat) of dimension 10
eigenvalues:
10-element Array{Complex{BigFloat},1}:
8.101405277100522021926388586734460187509030315567608991100988200961938340741451e-02 + 0.0im
3.174929343376376622763767021612645649734150031589242027146997646366977861967341e-01 + 0.0im
6.902785321094298718861498550674128936324176013261431447874087909882098201012722e-01 + 0.0im
1.169169973996227148941451701540753592951990179070926375147553335243120438110192 + 0.0im
1.715370323453429719112414662767260662417897277748031343163834426881989020798096 + 0.0im
2.284629676546570280887585337232739337582102722251968656836165573118010979201559 + 0.0im
2.830830026003772851058548298459246407048009820929073624852446664756879561889998 + 0.0im
3.309721467890570128113850144932587106367582398673856855212591209011790179898892 + 0.0im
3.682507065662362337723623297838735435026584996841075797285300235363302213803357 + 0.0im
3.918985947228994779780736114132655398124909696844323910088990117990380616592766 + 0.0im
julia> |
Tack! :) |
Any thoughts on adding tutorials in the online documentation? I think this workaround would be suitable there rather than doing some (dirty?) fix in the code. |
I really appreciate this example, very illuminating. |
What needs to be done to get this running for arbitrary number types? I'm very interested to have this working (I don't dare try to compile PETSc and SLEPc in 128 bit versions and somehow interface to it...). |
JuliaLang/julia#29634 landed in Julia in the meantime, so what has to be changed is And replace https://github.com/haampie/ArnoldiMethod.jl/blob/da85958072ec54c64c7dca8362eb42e572252f62/src/expansion.jl#L35 by the corresponding |
Is the using ArnoldiMethod, LinearAlgebra
import LinearAlgebra.BLAS.gemv!
function gemv!(C,alpha,A,X,beta,Y)
if (C=='N')
Y.=alpha*A*X+beta*Y
elseif (C=='T')
Y.=alpha*transpose(A)*X+beta*Y
elseif (C=='C')
Y.=alpha*A'*X+beta*Y
else
error("Unknown transpose character")
end
end
a=big.(randn(10,10))
partialschur(a) leads to:
Does changing to |
MWE:
Output:
The text was updated successfully, but these errors were encountered: