Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pulling new Hessenberg QR algorith implementations into the main libr…
…ary as HessenbergSchur
- Loading branch information
Jack Poulson
committed
Jun 25, 2016
1 parent
cd61fb5
commit a95d621
Showing
16 changed files
with
464 additions
and
326 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
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
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,46 @@ | ||
/* | ||
Copyright (c) 2009-2016, Jack Poulson | ||
All rights reserved. | ||
This file is part of Elemental and is under the BSD 2-Clause License, | ||
which can be found in the LICENSE file in the root directory, or at | ||
http://opensource.org/licenses/BSD-2-Clause | ||
*/ | ||
#ifndef EL_HESSENBERG_FORMQ_HPP | ||
#define EL_HESSENBERG_FORMQ_HPP | ||
|
||
namespace El { | ||
namespace hessenberg { | ||
|
||
template<typename F> | ||
void FormQ | ||
( UpperOrLower uplo, | ||
const Matrix<F>& A, | ||
const Matrix<F>& phase, | ||
Matrix<F>& Q ) | ||
{ | ||
DEBUG_CSE | ||
// TODO: Make this smarter | ||
const Int n = A.Height(); | ||
Identity( Q, n, n ); | ||
ApplyQ( LEFT, uplo, NORMAL, A, phase, Q ); | ||
} | ||
|
||
template<typename F> | ||
void FormQ | ||
( UpperOrLower uplo, | ||
const ElementalMatrix<F>& A, | ||
const ElementalMatrix<F>& phase, | ||
ElementalMatrix<F>& Q ) | ||
{ | ||
DEBUG_CSE | ||
// TODO: Make this smarter | ||
const Int n = A.Height(); | ||
Identity( Q, n, n ); | ||
ApplyQ( LEFT, uplo, NORMAL, A, phase, Q ); | ||
} | ||
|
||
} // namespace hessenberg | ||
} // namespace El | ||
|
||
#endif // ifndef EL_HESSENBERG_FORMQ_HPP |
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,131 @@ | ||
/* | ||
Copyright (c) 2009-2016, Jack Poulson | ||
All rights reserved. | ||
This file is part of Elemental and is under the BSD 2-Clause License, | ||
which can be found in the LICENSE file in the root directory, or at | ||
http://opensource.org/licenses/BSD-2-Clause | ||
*/ | ||
#include <El.hpp> | ||
|
||
#include "./HessenbergSchur/SingleShift.hpp" | ||
#include "./HessenbergSchur/DoubleShift.hpp" | ||
#include "./HessenbergSchur/AED.hpp" | ||
|
||
namespace El { | ||
|
||
template<typename Real> | ||
HessenbergSchurInfo | ||
HessenbergSchur | ||
( Matrix<Real>& H, | ||
Matrix<Complex<Real>>& w, | ||
const HessenbergSchurCtrl& ctrl ) | ||
{ | ||
const Int n = H.Height(); | ||
auto ctrlMod( ctrl ); | ||
ctrlMod.winBeg = ( ctrl.winBeg==END ? n : ctrl.winBeg ); | ||
ctrlMod.winEnd = ( ctrl.winEnd==END ? n : ctrl.winEnd ); | ||
ctrlMod.wantSchurVecs = false; | ||
|
||
Matrix<Real> Z; | ||
if( ctrl.useAED ) | ||
{ | ||
return hess_schur::AED( H, w, Z, ctrlMod ); | ||
} | ||
else | ||
{ | ||
return hess_schur::DoubleShift( H, w, Z, ctrlMod ); | ||
} | ||
} | ||
|
||
template<typename Real> | ||
HessenbergSchurInfo | ||
HessenbergSchur | ||
( Matrix<Real>& H, | ||
Matrix<Complex<Real>>& w, | ||
Matrix<Real>& Z, | ||
const HessenbergSchurCtrl& ctrl ) | ||
{ | ||
const Int n = H.Height(); | ||
auto ctrlMod( ctrl ); | ||
ctrlMod.winBeg = ( ctrl.winBeg==END ? n : ctrl.winBeg ); | ||
ctrlMod.winEnd = ( ctrl.winEnd==END ? n : ctrl.winEnd ); | ||
ctrlMod.wantSchurVecs = true; | ||
|
||
if( ctrl.useAED ) | ||
{ | ||
return hess_schur::AED( H, w, Z, ctrlMod ); | ||
} | ||
else | ||
{ | ||
return hess_schur::DoubleShift( H, w, Z, ctrlMod ); | ||
} | ||
} | ||
|
||
template<typename Real> | ||
HessenbergSchurInfo | ||
HessenbergSchur | ||
( Matrix<Complex<Real>>& H, | ||
Matrix<Complex<Real>>& w, | ||
const HessenbergSchurCtrl& ctrl ) | ||
{ | ||
const Int n = H.Height(); | ||
auto ctrlMod( ctrl ); | ||
ctrlMod.winBeg = ( ctrl.winBeg==END ? n : ctrl.winBeg ); | ||
ctrlMod.winEnd = ( ctrl.winEnd==END ? n : ctrl.winEnd ); | ||
ctrlMod.wantSchurVecs = false; | ||
|
||
Matrix<Complex<Real>> Z; | ||
if( ctrl.useAED ) | ||
{ | ||
return hess_schur::AED( H, w, Z, ctrlMod ); | ||
} | ||
else | ||
{ | ||
return hess_schur::SingleShift( H, w, Z, ctrlMod ); | ||
} | ||
} | ||
|
||
template<typename Real> | ||
HessenbergSchurInfo | ||
HessenbergSchur | ||
( Matrix<Complex<Real>>& H, | ||
Matrix<Complex<Real>>& w, | ||
Matrix<Complex<Real>>& Z, | ||
const HessenbergSchurCtrl& ctrl ) | ||
{ | ||
const Int n = H.Height(); | ||
auto ctrlMod( ctrl ); | ||
ctrlMod.winBeg = ( ctrl.winBeg==END ? n : ctrl.winBeg ); | ||
ctrlMod.winEnd = ( ctrl.winEnd==END ? n : ctrl.winEnd ); | ||
ctrlMod.wantSchurVecs = true; | ||
|
||
if( ctrl.useAED ) | ||
{ | ||
return hess_schur::AED( H, w, Z, ctrlMod ); | ||
} | ||
else | ||
{ | ||
return hess_schur::SingleShift( H, w, Z, ctrlMod ); | ||
} | ||
} | ||
|
||
#define PROTO(F) \ | ||
template HessenbergSchurInfo HessenbergSchur \ | ||
( Matrix<F>& H, \ | ||
Matrix<Complex<Base<F>>>& w, \ | ||
const HessenbergSchurCtrl& ctrl ); \ | ||
template HessenbergSchurInfo HessenbergSchur \ | ||
( Matrix<F>& H, \ | ||
Matrix<Complex<Base<F>>>& w, \ | ||
Matrix<F>& Z, \ | ||
const HessenbergSchurCtrl& ctrl ); | ||
|
||
#define EL_NO_INT_PROTO | ||
#define EL_ENABLE_DOUBLEDOUBLE | ||
#define EL_ENABLE_QUADDOUBLE | ||
#define EL_ENABLE_QUAD | ||
#define EL_ENABLE_BIGFLOAT | ||
#include <El/macros/Instantiate.h> | ||
|
||
} // namespace El |
Oops, something went wrong.