/usr/include/trilinos/MLAPI_Expressions.h is in libtrilinos-ml-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 | #ifndef ML_EXPRESSIONS_H
#define ML_EXPRESSIONS_H
#include "MLAPI_LinearCombinations.h"
namespace MLAPI {
/*!
\file MLAPI_Expressions.h
\brief Overloaded operators for MultiVector's, Operator's, and InverseOpereator's.
\author Marzio Sala, SNL 9214.
\date Last updated on Feb-05.
*/
/* ******************************************************************** */
/* See the file COPYRIGHT for a complete copyright notice, contact */
/* person and disclaimer. */
/* ******************************************************************** */
// =============================================== //
// OPERATOR + BETWEEN VECTORS AND LINEAR OPERATORS //
// =============================================== //
// ======================================================================
//! Creates a new MultiVector, defined as x + y
// ======================================================================
#ifndef MLAPI_LC
MultiVectorCombination operator+(const MultiVector& x, const MultiVector& y);
LinearCombinationAdd operator+(const BaseLinearCombination& left,
const BaseLinearCombination& right);
LinearCombinationMixed operator+(const BaseLinearCombination& left,
const MultiVector& right);
LinearCombinationMixed operator+(const MultiVector& left,
const BaseLinearCombination& right);
// ======================================================================
//! Creates a new MultiVector, defined as alpha * x + beta * y
// ======================================================================
MultiVectorCombination operator+(const MultiVectorScaled& left,
const MultiVectorScaled& right);
// ======================================================================
//! Creates a new MultiVector, defined as alpha * x + A * y
// ======================================================================
Residual operator+(const MultiVectorScaled& left,
const BaseOperatorTimesMultiVector& right);
// ======================================================================
//! Creates a new MultiVector, defined as x + A * y
// ======================================================================
Residual operator+(const MultiVector& left,
const BaseOperatorTimesMultiVector& right);
// ======================================================================
//! Creates a new MultiVector, defined as alpha * x + beta * y
// ======================================================================
MultiVectorCombination operator+(const MultiVectorScaled& left,
const MultiVectorScaled& right);
// ======================================================================
//! Creates a new MultiVector, defined as alpha * x + A * y
// ======================================================================
Residual operator+(const MultiVectorScaled& left,
const BaseOperatorTimesMultiVector& right);
// ======================================================================
//! Creates a new MultiVector, defined as x + A * y
// ======================================================================
Residual operator+(const MultiVector& left,
const BaseOperatorTimesMultiVector& right);
// =============================================== //
// OPERATOR - BETWEEN VECTORS AND LINEAR OPERATORS //
// =============================================== //
// ======================================================================
//! Creates a new MultiVector, defined as x - y
// ======================================================================
MultiVectorCombination operator-(const MultiVector& x, const MultiVector& y);
LinearCombinationAdd operator-(const BaseLinearCombination& left,
const BaseLinearCombination& right);
LinearCombinationMixed operator-(const BaseLinearCombination& left,
const MultiVector& right);
LinearCombinationMixed operator-(const MultiVector& left,
const BaseLinearCombination& right);
// ======================================================================
//! Creates a new MultiVector, defined as x - A * y
// ======================================================================
Residual operator-(const MultiVector& left,
const BaseOperatorTimesMultiVector& right);
#else
inline
MultiVector operator+(const MultiVector& x, const MultiVector& y)
{
MultiVector res(x.GetVectorSpace(), y.GetNumVectors());
res.Update(1.0, x, 1.0, y);
return(res);
}
inline
MultiVector operator-(const MultiVector& x, const MultiVector& y)
{
MultiVector res(x.GetVectorSpace(), y.GetNumVectors());
res.Update(1.0, x, -1.0, y);
return(res);
}
inline
MultiVector operator*(const Operator& A, const MultiVector& y)
{
MultiVector res(A.GetOperatorRangeSpace(), y.GetNumVectors());
A.Apply(y, res);
return(res);
}
#endif
// ======================================================================
//! Creates a new MultiVector, defined as x + alpha
// ======================================================================
MultiVector operator+(const MultiVector& x, const double alpha);
// ======================================================================
//! Creates a new MultiVector, defined as alpha + x
// ======================================================================
MultiVector operator+(const double alpha, const MultiVector& x);
// ======================================================================
//! Creates a new MultiVector, defined as x - alpha
// ======================================================================
MultiVector operator-(const MultiVector& x, const double alpha);
// ======================================================================
//! Creates a new MultiVector, defined as alpha - y
// ======================================================================
MultiVector operator-(const double alpha, const MultiVector& x);
#if 0
// ======================================================================
//! Adds a constant to a vector
// ======================================================================
MultiVector operator+= (const double alpha);
// ======================================================================
//! Subtracts a constant to a vector
// ======================================================================
MultiVector operator-= (const double alpha);
#endif
// ======================================================================
//! Creates a new Operator, defined as A + B
// ======================================================================
Operator operator+(const Operator& A, const Operator& B);
// ======================================================================
//! Creates a new Operator, defined as A - B
// ======================================================================
Operator operator-(const Operator& A, const Operator& B);
// ======================================================================
//! Creates a new Operator, defined as A * B
// ======================================================================
Operator operator*(const Operator& A, const Operator& B);
// ======================================================================
//! Creates a new Operator, defined as A * alpha
// ======================================================================
Operator operator*(const Operator& A, const double alpha);
// ======================================================================
//! Creates a new Operator, defined as alpha * A
// ======================================================================
Operator operator*(const double alpha, const Operator& A);
// ======================================================================
//! Creates a new Operator, defined as A / alpha
// ======================================================================
inline Operator operator/(const Operator& A, const double alpha)
{
return(A * (1.0 / alpha));
}
// ======================================================================
//! Creates a new MultiVector, defined as x * alpha
// ======================================================================
MultiVector operator*(const MultiVector& x, const double alpha);
inline MultiVector operator*(const double alpha, const MultiVector&x)
{
return(x * alpha);
}
// ======================================================================
//! Creates a new MultiVector y, such that y = x / alpha
// ======================================================================
MultiVector operator/(const MultiVector& x, const double alpha);
#ifndef MLAPI_LC
// ======================================================================
//! Creates a new MultiVector y, such that y = A * x.
// ======================================================================
BaseOperatorTimesMultiVector operator*(const BaseOperator& A, const MultiVector& x);
// ======================================================================
//! Creates a new MultiVector y, such that y = A * x (x is a BaseLinearCombination)
// ======================================================================
BaseOperatorTimesMultiVector operator*(const BaseOperator& A,
const BaseLinearCombination& x);
#else
inline
MultiVector operator*(const BaseOperator& A, const MultiVector& x)
{
MultiVector res(A.GetOperatorRangeSpace(), x.GetNumVectors());
A.Apply(x, res);
return(res);
}
#endif
// ======================================================================
//! Computes the dot product between the first vector in x and y
// ======================================================================
double operator* (const MultiVector& x, const MultiVector& y);
#ifndef MLAPI_LC
double operator* (const MultiVector& x, const BaseLinearCombination& y);
double operator* (const BaseLinearCombination& x, const MultiVector& y);
double operator* (const BaseLinearCombination& x, const BaseLinearCombination& y);
#endif
} // namespace MLAPI
#endif // if ML_EXPRESSIONS_H
|