-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from bmxam/dev
Dev
- Loading branch information
Showing
18 changed files
with
445 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
name = "SlepcWrap" | ||
uuid = "c3679e3b-785e-4ccc-b734-b7685cbb935e" | ||
authors = ["bmxam <maxime.bouyges@gmail.com>"] | ||
version = "0.1.1" | ||
version = "0.1.2" | ||
|
||
[deps] | ||
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" | ||
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" | ||
PetscWrap = "5be22e1c-01b5-4697-96eb-ef9ccdc854b8" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[compat] | ||
MPI = "0.16.1" | ||
PetscWrap = "0.1.2" | ||
julia = "1.5" | ||
PetscWrap = "0.1.3" | ||
julia = "1.5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Eigenvalue Problem solver (EPS) | ||
```@autodocs | ||
Modules = [SlepcWrap] | ||
Pages = ["eps.jl"] | ||
Pages = ["src/eps.jl"] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Eigenvalue Problem solver (EPS) | ||
```@autodocs | ||
Modules = [SlepcWrap] | ||
Pages = ["fancy/eps.jl"] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
|
||
# Complex numbers | ||
Trivial example to demonstrate the capability of handling complex numbers | ||
|
||
```julia | ||
using PetscWrap | ||
using SlepcWrap | ||
``` | ||
|
||
Start by checking that you're using a PETSc/SLEPc build with complex number | ||
|
||
```julia | ||
(PetscScalar <: Real) && error("You must configure PETSc/SLEPc with complex numbers to run this example") | ||
``` | ||
|
||
Initialize SLEPc | ||
|
||
```julia | ||
SlepcInitialize() | ||
``` | ||
|
||
Create matrix | ||
|
||
```julia | ||
A = create_matrix(4, 4; auto_setup = true) | ||
``` | ||
|
||
Get rows handled by the local processor | ||
|
||
```julia | ||
A_rstart, A_rend = get_range(A) | ||
``` | ||
|
||
Create diag matrix with complex numbers | ||
|
||
```julia | ||
J = I = A_rstart:A_rend | ||
V = im .* I | ||
set_values!(A, I, J, V) | ||
assemble!(A) | ||
``` | ||
|
||
Now we set up the eigenvalue solver | ||
|
||
```julia | ||
eps = create_eps(A; auto_setup = true) | ||
``` | ||
|
||
Then we solve | ||
|
||
```julia | ||
solve!(eps) | ||
``` | ||
|
||
Show converged eivenvalues | ||
|
||
```julia | ||
@show get_eigenvalues(eps) | ||
``` | ||
|
||
Finally, let's free the memory | ||
|
||
```julia | ||
destroy!(A) | ||
destroy!(eps) | ||
``` | ||
|
||
And call finalize when you're done | ||
|
||
```julia | ||
SlepcFinalize() | ||
|
||
``` | ||
|
||
--- | ||
|
||
*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
module Complex #hide | ||
# # Complex numbers | ||
# Trivial example to demonstrate the capability of handling complex numbers | ||
using PetscWrap | ||
using SlepcWrap | ||
|
||
# Start by checking that you're using a PETSc/SLEPc build with complex number | ||
(PetscScalar <: Real) && error("You must configure PETSc/SLEPc with complex numbers to run this example") | ||
|
||
# Initialize SLEPc | ||
SlepcInitialize() | ||
|
||
# Create matrix | ||
A = create_matrix(4, 4; auto_setup = true) | ||
|
||
# Get rows handled by the local processor | ||
A_rstart, A_rend = get_range(A) | ||
|
||
# Create diag matrix with complex numbers | ||
J = I = A_rstart:A_rend | ||
V = im .* I | ||
set_values!(A, I, J, V) | ||
assemble!(A) | ||
|
||
# Now we set up the eigenvalue solver | ||
eps = create_eps(A; auto_setup = true) | ||
|
||
# Then we solve | ||
solve!(eps) | ||
|
||
# Show converged eivenvalues | ||
@show get_eigenvalues(eps) | ||
|
||
# Finally, let's free the memory | ||
destroy!(A) | ||
destroy!(eps) | ||
|
||
# And call finalize when you're done | ||
SlepcFinalize() | ||
|
||
end #hide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.