/usr/include/trilinos/AnasaziGenOrthoManager.hpp is in libtrilinos-anasazi-dev 12.12.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | // @HEADER
// ***********************************************************************
//
// Anasazi: Block Eigensolvers Package
// Copyright 2004 Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
//
// ***********************************************************************
// @HEADER
/*! \file AnasaziGenOrthoManager.hpp
\brief Templated virtual class for providing orthogonalization/orthonormalization methods with matrix-based
inner products.
*/
#ifndef ANASAZI_GENORTHOMANAGER_HPP
#define ANASAZI_GENORTHOMANAGER_HPP
/*! \class Anasazi::GenOrthoManager
This class provides an interface for orthogonalization managers to provide
oblique projectors of the form:
\f[
P_{X,Y} S = S - X \langle Y, X \rangle^{-1} \langle Y, S \rangle\ .
\f]
Such a projector modifies the input in the range on \f$X\f$ in order to
make the output orthogonal to the range of \f$Y\f$.
\author Chris Baker, Ulrich Hetmaniuk, Rich Lehoucq, and Heidi Thornquist
*/
#include "AnasaziConfigDefs.hpp"
#include "AnasaziTypes.hpp"
#include "AnasaziMatOrthoManager.hpp"
#include "AnasaziMultiVecTraits.hpp"
#include "AnasaziOperatorTraits.hpp"
namespace Anasazi {
template <class ScalarType, class MV, class OP>
class GenOrthoManager : public MatOrthoManager<ScalarType,MV,OP> {
public:
//! @name Constructor/Destructor
//@{
//! Default constructor.
GenOrthoManager(Teuchos::RCP<const OP> Op = Teuchos::null);
//! Destructor.
virtual ~GenOrthoManager() {};
//@}
//! @name Orthogonalization methods
//@{
/*! \brief Applies a series of generic projectors.
*
* Given a list of bases <tt>X[i]</tt> and <tt>Y[i]</tt> (a projection pair), this method
* takes a multivector \c S and applies the projectors
* \f[
* P_{X[i],Y[i]} S = S - X[i] \langle Y[i], X[i] \rangle^{-1} \langle Y[i], S \rangle\ .
* \f]
* This operation projects \c S onto the space orthogonal to the <tt>Y[i]</tt>,
* along the range of the <tt>X[i]</tt>. The inner product specified by \f$\langle \cdot,
* \cdot \rangle\f$ is given by innerProd().
*
* \note The call
* \code
* projectGen(S, tuple(X1,X2), tuple(Y1,Y2))
* \endcode
* is equivalent to the call
* \code
* projectGen(S, tuple(X2,X1), tuple(Y2,Y1))
* \endcode
*
* The method also returns the coefficients <tt>C[i]</tt> associated with each projection pair, so that
* \f[
* S_{in} = S_{out} + \sum_i X[i] C[i]
* \f]
* and therefore
* \f[
* C[i] = \langle Y[i], X[i] \rangle^{-1} \langle Y[i], S \rangle\ .
* \f]
*
* Lastly, for reasons of efficiency, the user must specify whether the projection pairs are bi-orthonormal with
* respect to innerProd(), i.e., whether \f$\langle Y[i], X[i] \rangle = I\f$. In the case that the bases are specified
* to be biorthogonal, the inverse \f$\langle Y, X \rangle^{-1}\f$ will not be computed. Furthermore, the user may optionally
* specifiy the image of \c S and the projection pairs under the inner product operator getOp().
@param S [in/out] The multivector to be modified.<br>
On output, the columns of \c S will be orthogonal to each <tt>Y[i]</tt>, satisfying
\f[
\langle Y[i], S_{out} \rangle = 0
\f]
Also,
\f[
S_{in} = S_{out} + \sum_i X[i] C[i]
\f]
@param X [in] Multivectors for bases under which \f$S_{in}\f$ is modified.
@param Y [in] Multivectors for bases to which \f$S_{out}\f$ should be orthogonal.
@param isBiortho [in] A flag specifying whether the bases <tt>X[i]</tt>
and <tt>Y[i]</tt> are biorthonormal, i.e,. whether \f$\langle Y[i],
X[i]\rangle == I\f$.
@param C [out] Coefficients for reconstructing \f$S_{in}\f$ via the bases <tt>X[i]</tt>. If <tt>C[i]</tt> is a non-null pointer
and <tt>C[i]</tt> matches the dimensions of \c S and <tt>X[i]</tt>, then the coefficients computed during the orthogonalization
routine will be stored in the matrix <tt>C[i]</tt>.<br>
If <tt>C[i]</tt> points to a Teuchos::SerialDenseMatrix with size
inconsistent with \c S and \c <tt>X[i]</tt>, then a std::invalid_argument
exception will be thrown.<br>
Otherwise, if <tt>C.size() < i</tt> or <tt>C[i]</tt> is a null pointer,
the caller will not have access to the computed coefficients <tt>C[i]</tt>.
@param MS [in/out] If specified by the user, on input \c MS is required to be the image of \c S under the operator getOp().
On output, \c MS will be updated to reflect the changes in \c S.
@param MX [in] If specified by the user, <tt>MX[i]</tt> is required to be the image of <tt>X[i]</tt> under the operator getOp().
@param MY [in] If specified by the user, <tt>MY[i]</tt> is required to be the image of <tt>Y[i]</tt> under the operator getOp().
\pre
<ul>
<li>If <tt>X[i] != Teuchos::null</tt> or <tt>Y[i] != Teuchos::null</tt>, then <tt>X[i]</tt> and <tt>Y[i]</tt> are required to
have the same number of columns, and each should have the same number of rows as \c S.
<li>For any <tt>i != j</tt>, \f$\langle Y[i], X[j] \rangle == 0\f$.
<li>If <tt>biOrtho == true</tt>, \f$\langle Y[i], X[i]\rangle == I\f$
<li>Otherwise, if <tt>biOrtho == false</tt>, then \f$\langle Y[i], X[i]\rangle\f$ should be Hermitian positive-definite.
<li>If <tt>X[i]</tt> and <tt>Y[i]</tt> have \f$xc_i\f$ columns and \c S has \f$sc\f$ columns, then <tt>C[i]</tt> if specified must
be \f$xc_i \times sc\f$.
</ul>
*/
virtual void projectGen(
MV &S,
Teuchos::Array<Teuchos::RCP<const MV> > X,
Teuchos::Array<Teuchos::RCP<const MV> > Y,
bool isBiOrtho,
Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C
= Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix<int,ScalarType> >(Teuchos::null)),
Teuchos::RCP<MV> MS = Teuchos::null,
Teuchos::Array<Teuchos::RCP<const MV> > MX = Teuchos::tuple(Teuchos::RCP<const MV>(Teuchos::null)),
Teuchos::Array<Teuchos::RCP<const MV> > MY = Teuchos::tuple(Teuchos::RCP<const MV>(Teuchos::null))
) const = 0;
/*! \brief Applies a series of generic projectors and returns an orthonormal basis for the residual data.
*
* Given a list of bases <tt>X[i]</tt> and <tt>Y[i]</tt> (a projection pair), this method
* takes a multivector \c S and applies the projectors
* \f[
* P_{X[i],Y[i]} S = S - X[i] \langle Y[i], X[i] \rangle^{-1} \langle Y[i], S \rangle\ .
* \f]
* These operation project \c S onto the space orthogonal to the range of the <tt>Y[i]</tt>,
* along the range of \c X[i]. The inner product specified by \f$\langle \cdot, \cdot \rangle\f$
* is given by innerProd().
*
* The method returns in \c S an orthonormal basis for the residual
* \f[
* \left( \prod_{i} P_{X[i],Y[i]} \right) S_{in} = S_{out} B\ ,
* \f]
* where \c B contains the (not necessarily triangular) coefficients of the residual with respect to the
* new basis.
*
* The method also returns the coefficients <tt>C[i]</tt> and \c B associated with each projection pair, so that
* \f[
* S_{in} = S_{out} B + \sum_i X[i] C[i]
* \f]
* and
* \f[
* C[i] = \langle Y[i], X[i] \rangle^{-1} \langle Y[i], S \rangle\ .
* \f]
*
* Lastly, for reasons of efficiency, the user must specify whether the projection pairs are bi-orthonormal with
* respect to innerProd(), i.e., whether \f$\langle Y[i], X[i] \rangle = I\f$. Furthermore, the user may optionally
* specifiy the image of \c S and the projection pairs under the inner product operator getOp().
@param S [in/out] The multivector to be modified.<br>
On output, the columns of \c S will be orthogonal to each <tt>Y[i]</tt>, satisfying
\f[
\langle Y[i], S_{out} \rangle = 0
\f]
Also,
\f[
S_{in}(1:m,1:n) = S_{out}(1:m,1:rank) B(1:rank,1:n) + \sum_i X[i] C[i]\ ,
\f]
where \c m is the number of rows in \c S, \c n is the number of
columns in \c S, and \c rank is the value returned from the method.
@param X [in] Multivectors for bases under which \f$S_{in}\f$ is modified.
@param Y [in] Multivectors for bases to which \f$S_{out}\f$ should be orthogonal.
@param isBiortho [in] A flag specifying whether the bases <tt>X[i]</tt>
and <tt>Y[i]</tt> are biorthonormal, i.e,. whether \f$\langle Y[i],
X[i]\rangle == I\f$.
@param C [out] Coefficients for reconstructing \f$S_{in}\f$ via the bases <tt>X[i]</tt>. If <tt>C[i]</tt> is a non-null pointer
and <tt>C[i]</tt> matches the dimensions of \c X and <tt>Q[i]</tt>, then the coefficients computed during the orthogonalization
routine will be stored in the matrix <tt>C[i]</tt>.<br>
If <tt>C[i]</tt> points to a Teuchos::SerialDenseMatrix with size
inconsistent with \c S and \c <tt>X[i]</tt>, then a std::invalid_argument
exception will be thrown.<br>
Otherwise, if <tt>C.size() < i</tt> or <tt>C[i]</tt> is a null pointer,
the caller will not have access to the computed coefficients <tt>C[i]</tt>.
@param B [out] The coefficients of the original \c S with respect to the computed basis. If \c B is a non-null pointer and
\c B matches the dimensions of \c B, then the
coefficients computed during the orthogonalization routine will be stored in \c B, similar to calling
\code
innerProd( Sout, Sin, B );
\endcode
If \c B points to a Teuchos::SerialDenseMatrix with size inconsistent with
\c S, then a std::invalid_argument exception will be thrown.<br>
Otherwise, if \c B is null, the caller will not have access to the computed
coefficients.<br>
@param MS [in/out] If specified by the user, on input \c MS is required to be the image of \c S under the operator getOp().
On output, \c MS will be updated to reflect the changes in \c S.
@param MX [in] If specified by the user, <tt>MX[i]</tt> is required to be the image of <tt>X[i]</tt> under the operator getOp().
@param MY [in] If specified by the user, <tt>MY[i]</tt> is required to be the image of <tt>Y[i]</tt> under the operator getOp().
\note The matrix \c B is not necessarily triangular (as in a QR
factorization); see the documentation of specific orthogonalization managers.
\pre
<ul>
<li>If <tt>X[i] != Teuchos::null</tt> or <tt>Y[i] != Teuchos::null</tt>, then <tt>X[i]</tt> and <tt>Y[i]</tt> are required to
have the same number of columns, and each should have the same number of rows as \c S.
<li>For any <tt>i != j</tt>, \f$\langle Y[i], X[j] \rangle == 0\f$.
<li>If <tt>biOrtho == true</tt>, \f$\langle Y[i], X[i]\rangle == I\f$
<li>Otherwise, if <tt>biOrtho == false</tt>, then \f$\langle Y[i], X[i]\rangle\f$ should be Hermitian positive-definite.
<li>If <tt>X[i]</tt> and <tt>Y[i]</tt> have \f$xc_i\f$ columns and \c S has \f$sc\f$ columns, then <tt>C[i]</tt> if specified must
be \f$xc_i \times sc\f$.
<li>If <tt>S</tt> has \f$sc\f$ columns, then \c B if specified must be \f$sc \times sc \f$.
</ul>
@return Rank of the basis computed by this method.
*/
virtual int projectAndNormalizeGen (
MV &S,
Teuchos::Array<Teuchos::RCP<const MV> > X,
Teuchos::Array<Teuchos::RCP<const MV> > Y,
bool isBiOrtho,
Teuchos::Array<Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > > C
= Teuchos::tuple(Teuchos::RCP< Teuchos::SerialDenseMatrix<int,ScalarType> >(Teuchos::null)),
Teuchos::RCP<Teuchos::SerialDenseMatrix<int,ScalarType> > B = Teuchos::null,
Teuchos::RCP<MV> MS = Teuchos::null,
Teuchos::Array<Teuchos::RCP<const MV> > MX = Teuchos::tuple(Teuchos::RCP<const MV>(Teuchos::null)),
Teuchos::Array<Teuchos::RCP<const MV> > MY = Teuchos::tuple(Teuchos::RCP<const MV>(Teuchos::null))
) const = 0;
//@}
};
template <class ScalarType,class MV,class OP>
GenOrthoManager<ScalarType,MV,OP>::GenOrthoManager(Teuchos::RCP<const OP> Op)
: MatOrthoManager<ScalarType,MV,OP>(Op) {}
} // end of Anasazi namespace
#endif
// end of file AnasaziGenOrthoManager.hpp
|