/usr/include/sc/math/scmat/dim.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 | //
// dim.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_dim_h
#define _math_scmat_dim_h
#include <util/keyval/keyval.h>
#include <util/state/state.h>
namespace sc {
class RefSCDimension;
/** SCBlockInfo contains blocking information for the SCDimension class.
There are really two ways that it can contain blocking information. In
the first way, a vector of block offsets and block sizes is stored.
The second method is only used by those specializations created by the
BlockedSCMatrixKit class. In this method the blocking information is
stored as subdimensions of type SCDimension. If both methods are used,
they must be used consistently. That is, the number, sizes, and order
of the blocks must match the number, sizes, and order of the
SCDimension objects. */
class SCBlockInfo: public SavableState {
protected:
int n_;
int nblocks_;
int *start_;
int *size_;
RefSCDimension *subdims_;
void init_start();
public:
/// Create a SCBlockInfo object.
SCBlockInfo(int n, int nblocks = 0, const int *blocksizes = 0);
SCBlockInfo(StateIn&);
/** The KeyVal constructor.
<dl>
<dt><tt>sizes</tt><dd> This is a vector giving the size of each
subblock. There is no default.
<dt><tt>subdims</tt><dd> If this vector is given there is must be
entry for each entry in the sizes vector. Each entry is an
SCDimension object. The default is to not store subdimension
information.
</dl> */
SCBlockInfo(const Ref<KeyVal>& keyval);
~SCBlockInfo();
void save_data_state(StateOut&);
/// Return nonzero if this is equivalent to bi.
int equiv(SCBlockInfo *bi);
/// Return the total number of elements.
int nelem() const { return n_; }
/// Return the number of blocks.
int nblock() const { return nblocks_; }
/// Return the starting index for block i.
int start(int i) const { return start_[i]; }
/// Return the size of block i.
int size(int i) const { return size_[i]; }
/// Return the last index + 1 for block i.
int fence(int i) const { return start_[i] + size_[i]; }
void elem_to_block(int i, int &block, int &offset);
/// Retreive subdimension information.
RefSCDimension subdim(int i);
/** Set subdimension information. The dimension dim and index i must
be consistent with the nblocks and blocksizes information given to
the constructor. */
void set_subdim(int i, const RefSCDimension &dim);
/// Print the object to the stream o.
void print(std::ostream&o=ExEnv::out0()) const;
};
/** The SCDimension class is used to determine the size and blocking of
matrices. The blocking information is stored by an object of class
SCBlockInfo. */
class SCDimension: public SavableState {
protected:
char *name_;
int n_;
Ref<SCBlockInfo> blocks_;
SCDimension(const char* name = 0);
public:
/** Create a dimension with an optional name. The name is a copy of
the '0' terminated string name. */
SCDimension(int n, const char* name = 0);
SCDimension(const Ref<SCBlockInfo>&, const char *name = 0);
SCDimension(int n, int nblocks, const int *blocksizes = 0,
const char* name = 0);
/** The KeyVal constructor.
<dl>
<dt><tt>n</tt><dd> This gives size of the dimension. One of n or
blocks is required.
<dt><tt>blocks</tt><dd> The block information for the dimension can
be given as a SCBlockInfo object. One of n or blocks is required.
</dl> */
SCDimension(const Ref<KeyVal>&);
SCDimension(StateIn&s);
~SCDimension();
void save_data_state(StateOut&);
/// Test to see if two dimensions are equivalent.
int equiv(const SCDimension*) const;
/// Return the dimension.
int n() const { return n_; }
/** Return the name of the dimension. If no name was given to the
constructor, then return 0. */
const char* name() const { return name_; }
/// Return the blocking information for this dimension.
Ref<SCBlockInfo> blocks() { return blocks_; }
/// Print information about this dimension to o.
void print(std::ostream&o=ExEnv::out0()) const;
};
/** The RefSCDimension class is a smart pointer to an SCDimension
specialization. */
class RefSCDimension: public Ref<SCDimension> {
// standard overrides
public:
/** Initializes the dimension pointer to 0. The
reference must be initialized before it is used. */
RefSCDimension();
/// Make this and d refer to the same SCDimension.
RefSCDimension(const RefSCDimension& d);
/// Make this refer to d.
RefSCDimension(SCDimension *d);
~RefSCDimension();
/// Make this refer to d.
RefSCDimension& operator=(SCDimension* d);
RefSCDimension& operator<<(RefCount*);
RefSCDimension& operator<<(const RefBase &);
/// Make this and d refer to the same SCDimension.
RefSCDimension& operator=(const RefSCDimension & d);
// dimension specific functions
public:
/// Return the dimension.
operator int() const;
int n() const;
void print(std::ostream&o=ExEnv::out0()) const;
};
}
#endif
// Local Variables:
// mode: c++
// c-file-style: "CLJ"
// End:
|