/usr/include/trilinos/DenseLinAlgPack_DVectorOp.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.
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 | // @HEADER
// ***********************************************************************
//
// Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
// Copyright (2003) 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.
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
// Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
//
// ***********************************************************************
// @HEADER
//
// See DenseLinAlgPack_DMatrixOp.hpp for description of naming convensions
#ifndef VECTOROP_H
#define VECTOROP_H
#include "DenseLinAlgPack_DVectorAssign.hpp"
/* * @name {\bf Basic DVector Operation Functions (Level-1 BLAS)}.
*
* These are functions that perform basic operations with vectors such as element-wise
* linear algebra operations (e.g. v1 = v2 + v3, v1 = sin(v2)) and other vector
* related functions. The functions that have vectors as lhs arguments come in
* two varieties: those with a DVector object as the lhs argument (v_lhs), those with
* a DVectorSlice object as a lhs argument (vs_lhs). Having different functions
* for DVector and DVectorSlice objects as lhs arguments is important because
* Vectors resize to the rhs expression while DVectorSlice objects do not.
*
* Only DVectorSlice objects are used as rhs arguments however. When DVector objects
* are used to call these fucntions as rhs arguments, the implicit type conversion
* to a const temp DVectorSlice will be performed to make the call work.
*
* The implementations of these functions takes care of the following details:
*
* <ul>
* <li> Resizing DVector LHS on assignment
* <li> Test for aliasing of assign(...) but not other functions
* <li> Check preconditions (sizes of arguments) if LINALGPACK_CHECK_RHS_SIZES is defined
* </ul>
*
* These functions share common behavior and precondtions which are listed below.
*
* Preconditions for functions with a DVectorSlice object (vs_lhs) as a lhs argument
* (e.g. vs_lhs = abs(vs_rhs), vs_lhs = vs_rhs1 + vs_rhs2).
* <ul>
* <li> #vs_lhs.size() ==# size of rhs expression (throw #std::length_error#)
* </ul>
*
* Preconditions for functions with two DVectorSlice objects (vs_rhs1, vs_rhs2) rhs arguments
* (e.g. v_lhs = pow(vs_rhs1,vs_rhs2), result = trans(vs_rhs1,vs_rhs2)):
* <ul>
* <li> #vs_rhs1.size() == vs_rhs2.size()# (throw #std::length_error#)
* </ul>
*
* Algebric functions are named according to the types of their arguments. For example,
* the function for the operation vs_lhs = vs_rhs1 - vs_rhs2 is named V_VmV(...).
* For a description of this namming format see
* \Ref{LinAlgOpPack}
*/
// @{
// begin Basic DVector Operation Functions
namespace DenseLinAlgPack {
/* * @name {\bf Algebraic Functions}.
*
* The functions assign(...) are used by the implementation of the assignment operators for
* DVector and DVectorSlice and therefore the user can use the assignment operator to
* perform the copies.
*/
// @{
// begin Algebraic Functions
/// vs_lhs += alpha
void Vp_S(DVectorSlice* vs_lhs, value_type alpha);
/// vs_lhs *= alpha (BLAS xSCAL) (*** Note that alpha == 0.0 is handeled as vs_lhs = 0.0)
void Vt_S(DVectorSlice* vs_lhs, value_type alpha);
/// vs_lhs += alpha * vs_rhs (BLAS xAXPY)
void Vp_StV(DVectorSlice* vs_lhs, value_type alpha, const DVectorSlice& vs_rhs);
/// v_lhs = alpha (elementwise)
//void assign(DVector* v_lhs, value_type alpha);
/// v_lhs = vs_rhs.
//void assign(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = vs_rhs1 + vs_rhs2
void V_VpV(DVector* v_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// v_lhs = vs_rhs1 - vs_rhs2
void V_VmV(DVector* v_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// v_lhs = - vs_rhs
void V_mV(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = alpha * vs_rhs
void V_StV(DVector* v_lhs, value_type alpha, const DVectorSlice& vs_rhs);
/// vs_lhs = alpha (elementwise)
//void assign(DVectorSlice* vs_lhs, value_type alpha);
/// vs_lhs = vs_rhs
//void assign(DVectorSlice* vs_lhs, const DVectorSlice& vx_rhs);
/// vs_lhs = vs_rhs1 + vs_rhs2
void V_VpV(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// vs_lhs = vs_rhs1 - vs_rhs2
void V_VmV(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// vs_lhs = - vs_rhs
void V_mV(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs);
/// vs_lhs = alpha * vs_rhs
void V_StV(DVectorSlice* vs_lhs, value_type alpha, const DVectorSlice& vs_rhs);
/** \brief . */
/* Apply a plane (Givens) rotation.
*
* [ c s ] * [ x' ] -> [ x' ]
* [ -s c ] [ y' ] [ y' ]
*
* See "Handbook for Matrix Computations" section 2.4
*/
void rot( const value_type c, const value_type s, DVectorSlice* x, DVectorSlice* y );
// end Algebraic Functions
// @}
/* * @name {\bf Elementwise Math DVector / DVectorSlice Functions}. */
// @{
// begin Elementsize Math Functions
/// vs_lhs = abs(vs_rhs)
void abs(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs);
/// vs_lhs = asin(vs_rhs)
void asin(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs);
/// vs_lhs = acos(vs_rhs)
void acos(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs);
/// vs_lhs = atan(vs_rhs)
void atan(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs);
/// vs_lhs = atan(vs_rhs1/vs_rhs2)
void atan2(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// vs_lhs = atan(vs_rhs/alpha)
void atan2(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs, value_type alpha);
/// vs_lhs = atan(alpha/vs_rhs)
void atan2(DVectorSlice* vs_lhs, value_type alpha, const DVectorSlice& vs_rhs);
/// vs_lhs = cos(vs_rhs)
void cos(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs);
/// vs_lhs = cosh(vs_rhs)
void cosh(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs);
/// vs_lhs = exp(vs_rhs)
void exp(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs);
/// vs_lhs = max(vs_rhs1,vs_rhs2)
void max(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// vs_lhs = max(alpha,vs_rhs)
void max(DVectorSlice* vs_lhs, value_type alpha, const DVectorSlice& vs_rhs);
/// vs_lhs = min(vs_rhs1,vs_rhs2)
void min(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// vs_lhs = mim(alpha,vs_rhs)
void min(DVectorSlice* vs_lhs, value_type alpha, const DVectorSlice& vs_rhs);
/// vs_lhs = pow(vs_rhs1,vs_rhs2)
void pow(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// vs_lhs = pow(vs_rhs,alpha)
void pow(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs, value_type alpha);
/// vs_lhs = pow(vs_rhs,n)
void pow(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs, int n);
/// vs_lhs = pow(alpha,vs_rhs)
void pow(DVectorSlice* vs_lhs, value_type alpha, const DVectorSlice& vs_rhs);
/// vs_lhs(i) = vs_rhs1(i) * vs_rhs2(i), i = 1...n
void prod(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// vs_lhs = sqrt(vs_rhs)
void sqrt(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs);
/// vs_lhs = sin(vs_rhs)
void sin(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs);
/// vs_lhs = sinh(vs_rhs)
void sinh(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs);
/// vs_lhs = tan(vs_rhs)
void tan(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs);
/// vs_lhs = tanh(vs_rhs)
void tanh(DVectorSlice* vs_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = abs(vs_rhs)
void abs(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = asin(vs_rhs)
void asin(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = acos(vs_rhs)
void acos(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = atan(vs_rhs)
void atan(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = atan(vs_rhs1/vs_rhs2)
void atan2(DVector* v_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// v_lhs = atan(vs_rhs/alpha)
void atan2(DVector* v_lhs, const DVectorSlice& vs_rhs, value_type alpha);
/// v_lhs = atan(alpha/vs_rhs)
void atan2(DVector* v_lhs, value_type alpha, const DVectorSlice& vs_rhs);
/// v_lhs = cos(vs_rhs)
void cos(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = cosh(vs_rhs)
void cosh(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = exp(vs_rhs)
void exp(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = max(vs_rhs1,vs_rhs2)
void max(DVector* v_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// v_lhs = max(alpha,vs_rhs)
void max(DVector* v_lhs, value_type alpha, const DVectorSlice& vs_rhs);
/// v_lhs = min(vs_rhs1,vs_rhs2)
void min(DVector* v_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// v_lhs = mim(alpha,vs_rhs)
void min(DVector* v_lhs, value_type alpha, const DVectorSlice& vs_rhs);
/// v_lhs = pow(vs_rhs1,vs_rhs2)
void pow(DVector* v_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// v_lhs = pow(vs_rhs,alpha)
void pow(DVector* v_lhs, const DVectorSlice& vs_rhs, value_type alpha);
/// v_lhs = pow(vs_rhs,n)
void pow(DVector* v_lhs, const DVectorSlice& vs_rhs, int n);
/// v_lhs = pow(alpha,vs_rhs)
void pow(DVector* v_lhs, value_type alpha, const DVectorSlice& vs_rhs2);
/// v_lhs = sqrt(vs_rhs)
void sqrt(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = sin(vs_rhs)
void sin(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = sinh(vs_rhs)
void sinh(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = tan(vs_rhs)
void tan(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs = tanh(vs_rhs)
void tanh(DVector* v_lhs, const DVectorSlice& vs_rhs);
/// v_lhs(i) = vs_rhs1(i) * vs_rhs2(i), i = 1...n
void prod( DVector* vs_lhs, const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2 );
// end Elementsize Math Functions
// @}
/* * @name {\bf Scalar Returning and Misc DVectorSlice Functions}. */
// @{
// begin Scalar Returning DVectorSlice Functions}
/// result = vs_rhs1' * vs_rhs2 (BLAS xDOT)
value_type dot(const DVectorSlice& vs_rhs1, const DVectorSlice& vs_rhs2);
/// result = max(vs_rhs)
value_type max(const DVectorSlice& vs_rhs);
/// result = min(vs_rhs)
value_type min(const DVectorSlice& vs_rhs);
/// result = ||vs_rhs||1 (BLAS xASUM)
value_type norm_1(const DVectorSlice& vs_rhs);
/// result = ||vs_rhs||2 (BLAS xNRM2)
value_type norm_2(const DVectorSlice& vs_rhs);
/// result = ||vs_rhs||infinity (BLAS IxAMAX)
value_type norm_inf(const DVectorSlice& vs_rhs);
// Misc. operations
/// swap(vs1, vs2). Swaps the contents of vs1 and vs2
void swap(DVectorSlice* vs1, DVectorSlice* vs2);
// end Scalar Returning DVectorSlice Functions
// @}
} // end namespace DenseLinAlgPack
// end Basic DVector Operation Functions
// @}
#endif // VECTOROP_H
|