/usr/include/trilinos/AbstractLinAlgPack_COOMatrixWithPartitionedView.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 | // @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 COO_MATRIX_WITH_PARTITIONED_VIEW_H
#define COO_MATRIX_WITH_PARTITIONED_VIEW_H
#include "AbstractLinAlgPack_COOMatrixClass.hpp"
#include "AbstractLinAlgPack_COOMatrixPartitionedViewClass.hpp"
namespace AbstractLinAlgPack {
/** \brief Aggregation of a COO matrix and a partitioned view of it.
*
* This class represents the aggregation of a COOMatrix and a COOMatrixParitionedView.
* This class is designed to help avoid mistakes that may happen when the underlying
* COO matrix is modified and the partitioned view becomes obsolete. Therefore, operations
* that may make the partitioned view obsolete are encapsulated to delete the partitioned view.
*
* Therefore, non-const references to the underlying COOMatrix and COOMatrixPartitioned view
* are not provided. Analogs for the non-const member functions
* are provided and keep track of the book keeping for you. This is a very light weight class
* in terms of overhead. The only exception to this are the rows() and cols() member functions.
* They are included to allow for use with the MatrixWithOpConcreteEncap<M> class.
*
* The const interfaces to these objects can be accessed using the coom() and coom_view()
* member functions.
*/
class COOMatrixWithPartitionedView {
public:
// /////////////////////////////////////////////////////////////
/** @name Public Types */
//@{
/** \brief . */
typedef COOMatrixPartitionedView<indice_type,value_type> partitioned_view_type;
/** \brief . */
typedef partitioned_view_type::partition_type partition_type;
/** \brief . */
typedef partitioned_view_type::EPartitionOrder EPartitionOrder;
//@}
/// Calls coom_view().rows() if the partitioned view has been initialize and coom().rows() if not
size_type rows() const {
return coom_view_.is_initialized() ? coom_view_.rows() : coom_.rows();
}
/// Calls coom_view().cols() if the partitioned view has been initialize and coom().cols() if not
size_type cols() const {
return coom_view_.is_initialized() ? coom_view_.cols() : coom_.cols();
}
/// Assignment operator
COOMatrixWithPartitionedView& operator=(const COOMatrixWithPartitionedView& m) {
coom_ = m.coom_;
coom_view_.bind(coom_view_);
return *this;
}
/** \brief Allow assignment to a COOMatrix.
*
* After the assignment #this# will not have its partitioned view initialized.
*/
COOMatrixWithPartitionedView& operator=(const COOMatrix& m) {
coom_ = m;
coom_view_.free();
return *this;
}
// /////////////////////////////////////////////////////////////
/** @name COOMatrix non-const encapsulated interface.
*
* The default constructor and copy constructor are allowed.
*/
//@{
/** \brief Resize for a #rows# by #cols# sparse matrix with #nz# elements.
*
* If there was a partitioned view set up then this will destory it.
*/
void resize(size_type rows, size_type cols, size_type nz) {
coom_view_.free();
coom_.resize(rows,cols,nz);
}
/** \brief Return pointer to raw storage array (length #nz()#) for the values of the non-zero elements.
*
* This operation will not result in a loss of the partitioned view.
*/
value_type* val() {
return coom_.val();
}
/** \brief Return pointer to raw storage array (length #nz()#) for the row indices of the non-zero elements
*
* This operation will result in a loss of the partitioned view.
*/
indice_type* ivect() {
coom_view_.free();
return coom_.ivect();
}
/** \brief Return pointer to raw storage array (length #nz()#) for the column indices of the non-zero elements
*
* This operation will result in a loss of the partitioned view.
*/
indice_type* jvect() {
coom_view_.free();
return coom_.jvect();
}
/** \brief Initialize from an input stream.
*
* This operation will result in a loss of the partitioned view.
*/
void initialize(std::istream& istrm) {
coom_view_.free();
coom_.initialize(istrm);
}
//@}
/// Return a const referece to the COOMatrix
const COOMatrix& coom() const {
return coom_;
}
// ////////////////////////////////////////////////////////////////
/** @name Non-const COOMatrixPartitionedView interface */
//@{
/** \brief Crete a view to the COO matrix.
*
* Calls create_view on the partitioned view object using the data
* from the COOMatrix object.
*/
void create_view(
const size_type row_perm[]
, const size_type col_perm[]
, const size_type num_row_part
, const size_type row_part[]
, const size_type num_col_part
, const size_type col_part[]
, const EPartitionOrder partition_order )
{
coom_view_.create_view(coom_.rows(),coom_.cols(),coom_.nz(),coom_.val(),coom_.const_ivect()
,coom_.const_jvect(),row_perm,col_perm,num_row_part,row_part,num_col_part,col_part
,partition_order);
}
/** \brief . */
partition_type partition(size_type overall_p) {
return coom_view_.partition(overall_p);
}
/** \brief . */
partition_type partition(size_type row_p, size_type col_p) {
return coom_view_.partition(row_p, col_p);
}
/** \brief . */
partition_type partition(Range1D rng_overall_p) {
return coom_view_.partition(rng_overall_p);
}
//@}
/// Return a const referece to the COOMatrixPartitionedView object
const partitioned_view_type& coom_view() const {
return coom_view_;
}
private:
COOMatrix coom_;
partitioned_view_type coom_view_;
}; // end class COOMatrixWithPartitionedView
} // end namespace AbstractLinAlgPack
#endif // COO_MATRIX_WITH_PARTITIONED_VIEW_H
|