/usr/include/sc/math/scmat/repl.h is in libsc-dev 2.3.1-16.
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 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | //
// repl.h
//
// Copyright (C) 1996 Limit Point Systems, Inc.
//
// Author: Curtis Janssen <cljanss@limitpt.com>
// Maintainer: LPS
//
// This file is part of the SC Toolkit.
//
// The SC Toolkit is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
//
// The SC Toolkit 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 Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public License
// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
//
// The U.S. Government is granted a limited license as per AL 91-7.
//
#ifdef __GNUC__
#pragma interface
#endif
#ifndef _math_scmat_repl_h
#define _math_scmat_repl_h
#include <util/group/message.h>
#include <math/scmat/block.h>
#include <math/scmat/matrix.h>
#include <math/scmat/abstract.h>
namespace sc {
/** The ReplSCMatrixKit produces matrices that work in a many processor
environment. A copy of the entire matrix is stored on each node.
*/
class ReplSCMatrixKit: public SCMatrixKit {
public:
ReplSCMatrixKit();
ReplSCMatrixKit(const Ref<KeyVal>&);
~ReplSCMatrixKit();
SCMatrix* matrix(const RefSCDimension&,const RefSCDimension&);
SymmSCMatrix* symmmatrix(const RefSCDimension&);
DiagSCMatrix* diagmatrix(const RefSCDimension&);
SCVector* vector(const RefSCDimension&);
};
class ReplSCMatrixListSubblockIter: public SCMatrixListSubblockIter {
protected:
Ref<MessageGrp> grp_;
double *data_;
int ndata_;
public:
ReplSCMatrixListSubblockIter(Access,
const Ref<SCMatrixBlockList> &list,
const Ref<MessageGrp> &grp,
double *data, int ndata);
~ReplSCMatrixListSubblockIter();
};
class ReplSCVector: public SCVector {
friend class ReplSCMatrix;
friend class ReplSymmSCMatrix;
friend class ReplDiagSCMatrix;
protected:
Ref<SCMatrixBlockList> blocklist;
double* vector;
void init_blocklist();
void before_elemop();
void after_elemop();
public:
ReplSCVector(const RefSCDimension&,ReplSCMatrixKit*);
~ReplSCVector();
void assign_val(double);
void assign_v(SCVector*);
void assign_p(const double*);
void set_element(int,double);
void accumulate_element(int,double);
double get_element(int) const;
void accumulate_product_sv(SymmSCMatrix*,SCVector*);
void accumulate_product_rv(SCMatrix*,SCVector*);
void accumulate(const SCVector*);
void accumulate(const SCMatrix*);
double scalar_product(SCVector*);
void element_op(const Ref<SCElementOp>&);
void element_op(const Ref<SCElementOp2>&,
SCVector*);
void element_op(const Ref<SCElementOp3>&,
SCVector*,SCVector*);
void vprint(const char* title=0,
std::ostream& out=ExEnv::out0(), int =10) const;
// return a pointer to the data for fast access
double *get_data() { return vector; }
Ref<SCMatrixSubblockIter> local_blocks(SCMatrixSubblockIter::Access);
Ref<SCMatrixSubblockIter> all_blocks(SCMatrixSubblockIter::Access);
Ref<ReplSCMatrixKit> skit();
};
class ReplSCMatrix: public SCMatrix {
friend class ReplSymmSCMatrix;
friend class ReplDiagSCMatrix;
friend class ReplSCVector;
protected:
Ref<SCMatrixBlockList> blocklist;
double* matrix;
double** rows;
protected:
// utility functions
int compute_offset(int,int) const;
void init_blocklist();
void before_elemop();
void after_elemop();
public:
ReplSCMatrix(const RefSCDimension&,const RefSCDimension&,
ReplSCMatrixKit*);
~ReplSCMatrix();
// implementations and overrides of virtual functions
void assign_val(double);
double get_element(int,int) const;
void set_element(int,int,double);
void accumulate_element(int,int,double);
SCMatrix * get_subblock(int,int,int,int);
void assign_subblock(SCMatrix*, int,int,int,int,int=0,int=0);
void accumulate_subblock(SCMatrix*, int,int,int,int,int=0,int=0);
SCVector * get_row(int i);
SCVector * get_column(int i);
void assign_row(SCVector *v, int i);
void assign_column(SCVector *v, int i);
void accumulate_row(SCVector *v, int i);
void accumulate_column(SCVector *v, int i);
void accumulate_outer_product(SCVector*,SCVector*);
void accumulate_product_rr(SCMatrix*,SCMatrix*);
void accumulate_product_rs(SCMatrix*,SymmSCMatrix*);
void accumulate_product_rd(SCMatrix*,DiagSCMatrix*);
void accumulate(const SCMatrix*);
void accumulate(const SymmSCMatrix*);
void accumulate(const DiagSCMatrix*);
void accumulate(const SCVector*);
void transpose_this();
double invert_this();
void svd_this(SCMatrix *U, DiagSCMatrix *sigma, SCMatrix *V);
double solve_this(SCVector*);
double determ_this();
double trace();
void schmidt_orthog(SymmSCMatrix*,int);
int schmidt_orthog_tol(SymmSCMatrix*, double tol, double *res=0);
void element_op(const Ref<SCElementOp>&);
void element_op(const Ref<SCElementOp2>&,
SCMatrix*);
void element_op(const Ref<SCElementOp3>&,
SCMatrix*,SCMatrix*);
void vprint(const char* title=0,
std::ostream& out=ExEnv::out0(), int =10) const;
// return a pointer to the data for fast access
double *get_data() { return matrix; }
double **get_rows() { return rows; }
Ref<SCMatrixSubblockIter> local_blocks(SCMatrixSubblockIter::Access);
Ref<SCMatrixSubblockIter> all_blocks(SCMatrixSubblockIter::Access);
Ref<ReplSCMatrixKit> skit();
};
class ReplSymmSCMatrix: public SymmSCMatrix {
friend class ReplSCMatrix;
friend class ReplDiagSCMatrix;
friend class ReplSCVector;
protected:
Ref<SCMatrixBlockList> blocklist;
double* matrix;
double** rows;
protected:
// utility functions
int compute_offset(int,int) const;
void init_blocklist();
void before_elemop();
void after_elemop();
public:
ReplSymmSCMatrix(const RefSCDimension&, ReplSCMatrixKit*);
~ReplSymmSCMatrix();
// implementations and overrides of virtual functions
void assign_val(double);
void assign_s(SymmSCMatrix*);
void assign_p(const double*);
void assign_pp(const double**);
double get_element(int,int) const;
void set_element(int,int,double);
void accumulate_element(int,int,double);
void scale(double);
SCMatrix * get_subblock(int,int,int,int);
SymmSCMatrix * get_subblock(int,int);
void assign_subblock(SCMatrix*, int,int,int,int);
void assign_subblock(SymmSCMatrix*, int,int);
void accumulate_subblock(SCMatrix*, int,int,int,int);
void accumulate_subblock(SymmSCMatrix*, int,int);
SCVector * get_row(int i);
void assign_row(SCVector *v, int i);
void accumulate_row(SCVector *v, int i);
void accumulate_product_rr(SCMatrix*,SCMatrix*);
void accumulate(const SymmSCMatrix*);
double invert_this();
double solve_this(SCVector*);
double trace();
double determ_this();
void gen_invert_this();
double scalar_product(SCVector*);
void diagonalize(DiagSCMatrix*,SCMatrix*);
void accumulate_symmetric_outer_product(SCVector*);
void accumulate_symmetric_product(SCMatrix*);
void accumulate_symmetric_sum(SCMatrix*);
void accumulate_transform(SCMatrix*,SymmSCMatrix*,
SCMatrix::Transform = SCMatrix::NormalTransform);
void accumulate_transform(SCMatrix*,DiagSCMatrix*,
SCMatrix::Transform = SCMatrix::NormalTransform);
void accumulate_transform(SymmSCMatrix*,SymmSCMatrix*);
void element_op(const Ref<SCElementOp>&);
void element_op(const Ref<SCElementOp2>&,
SymmSCMatrix*);
void element_op(const Ref<SCElementOp3>&,
SymmSCMatrix*,SymmSCMatrix*);
void vprint(const char* title=0,
std::ostream& out=ExEnv::out0(), int =10) const;
// return a pointer to the data for fast access
double *get_data() { return matrix; }
double **get_rows() { return rows; }
Ref<SCMatrixSubblockIter> local_blocks(SCMatrixSubblockIter::Access);
Ref<SCMatrixSubblockIter> all_blocks(SCMatrixSubblockIter::Access);
Ref<ReplSCMatrixKit> skit();
};
class ReplDiagSCMatrix: public DiagSCMatrix {
friend class ReplSCMatrix;
friend class ReplSymmSCMatrix;
friend class ReplSCVector;
protected:
Ref<SCMatrixBlockList> blocklist;
void init_blocklist();
double* matrix;
void before_elemop();
void after_elemop();
public:
ReplDiagSCMatrix(const RefSCDimension&, ReplSCMatrixKit*);
~ReplDiagSCMatrix();
// implementations and overrides of virtual functions
void assign_val(double);
double get_element(int) const;
void set_element(int,double);
void accumulate_element(int,double);
void accumulate(const DiagSCMatrix*);
double invert_this();
double determ_this();
double trace();
void gen_invert_this();
void element_op(const Ref<SCElementOp>&);
void element_op(const Ref<SCElementOp2>&,
DiagSCMatrix*);
void element_op(const Ref<SCElementOp3>&,
DiagSCMatrix*,DiagSCMatrix*);
void vprint(const char* title=0,
std::ostream& out=ExEnv::out0(), int =10) const;
// return a pointer to the data for fast access
double *get_data() { return matrix; }
Ref<SCMatrixSubblockIter> local_blocks(SCMatrixSubblockIter::Access);
Ref<SCMatrixSubblockIter> all_blocks(SCMatrixSubblockIter::Access);
Ref<ReplSCMatrixKit> skit();
};
}
#endif
// Local Variables:
// mode: c++
// c-file-style: "CLJ"
// End:
|