Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
getdp
cim
Commits
4c1a2ac5
Commit
4c1a2ac5
authored
8 years ago
by
Nicolas Marsic
Browse files
Options
Downloads
Patches
Plain Diff
getdp: pretty print
parent
8b077ef0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beyn.py
+4
-18
4 additions, 18 deletions
beyn.py
main.py
+10
-1
10 additions, 1 deletion
main.py
with
14 additions
and
19 deletions
beyn.py
+
4
−
18
View file @
4c1a2ac5
...
...
@@ -4,7 +4,7 @@ import numpy.matlib
def
simple
(
operator
,
radius
,
origin
,
nodes
=
100
,
maxIt
=
10
,
lStart
=
1
,
lStep
=
1
,
rankTol
=
1e-4
):
"""
Solve an eigenvalue problem using Beyn
'
s algorithm (simple version)
"""
Solve
s
an eigenvalue problem using Beyn
'
s algorithm (simple version)
Keyword arguments:
operator -- the solver defining the operator to use
...
...
@@ -14,6 +14,8 @@ def simple(operator, radius, origin,
lStart -- the number of columns used for A0 when algorithm starts (optional)
lStep -- the step used for increasing the number of columns of A0 (optional)
rankTol -- the tolerance for the rank test
Returns the computed eigenvalues
"""
# Initialise A0 search
...
...
@@ -67,11 +69,8 @@ def simple(operator, radius, origin,
print
"
Solving linear EVP...
"
myLambda
,
QHat
=
numpy
.
linalg
.
eig
(
B
)
# Display
display
(
myLambda
)
# Done
return
return
myLambda
## Import only simple (other functions are just helpers)
...
...
@@ -162,19 +161,6 @@ def randomMatrix(n, m):
return
np
.
matlib
.
rand
(
n
,
m
)
+
np
.
matlib
.
rand
(
n
,
m
)
*
1j
def
display
(
v
):
"""
Displays the eigenvalues given in the array v
"""
size
=
v
.
shape
[
0
]
print
"
Eigenvalues:
"
print
"
-----------
"
for
i
in
range
(
size
):
print
"
(
"
+
format
(
np
.
real
(
v
[
i
]).
tolist
(),
'
+e
'
)
+
"
)
"
,
print
"
+
"
,
print
"
(
"
+
format
(
np
.
imag
(
v
[
i
]).
tolist
(),
'
+e
'
)
+
"
)*j
"
print
"
-----------
"
print
"
Found:
"
+
str
(
size
)
def
zeroRankErrorStr
():
"""
Returns a string explaining the probable reason of a zero rank
"""
return
(
"
Found a rank of zero:
"
+
...
...
This diff is collapsed.
Click to expand it.
main.py
+
10
−
1
View file @
4c1a2ac5
...
...
@@ -11,4 +11,13 @@ resolution = "Maxwell"
operator
=
Solver
.
GetDPWave
(
pro
,
mesh
,
resolution
)
# Compute
Beyn
.
simple
(
operator
,
1e8
,
complex
(
9e8
,
0
))
v
=
Beyn
.
simple
(
operator
,
1e8
,
complex
(
9e8
,
0
))
print
"
Eigenvalues:
"
print
"
-----------
"
for
i
in
range
(
v
.
shape
[
0
]):
print
"
(
"
+
format
(
np
.
real
(
v
[
i
]).
tolist
(),
'
+e
'
)
+
"
)
"
,
print
"
+
"
,
print
"
(
"
+
format
(
np
.
imag
(
v
[
i
]).
tolist
(),
'
+e
'
)
+
"
)*j
"
print
"
-----------
"
print
"
Found:
"
+
str
(
v
.
shape
[
0
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment