/usr/include/trilinos/Ifpack_ShyLU.h is in libtrilinos-shylu-dev 12.10.1-3.
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 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | //@HEADER
// ************************************************************************
//
// ShyLU: Hybrid preconditioner package
// Copyright 2012 Sandia Corporation
//
// Under the 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 Ifpack_ShyLU.h
\brief Use ShyLU as a preconditioner within IFPACK.
\author Siva Rajamanickam
*/
#ifndef IFPACK_SHYLU_H
#define IFPACK_SHYLU_H
#include <assert.h>
#include <iostream>
#include <sstream>
#include <string>
/* This define will make S block diagonal, To make this happen even some
zero columns/rows of C and R will be stored.
*/
#define BLOCK_DIAGONAL_Si
#include "ShyLUCore_config.h"
// Epetra includes
#ifdef HAVE_SHYLUCORE_MPI
#include "Epetra_MpiComm.h"
#else
#include "Epetra_SerialComm.h"
#endif
#include "Epetra_SerialComm.h"
#include "Epetra_Time.h"
#include "Epetra_CrsMatrix.h"
#include "Epetra_Map.h"
#include "Epetra_MultiVector.h"
#include "Epetra_LinearProblem.h"
#include "Epetra_Import.h"
#include "Epetra_Export.h"
// Teuchos includes
#include "Teuchos_GlobalMPISession.hpp"
#include "Teuchos_XMLParameterListHelpers.hpp"
#include "Teuchos_LAPACK.hpp"
// AztecOO includes
#include "AztecOO.h"
#include "shylu.h"
#include "shylu_util.h"
// Ifpack includes
#include "Ifpack_Preconditioner.h"
//Isorropia includes
#include "Isorropia_Epetra.hpp"
#include "Isorropia_EpetraRedistributor.hpp"
#include "Isorropia_EpetraPartitioner.hpp"
// EpetraExt includes
#include "EpetraExt_MultiVectorOut.h"
#include "EpetraExt_RowMatrixOut.h"
// Amesos includes
#include "Amesos.h"
#include "Amesos_BaseSolver.h"
using namespace std;
/** \brief ShyLU's interface to be used as an Ifpack Preconditioner
*
*/
class Ifpack_ShyLU: public Ifpack_Preconditioner
{
public:
// @{ Constructors and destructors.
//! Constructor
Ifpack_ShyLU(Epetra_CrsMatrix* A);
//! Destructor
~Ifpack_ShyLU()
{
Destroy();
}
// @}
// @{ Construction methods
//! Initialize the preconditioner, does not touch matrix values.
int Initialize();
//! Returns \c true if the preconditioner has been successfully initialized.
bool IsInitialized() const
{
return(IsInitialized_);
}
//! Compute ILU factors L and U using the specified parameters.
int Compute();
//! If factor is completed, this query returns true, otherwise it returns false.
bool IsComputed() const
{
return(IsComputed_);
}
//! Set parameters using a Teuchos::ParameterList object.
/* This method is only available if the Teuchos package is enabled.
This method recognizes four parameter names: relax_value,
absolute_threshold, relative_threshold and overlap_mode. These names are
case insensitive, and in each case except overlap_mode, the ParameterEntry
must have type double. For overlap_mode, the ParameterEntry must have
type Epetra_CombineMode.
*/
int SetParameters(Teuchos::ParameterList& parameterlist);
int SetUseTranspose(bool UseTranspose_in) {
UseTranspose_ = UseTranspose_in;
return(0);
};
//! Returns the current UseTranspose setting.
bool UseTranspose() const {return(UseTranspose_);};
// @}
// @{ Mathematical functions.
// Applies the matrix to X, returns the result in Y.
int Apply(const Epetra_MultiVector& X,
Epetra_MultiVector& Y) const
{
return(Multiply(false,X,Y));
}
int Multiply(bool Trans, const Epetra_MultiVector& X,
Epetra_MultiVector& Y) const{return A_->Multiply(Trans,X,Y);}
//! Returns the result of a Epetra_Operator inverse applied to an Epetra_MultiVector X in Y.
/*!
\param
X - (In) A Epetra_MultiVector of dimension NumVectors to solve for.
\param Out
Y - (Out) A Epetra_MultiVector of dimension NumVectors containing result.
\return Integer error code, set to 0 if successful.
*/
int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
//! Computes the estimated condition number and returns the value.
double Condest(const Ifpack_CondestType CT = Ifpack_Cheap,
const int MaxIters = 1550,
const double Tol = 1e-9,
Epetra_RowMatrix* Matrix_in = 0);
//! Returns the computed estimated condition number, or -1.0 if not computed.
int JustTryIt() ;
double Condest() const
{
return(Condest_);
}
// @}
// @{ Query methods
//! Returns a character string describing the operator
const char* Label() const {return(Label_.c_str());}
//! Sets label for \c this object.
int SetLabel(std::string Label_in)
{
Label_ = Label_in;
return(0);
}
//! Returns 0.0 because this class cannot compute Inf-norm.
double NormInf() const {return(0.0);};
//! Returns false because this class cannot compute an Inf-norm.
bool HasNormInf() const {return(false);};
//! Returns the Epetra_Map object associated with the domain of this operator.
const Epetra_Map & OperatorDomainMap() const {return(A_->OperatorDomainMap());};
//! Returns the Epetra_Map object associated with the range of this operator.
const Epetra_Map & OperatorRangeMap() const{return(A_->OperatorRangeMap());};
//! Returns the Epetra_BlockMap object associated with the range of this matrix operator.
const Epetra_Comm & Comm() const{return(A_->Comm());};
//! Returns a reference to the matrix to be preconditioned.
const Epetra_RowMatrix& Matrix() const
{
return(*A_);
}
//! Prints on stream basic information about \c this object.
virtual ostream& Print(ostream& os) const;
//! Returns the number of calls to Initialize().
virtual int NumInitialize() const
{
return(NumInitialize_);
}
//! Returns the number of calls to Compute().
virtual int NumCompute() const
{
return(NumCompute_);
}
//! Returns the number of calls to ApplyInverse().
virtual int NumApplyInverse() const
{
return(NumApplyInverse_);
}
//! Returns the time spent in Initialize().
virtual double InitializeTime() const
{
return(InitializeTime_);
}
//! Returns the time spent in Compute().
virtual double ComputeTime() const
{
return(ComputeTime_);
}
//! Returns the time spent in ApplyInverse().
virtual double ApplyInverseTime() const
{
return(ApplyInverseTime_);
}
//! Returns the number of flops in the initialization phase.
virtual double InitializeFlops() const
{
return(0.0);
}
virtual double ComputeFlops() const
{
return(ComputeFlops_);
}
virtual double ApplyInverseFlops() const
{
return(ApplyInverseFlops_);
}
private:
// @}
// @{ Private methods
//! Copy constructor (should never be used)
Ifpack_ShyLU(const Ifpack_ShyLU& RHS) :
Time_(RHS.Comm())
{}
//! operator= (should never be used)
Ifpack_ShyLU& operator=(const Ifpack_ShyLU& RHS)
{
return(*this);
}
//! Destroys all internal data
void Destroy();
//! Returns the number of global matrix rows.
int NumGlobalRows() const {return(A_->NumGlobalRows());};
//! Returns the number of global matrix columns.
int NumGlobalCols() const {return(A_->NumGlobalCols());};
//! Returns the number of local matrix rows.
int NumMyRows() const {return(A_->NumMyRows());};
//! Returns the number of local matrix columns.
int NumMyCols() const {return(A_->NumMyCols());};
// @}
// @{ Internal data
//! Pointer to the Epetra_RowMatrix to factorize
Epetra_CrsMatrix *A_;
Teuchos::ParameterList List_;
//mutable AztecOO *solver_; // Ugh !!! Mutable ! To workaround AztecOO bug
mutable shylu_data slu_data_; // More mutable !!!
mutable shylu_config slu_config_; // More mutable !!
mutable shylu_symbolic slu_sym_; // More mutable !!
//fpr later use
// Isorropia::Epetra::Partitioner *partitioner_; // unused
// Isorropia::Epetra::Redistributor *rd_; // unused
bool UseTranspose_;
double Condest_;
bool IsParallel_;
//! If \c true, the preconditioner has been successfully initialized.
bool IsInitialized_;
//! If \c true, the preconditioner has been successfully computed.
bool IsComputed_;
//! Label of \c this object.
std::string Label_;
//! Contains the number of successful calls to Initialize().
int NumInitialize_;
//! Contains the number of successful call to Compute().
int NumCompute_;
//! Contains the number of successful call to ApplyInverse().
mutable int NumApplyInverse_;
//! Contains the time for all successful calls to Initialize().
double InitializeTime_;
//! Contains the time for all successful calls to Compute().
double ComputeTime_;
//! Contains the time for all successful calls to ApplyInverse().
mutable double ApplyInverseTime_;
//! Contains the number of flops for Compute().
double ComputeFlops_;
//! Contain sthe number of flops for ApplyInverse().
mutable double ApplyInverseFlops_;
//! Used for timing issues
mutable Epetra_Time Time_;
// @}
};
#endif /* IFPACK_SHYLU_H */
|