Skip to content

Commit

Permalink
Treating Dirichlet rows in power method properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
mastep84 committed Nov 8, 2018
1 parent 4938564 commit 5f3bb59
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ugbase/lib_algebra/operator/eigensolver/power_method.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,15 @@ class PowerMethod
else
m_spEigenvector = m_spResidual->clone();

// reset Dirichlet rows to 0
for(size_t i = 0; i < m_spEigenvector->size(); i++)
{
if(m_vbDirichlet[i])
{
(*m_spEigenvector)[i] = 0.0;
}
}

// v = v / ||v||_B
normalize_approximations();

Expand Down Expand Up @@ -250,6 +259,15 @@ class PowerMethod
// v = A^-1 B v or v = A^-1 v
m_spSolver->apply(*m_spEigenvector, *m_spResidual);

// reset Dirichlet rows to 0
for(size_t i = 0; i < m_spEigenvector->size(); i++)
{
if(m_vbDirichlet[i])
{
(*m_spEigenvector)[i] = 0.0;
}
}

// v = v / ||v||_B
normalize_approximations();

Expand Down

0 comments on commit 5f3bb59

Please sign in to comment.