Skip to content
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

Support complex matrices #45

Closed
KapilKhanal opened this issue Nov 6, 2023 · 3 comments
Closed

Support complex matrices #45

KapilKhanal opened this issue Nov 6, 2023 · 3 comments

Comments

@KapilKhanal
Copy link

evaluate_greens_func evaluates to complex number. I get error that it is not supported."MethodError: no method matching assemble_hmat(::Vector{ComplexF64}; threads=false)"
`using HMatrices, LinearAlgebra, StaticArrays
const Point3D = SVector{3,Float64}
X = rand(Point3D,10_000)
Y = rand(Point3D,10_000)
GF,GF1,GF2,GF3 = KernelMatrix(evaluate_greens_func,X,Y)

Xclt = Yclt = ClusterTree(X)
adm = StrongAdmissibilityStd()
comp = PartialACA(;atol=1e-6)
H = assemble_hmat(GF,threads = false)`

@maltezfaria
Copy link
Member

I am not sure what your evaluate_greens_func do, but one problem could be that calling

GF,GF1,GF2,GF3 = KernelMatrix(evaluate_greens_func,X,Y)

will assign to GF, GF1, GF2, GF3 the first four elements of the KernelMatrix (which is itself an AbstractMatrix). After that call, I suspect these four quantities are simply complex numbers. Here is an example that should work on the v0.2.2

using HMatrices, LinearAlgebra, StaticArrays
const Point3D = SVector{3,Float64}

X = rand(Point3D,10_000)
Y = rand(Point3D,10_000)

function evaluate_greens_func(x,y)
    d = norm(x-y) + 1e-8
    exp(im*d) / d
end

GF = KernelMatrix(evaluate_greens_func,X,Y)

Xclt = Yclt = ClusterTree(X)
adm = StrongAdmissibilityStd()
comp = PartialACA(;atol=1e-6)
H = assemble_hmatrix(GF,threads = false)

@maltezfaria
Copy link
Member

@KapilKhanal Did you manage to make it work? Can I close this issue?

The library does provide support for complex matrices (I used it frequently to compress integral operators for Helmholtz equations).

@KapilKhanal
Copy link
Author

I did thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants