This file is indexed.

/usr/include/trilinos/ConstrainedOptPack_MatrixVarReductImplicit.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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
// @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

#ifndef MATRIX_VAR_REDUCT_IMPLICIT_H
#define MATRIX_VAR_REDUCT_IMPLICIT_H

#include <vector>
#include <list>

#include "ConstrainedOptPack_Types.hpp"
#include "AbstractLinAlgPack_MatrixOp.hpp"
#include "AbstractLinAlgPack_VectorSpace.hpp"

namespace ConstrainedOptPack {

/** \brief Implements <tt>D = - inv(C) * N</tt> for a variable reduction projection.
 *
 * This class is used to implement an implicit matrix defined as
 \verbatim
 
 D = - inv(C) * N
 \endverbatim
 * The operations <tt>y = op(D)*x</tt> are implemented as:
 \verbatim

  y = D * x
    = -inv(C) * (N * x)

  y = D' * x
    = - N' * (inv(C') * x)
 \endverbatim
 * This class also allows the client to set a precomputed matrix \c D_direct
 * that represents <tt>D = -inv(C)*N</tt> that will be used to extract rows or columns
 * or to implement operations involving <tt>GenPermMatrixSlice</tt>
 * when convenient.  One might ask why this subclass would even be used if
 * \c D_direct was even available.  The reason is that it may be cheaper to perform
 * the sparse solve and matrix-vector multiplication with \c C and \c N than it is
 * to use a dense precomputed matrix \c D_direct.  Determining if this class is
 * even useful when \c D_direct is availible must be determined at runtime
 * using timing data (which can be very hard to do well in general).
 *
 * This implementation is designed to deal efficiently with the case where matrix-
 * vector multiplications will only be performed with subsets of rows of 
 * <tt>inv(C)*N</tt> or columns of <tt>N'*inv(C')</tt>.  This primarily affects
 * two types of operations:<ul>
 * <li> <tt>y = b*y + a*[-N'*inv(C')]*x</tt> (\c x is a <tt>SpVectorSlice</tt> object)
 * <li> <tt>y = b*y + a*op(P)*[-inv(C)*N]*x</tt> (\c P has few nonzeros, x is any vector)
 * </ul>
 * when \c D_direct is not set then needed rows of <tt>inv(C)*N</tt> are generated on the fly
 * (as abstract vectors) and stored away for later use.  When <tt>this->initialize()</tt> is
 * called then all of these computed rows are discarded and they must be generated again.
 */
class MatrixVarReductImplicit
  : public AbstractLinAlgPack::MatrixOp
{
public:

  /** @name Public types */
  //@{
  
  /** \brief . */
  typedef Teuchos::RCP<const MatrixOpNonsing>   mat_nonsing_ptr_t;
  /** \brief . */
  typedef Teuchos::RCP<const MatrixOp>              mat_ptr_t;

  //@}

  /** @name Constructors / initializers */
  //@{

  /** \brief Initialize \c this matrix object.
   *
   * @param  C  [in] Nonsingular basis matrix object.  This matrix object must
   *            not be altered while \c this is in use or until
   *            <tt>this->initialize()</tt> is called again.
   * @param  N  [in] Genaral nonbasis matrix object.  This matrix object must
   *            not be altered while \c this is in use or until
   *            <tt>this->initialize()</tt> is called again.
   * @param  D_direct
   *            [in] Matrix object for <tt>D = -inv(C)*N</tt> already
   *            computed.  The matrix object \c D_direct will not be modifed
   *            by \c this and must not be altered while c\ this matrix object
   *            is in use or until <tt>this->initialize()</tt> is called again.
   *            <tt>D_direct == NULL</tt> is allowed and \c this matrix object
   *            will just have to do without.  For most applications (except
   *            those using direct linear solvers for \c C and when \c N has
   *            many columns) <tt>D_direct</tt> should be set to <tt>NULL</tt>
   *            and should not be computed by the client (that is the whole
   *            purpose for this matrix class).
   *
   * Preconditions:<ul>
   * <li> <tt>C.get() != NULL</tt> (throw <tt>std::invalid_argument</tt>)
   * <li> <tt>N.get() != NULL</tt> (throw <tt>std::invalid_argument</tt>)
   * <li> [<tt>D_direct != NULL</tt>]
   *      <tt>D_direct->space_cols().is_compatible(C->space_cols()) == true
   *      && D_direct->space_rows().is_compatible(N->space_rows()) == true</tt>
   *      (throw <tt>VectorSpace::IncompatibleVectorSpaces</tt>)
   * </ul>
   *
   * Postconditions:<ul>
   * <li> <tt>this->C_ptr().get() == C.get()</tt>
   * <li> <tt>this->N_ptr().get() == N.get()</tt>
   * <li> <tt>this->D_direct_ptr().get() == N.get()</tt>
   * </ul>
   */
  virtual void initialize(
    const mat_nonsing_ptr_t          &C
    ,const mat_ptr_t                 &N
    ,const mat_ptr_t                 &D_direct
    );
  /** \brief Set the matrix to uninitialized.
   *
   * Postconditions:<ul>
   * <li> <tt>this->C_ptr().get() == NULL</tt>
   * <li> <tt>this->N_ptr().get() == NULL</tt>
   * <li> <tt>this->D_direct_ptr().get() == NULL</tt>
   * </ul>
   */
  virtual void set_uninitialized();

  //@}

  /** @name Access */
  //@{

  /** \brief Return the smart pointer to the aggregate basis matrix object \c C.
   *
   * If <tt>this</tt> is the only reference to this matrix object, then
   * <tt>return.count() == 1</tt> will be true.
   */
  const mat_nonsing_ptr_t& C_ptr() const;
  
  /** \brief Return the smart pointer to the aggregate nonbasis matrix object \c N.
   *
   * If <tt>this</tt> is the only reference to this matrix object, then
   * <tt>return.count() == 1</tt> will be true.
   */
  const mat_ptr_t& N_ptr() const;
  
  /** \brief Return the smart pointer to the aggregate precomputed matrix object \c D_direct (if set).
   *
   * If <tt>this</tt> is the only reference to this matrix object, then
   * <tt>return.count() == 1</tt> will be true.
   */
  const mat_ptr_t& D_direct_ptr() const;
  
  //@}

  /** @name Overridden from MatrixBase. */
  //@{
  /** \brief . */
  size_type rows() const;
  /** \brief . */
  size_type cols() const;
  //@}

  /** @name Overridden from MatrixOp. */
  //@{

  /** \brief . */
  const VectorSpace& space_cols() const;
  /** \brief . */
  const VectorSpace& space_rows() const;
  /** \brief . */
  MatrixOp& operator=(const MatrixOp& M);
  /** \brief . */
  std::ostream& output(std::ostream&) const;
  /** \brief . */
  void Vp_StMtV(
    VectorMutable* v_lhs, value_type alpha
    ,BLAS_Cpp::Transp trans_rhs1
    ,const Vector& v_rhs2, value_type beta
    ) const;
  /** \brief . */
  void Vp_StMtV(
    VectorMutable* v_lhs, value_type alpha
    ,BLAS_Cpp::Transp trans_rhs1
    ,const SpVectorSlice& sv_rhs2, value_type beta
    ) const;
  /** \brief . */
  void Vp_StPtMtV(
    VectorMutable* v_lhs, value_type alpha
    ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
    ,BLAS_Cpp::Transp M_rhs2_trans
    ,const Vector& v_rhs3, value_type beta
    ) const;
  /** \brief . */
  void Vp_StPtMtV(
    VectorMutable* v_lhs, value_type alpha
    ,const GenPermMatrixSlice& P_rhs1, BLAS_Cpp::Transp P_rhs1_trans
    ,BLAS_Cpp::Transp M_rhs2_trans
    ,const SpVectorSlice& sv_rhs3, value_type beta
    ) const;
  
  //@}
  
private:
  
  // //////////////////////////
  // Private types
  
  typedef std::vector<VectorSpace::vec_mut_ptr_t>    InvCtN_rows_t;
  typedef std::list<index_type>                      InvCtN_rows_set_list_t;

  // //////////////////////////
  // Private data members

#ifdef DOXYGEN_COMPILE
  AbstractLinAlgPack::MatrixOpNonsing  *C;
  AbstractLinAlgPack::MatrixOp             *N;
  AbstractLinAlgPack::MatrixOp             *D_direct;
#else
  mat_nonsing_ptr_t                   C_;
  mat_ptr_t                           N_;
  mat_ptr_t                           D_direct_;

  mutable InvCtN_rows_t               InvCtN_rows_;
  // InvCtN_rows_ keeps track of a set pointers of computed rows of inv(C)*N.
  // If D_direct_ is setup then InvCtN_rows_ is not necessary.  However, if
  // not, then InvCtN_rows_[j-1] will be !=NULL if it points to the precomputed
  // jth row of inv(C)*N and will be ==NULL if this row has not been computed
  // yet.  Each time initialize(...) is called, these rows are deallocated and
  // InvCtN_rows_[j-1], j=1...this->rows() is set to NULL.

  mutable InvCtN_rows_set_list_t      InvCtN_rows_set_list_;
  // InvCtN_rows_set_list_ keeps a unorderd=ed list of the row indexes that are
  // currently updated.  Keeping this list allows the vectors allocated in 
  // InvCtN_rows_[] to be deallocated much faster than if the whole array
  // had to be searched everytime that this->initialize() was called again.

#endif

  // //////////////////////////////////
  // Private member functions

  /** \brief . */
  void assert_initialized() const;

};	// end class MatrixVarReductImplicit

// ////////////////////////////////
// Inline members

inline
const MatrixVarReductImplicit::mat_nonsing_ptr_t&
MatrixVarReductImplicit::C_ptr() const
{
  return C_;
}

inline
const MatrixVarReductImplicit::mat_ptr_t&
MatrixVarReductImplicit::N_ptr() const
{
  return N_;
}

inline
const MatrixVarReductImplicit::mat_ptr_t&
MatrixVarReductImplicit::D_direct_ptr() const
{
  return D_direct_;
}

}	// end namespace ConstrainedOptPack 

#endif	// MATRIX_VAR_REDUCT_IMPLICIT_H