Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Larry Price
gmsh
Commits
d658eac5
Commit
d658eac5
authored
11 years ago
by
Van Dung Nguyen
Browse files
Options
Downloads
Patches
Plain Diff
add func in eigenSolver
parent
e1d6fd5b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Solver/eigenSolver.cpp
+25
-0
25 additions, 0 deletions
Solver/eigenSolver.cpp
Solver/eigenSolver.h
+4
-0
4 additions, 0 deletions
Solver/eigenSolver.h
with
29 additions
and
0 deletions
Solver/eigenSolver.cpp
+
25
−
0
View file @
d658eac5
...
@@ -183,4 +183,29 @@ bool eigenSolver::solve(int numEigenValues, std::string which)
...
@@ -183,4 +183,29 @@ bool eigenSolver::solve(int numEigenValues, std::string which)
}
}
void
eigenSolver
::
normalize_mode
(){
Msg
::
Info
(
"Normalize all eigenvectors"
);
for
(
unsigned
int
i
=
0
;
i
<
_eigenVectors
.
size
();
i
++
){
double
norm
=
0.
;
for
(
unsigned
int
j
=
0
;
j
<
_eigenVectors
[
i
].
size
();
j
++
){
std
::
complex
<
double
>
val
=
_eigenVectors
[
i
][
j
];
double
normval
=
std
::
abs
(
val
);
if
(
normval
>
norm
)
norm
=
normval
;
};
if
(
norm
==
0
)
{
Msg
::
Error
(
"zero eigenvector"
);
return
;
};
for
(
unsigned
int
j
=
0
;
j
<
_eigenVectors
[
i
].
size
();
j
++
){
_eigenVectors
[
i
][
j
]
/=
norm
;
};
};
};
#endif
#endif
This diff is collapsed.
Click to expand it.
Solver/eigenSolver.h
+
4
−
0
View file @
d658eac5
...
@@ -41,6 +41,8 @@ class eigenSolver{
...
@@ -41,6 +41,8 @@ class eigenSolver{
{
{
return
_eigenVectors
[
num
][
com
];
return
_eigenVectors
[
num
][
com
];
};
};
int
getNumberEigenvectors
()
{
return
_eigenVectors
.
size
();};
void
normalize_mode
();
};
};
#else
#else
...
@@ -65,6 +67,8 @@ class eigenSolver{
...
@@ -65,6 +67,8 @@ class eigenSolver{
std
::
vector
<
std
::
complex
<
double
>
>
&
getEigenVector
(
int
num
){
return
_dummy
;
}
std
::
vector
<
std
::
complex
<
double
>
>
&
getEigenVector
(
int
num
){
return
_dummy
;
}
void
clear
(){}
void
clear
(){}
std
::
complex
<
double
>
getEigenVectorComp
(
int
num
,
int
com
)
{
return
0.
;
}
std
::
complex
<
double
>
getEigenVectorComp
(
int
num
,
int
com
)
{
return
0.
;
}
int
getNumberEigenvectors
()
{
return
0
;};
void
normalize_mode
()
{};
};
};
#endif
#endif
...
...
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