/usr/include/trilinos/ROL_MultiVector.hpp is in libtrilinos-rol-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 | // @HEADER
// ************************************************************************
//
// Rapid Optimization Library (ROL) Package
// Copyright (2014) 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 lead developers:
// Drew Kouri (dpkouri@sandia.gov) and
// Denis Ridzal (dridzal@sandia.gov)
//
// ************************************************************************
// @HEADER
/** @ingroup la_group
* \class ROL::MultiVector
* \brief Provides a container and operations on multiple ROL vectors for
* use with other Trilinos packages which require multivectors
*/
#ifndef ROL_MULTIVECTOR_HPP
#define ROL_MULTIVECTOR_HPP
#include <vector>
#include "ROL_Vector.hpp"
#include "Teuchos_ArrayRCP.hpp"
#include "Teuchos_SerialDenseMatrix.hpp"
namespace ROL {
template<class Real>
class MultiVector {
typedef Vector<Real> V; // Single vector
typedef Teuchos::RCP<V> PV; // Pointer to a vector
typedef Teuchos::ArrayRCP<PV> APV; // Array of pointers to vectors
typedef MultiVector<Real> MV; // Instance of the base class
typedef Teuchos::RCP<MV> PMV; // Pointer to an instance of the class
public:
virtual ~MultiVector() {}
/** \brief Make a new MultiVector of the same dimensions
@return A reference-counted pointer to the cloned MultiVector
*/
virtual PMV clone() const = 0;
/** \brief Make a new MultiVector of specified "width"
@return A reference-counted pointer to the cloned MultiVector
*/
virtual PMV clone( const int numvecs ) const = 0;
/** \brief Make a deep copy of this MultiVector
@return A reference-counted pointer to a new MultiVector containing
deep copied values
*/
virtual PMV deepCopy() const = 0;
/** \brief Make a deep copy of this MultiVector
@param[in] Array of indices of the vectors to copy
@return A reference-counted pointer to a new MultiVector containing
deep copied values
*/
virtual PMV deepCopy(const std::vector<int> &index) const = 0;
/** \brief Make a shallow copy of this MultiVector
@param[in] Array of indices of the vectors to copy
@return A reference-counted pointer to a new MultiVector where the
elements point to the data in *this
*/
virtual PMV shallowCopy(const std::vector<int> &index) = 0;
/** \brief Make a shallow copy of this MultiVector
@param[in] Array of indices of the vectors to copy
@return A reference-counted pointer to a new MultiVector where the
elements point to the data in *this
*/
virtual const PMV shallowCopyConst(const std::vector<int> &index) const = 0;
/** \brief Get the number of elements of a vector in the MultiVector
@return Number of elements in a vector
*/
virtual ptrdiff_t getLength() const = 0;
/** \brief Get the number of vectors in the MultiVector
@return Number of vectors in the MultiVector
*/
virtual int getNumberOfVectors() const = 0;
/** \brief Generic BLAS level 3 matrix multiplication
\f$\text{this}\leftarrow \alpha A B+\beta\text{*this}\f$
@param[in] alpha is a multiplicative factor of @b A
@param[in] @b A is a MultiVector
@param[in] @b B is a SerialDenseMatrix applied to A from the right
@param[in] beta is a multiplicative factor of *this
*/
virtual void gemm(const Real alpha,
const MV& A,
const Teuchos::SerialDenseMatrix<int,Real> &B,
const Real beta) = 0;
/** \brief Perform the axpy operation columnwise on the MultiVector
\f$ y_i\leftarrow y_i+\alpha x_i\f$ where \f$y\f$ is this MultiVector
@param[in] alpha is the scaling factor
@param[in] mv is the
*/
virtual void axpy(const Real alpha, const MV& x) = 0;
/** \brief Scale the MultiVector by a single scalar alpha
\f$\text{this}\leftarrow\alpha\text{this}\f$
@param[in] alpha is a scalar multiplicative factor
*/
virtual void scale(const Real alpha) = 0;
/** \brief Scale each vector in the MultiVector by a different alpha
\f$\text{this}[i]\leftarrow\alpha[i]\text{*this}[i]\f$
@param[in] alpha is a vector of multiplicative factors
*/
virtual void scale(const std::vector<Real> &alpha) = 0;
/** \brief Set the MultiVector equal to another MultiVector
@param[in] @b A is a MultiVector
*/
virtual void set(const MV &A) = 0;
/** \brief Set some of the vectors in this MultiVector equal to corresponding
vectors in another MultiVector
@param[in] @b A is a MultiVector
*/
virtual void set(const MV &A, const std::vector<int> &index) = 0;
/** \brief Compute \f$\alpha A^\top \text{*this}\f$
@param[in] alpha is a multiplicative factor
@param[in] @b A is a MultiVector
@param[out] @b B is a SerialDenseMartrix in which to store the alpha-scaled
dot products of this MultiVector's vectors with those of @b A
*/
virtual void innerProducts(const Real alpha,
const MV &A,
Teuchos::SerialDenseMatrix<int,Real> &B) const = 0;
/** \brief Compute dot products of pairs of vectors
@param[in] @b A is a MultiVector
@param[out] &b b is a vector containing the dot products between
vectors contained in @b A and this MultiVector
*/
virtual void dots(const MV &A,
std::vector<Real> &b) const = 0;
/** \brief Compute the norm of each vector in the MultiVector
@param[out] &b b is a vector containing the norms of the vectors
contained in this MultiVector
*/
virtual void norms(std::vector<Real> &normvec) const = 0;
/** \brief Zero each of the vectors in the MultiVector
*/
virtual void zero() = 0;
/** \brief Return a pointer to the ith vector
@param[in] i is the index of the desired vector
@return A reference-counted pointer to the desired vector
*/
virtual PV getVector(int i) const = 0;
};
}
#endif
|