/usr/include/trilinos/LOCA_DerivUtils.H is in libtrilinos-nox-dev 12.4.2-2.
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 | // $Id$
// $Source$
//@HEADER
// ************************************************************************
//
// LOCA: Library of Continuation Algorithms Package
// Copyright (2005) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// 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 Roger Pawlowski (rppawlo@sandia.gov) or
// Eric Phipps (etphipp@sandia.gov), Sandia National Laboratories.
// ************************************************************************
// CVS Information
// $Source$
// $Author$
// $Date$
// $Revision$
// ************************************************************************
//@HEADER
#ifndef LOCA_DERIVUTILS_H
#define LOCA_DERIVUTILS_H
#include "Teuchos_RCP.hpp"
#include "NOX_Abstract_Group.H" // For CopyType
#include "NOX_Abstract_MultiVector.H" // For DenseMatrix
#include <vector>
namespace LOCA {
class GlobalData;
namespace MultiContinuation {
class AbstractGroup;
}
namespace Hopf {
namespace MooreSpence {
class AbstractGroup;
}
namespace MinimallyAugmented {
class AbstractGroup;
}
}
}
namespace LOCA {
/*!
* \brief %LOCA's generic derivative computation class to compute various
* derivatives via finite differencing.
*
* The %DerivUtils class provides generic methods to compute the following
* derivatives:
* \f[
* \frac{\partial F}{\partial p},\quad\frac{\partial Jn}{\partial p},\quad\frac{\partial Jn}{\partial x}a
* \f]
* where \f$J = \partial F/\partial x\f$ and \f$n\f$, \f$a\f$ are vectors.
* These quantities are calculate by finite differencing.
*/
class DerivUtils {
public:
/*!
* \brief Default constructor. perturb is the relative perturbation size
* used in differencing calculations.
*/
DerivUtils(const Teuchos::RCP<LOCA::GlobalData>& global_data,
double perturb = 1.0e-6);
//! Copy constructor.
DerivUtils(const DerivUtils&);
//! Destructor.
virtual ~DerivUtils();
/*!
* \brief Cloning function. Creates a copy of the %DerivUtils object
* of the same type.
*/
virtual Teuchos::RCP<DerivUtils>
clone(NOX::CopyType type = NOX::DeepCopy) const;
/*!
* \brief Compute derivative of f with respect to parameter, identified
* by param_id
*/
virtual NOX::Abstract::Group::ReturnType
computeDfDp(LOCA::MultiContinuation::AbstractGroup& grp,
const std::vector<int>& param_ids,
NOX::Abstract::MultiVector& result,
bool isValidF) const;
//! Compute derivative of Jn with respect to particular parameter param_id
virtual NOX::Abstract::Group::ReturnType
computeDJnDp(LOCA::MultiContinuation::AbstractGroup&,
const std::vector<int>& paramIDs,
const NOX::Abstract::Vector& nullVector,
NOX::Abstract::MultiVector& result,
bool isValid) const;
//! Compute vector (Jn)_{x}a given multi-vector a
virtual NOX::Abstract::Group::ReturnType
computeDJnDxa(LOCA::MultiContinuation::AbstractGroup& grp,
const NOX::Abstract::Vector& nullVector,
const NOX::Abstract::MultiVector& aVector,
NOX::Abstract::MultiVector& result) const;
//! Compute vector (Jn)_{x}a given multi-vector a, given JnVector
virtual NOX::Abstract::Group::ReturnType
computeDJnDxa(LOCA::MultiContinuation::AbstractGroup& grp,
const NOX::Abstract::Vector& nullVector,
const NOX::Abstract::MultiVector& aVector,
const NOX::Abstract::Vector& JnVector,
NOX::Abstract::MultiVector& result) const;
/*!
* \brief Compute derivative of w^TJn with respect to particular parameter
* param_id
*/
virtual NOX::Abstract::Group::ReturnType
computeDwtJnDp(LOCA::MultiContinuation::AbstractGroup& grp,
const std::vector<int>& paramIDs,
const NOX::Abstract::Vector& w,
const NOX::Abstract::Vector& nullVector,
NOX::Abstract::MultiVector::DenseMatrix& result,
bool isValid) const;
/*!
* \brief Compute derivative of w^TJ with respect to particular parameter
* param_id
*/
virtual NOX::Abstract::Group::ReturnType
computeDwtJDp(LOCA::MultiContinuation::AbstractGroup& grp,
const std::vector<int>& paramIDs,
const NOX::Abstract::Vector& w,
NOX::Abstract::MultiVector& result,
bool isValid) const;
//! Compute vector (w^TJn)_{x}
virtual NOX::Abstract::Group::ReturnType
computeDwtJnDx(LOCA::MultiContinuation::AbstractGroup& grp,
const NOX::Abstract::Vector& w,
const NOX::Abstract::Vector& nullVector,
NOX::Abstract::Vector& result) const;
//! Compute vector (w^TJn)_{x}
virtual NOX::Abstract::Group::ReturnType
computeDwtJnDx(LOCA::MultiContinuation::AbstractGroup& grp,
const NOX::Abstract::MultiVector& w,
const NOX::Abstract::Vector& nullVector,
NOX::Abstract::MultiVector& result) const;
//! Compute derivative of (J+iwM)(y+iz) with respect to parameter,
virtual NOX::Abstract::Group::ReturnType
computeDCeDp(LOCA::Hopf::MooreSpence::AbstractGroup& grp,
const std::vector<int>& paramIDs,
const NOX::Abstract::Vector& yVector,
const NOX::Abstract::Vector& zVector,
double w,
NOX::Abstract::MultiVector& result_real,
NOX::Abstract::MultiVector& result_imag,
bool isValid) const;
//! Compute vector (J+iwM)(y+iz))_{x}a given a
virtual NOX::Abstract::Group::ReturnType
computeDCeDxa(LOCA::Hopf::MooreSpence::AbstractGroup& grp,
const NOX::Abstract::Vector& yVector,
const NOX::Abstract::Vector& zVector,
double w,
const NOX::Abstract::MultiVector& aVector,
NOX::Abstract::MultiVector& result_real,
NOX::Abstract::MultiVector& result_imag) const;
//! Compute vector (J+iwM)(y+iz))_{x}a given a and (J+iwM)(y+iz) vector
virtual NOX::Abstract::Group::ReturnType
computeDCeDxa(LOCA::Hopf::MooreSpence::AbstractGroup& grp,
const NOX::Abstract::Vector& yVector,
const NOX::Abstract::Vector& zVector,
double w,
const NOX::Abstract::MultiVector& aVector,
const NOX::Abstract::Vector& Ce_real,
const NOX::Abstract::Vector& Ce_imag,
NOX::Abstract::MultiVector& result_real,
NOX::Abstract::MultiVector& result_imag) const;
//! Compute derivative of (w1+iw2)^T(J+iwM)(y+iz) w.r.t. parameter p
virtual NOX::Abstract::Group::ReturnType
computeDwtCeDp(LOCA::Hopf::MinimallyAugmented::AbstractGroup& grp,
const std::vector<int>& paramIDs,
const NOX::Abstract::Vector& w1,
const NOX::Abstract::Vector& w2,
const NOX::Abstract::Vector& yVector,
const NOX::Abstract::Vector& zVector,
double omega,
NOX::Abstract::MultiVector::DenseMatrix& result_real,
NOX::Abstract::MultiVector::DenseMatrix& result_imag,
bool isValid) const;
//! Compute vector (w1+iw2)^T(J+iwM)(y+iz))_{x}
virtual NOX::Abstract::Group::ReturnType
computeDwtCeDx(LOCA::Hopf::MinimallyAugmented::AbstractGroup& grp,
const NOX::Abstract::Vector& w1,
const NOX::Abstract::Vector& w2,
const NOX::Abstract::Vector& yVector,
const NOX::Abstract::Vector& zVector,
double omega,
NOX::Abstract::Vector& result_real,
NOX::Abstract::Vector& result_imag) const;
protected:
/*!
* \brief Perturb parameter param_id in the group's parameter vector,
* and return perturbation size
*/
virtual double perturbParam(LOCA::MultiContinuation::AbstractGroup& grp,
double& param,
int param_id) const;
/*!
* \brief Perturb group's solution vector in direction of aVector,
* and return perturbation size
*/
virtual double perturbXVec(LOCA::MultiContinuation::AbstractGroup& grp,
const NOX::Abstract::Vector& xVector,
const NOX::Abstract::Vector& aVector) const;
/*!
* \brief Return perturbation for finite differencing around given
* double variable
*/
virtual double epsScalar(double p) const;
/*!
* \brief Return perturbation for directional derivatives around first
* vector in direction of second vector
*/
virtual double epsVector(const NOX::Abstract::Vector& xVector,
const NOX::Abstract::Vector& aVector) const;
protected:
//! Global data
Teuchos::RCP<LOCA::GlobalData> globalData;
//! Relative perturbation size using in differencing calculations.
double perturb;
}; // class DerivUtils
} // namespace LOCA
#endif
|