/usr/include/sc/math/scmat/mops.h is in libsc-dev 2.3.1-16build1.
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 | //
// mops.h --- block matrix operations
//
// Copyright (C) 1997 Limit Point Systems, Inc.
//
// Author: Edward Seidl <seidl@janed.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.
//
#ifndef _math_scmat_mops_h
#define _math_scmat_mops_h
#define D1 32
// copy a chunk of rectangular matrix source into dest. dest is D1xD1, and is
// padded with zeros
static inline void
copy_block(double **dest, double **source,
int istart, int ni, int jstart, int nj)
{
int ii,jj;
for (ii=0; ii < ni; ii++) {
double *di = dest[ii];
double *si = &source[istart+ii][jstart];
for (jj=0; jj < nj; jj++)
di[jj] = si[jj];
for (; jj < D1; jj++)
di[jj] = 0;
}
int left=D1-ii;
if (left)
memset(dest[ii], 0, sizeof(double)*left*D1);
}
static inline void
copy_trans_block(double **dest, double **source,
int istart, int ni, int jstart, int nj)
{
int ii,jj;
memset(dest[0], 0, sizeof(double)*D1*D1);
for (jj=0; jj < nj; jj++) {
double *sj = &source[jstart+jj][istart];
for (ii=0; ii < ni; ii++)
dest[ii][jj] = sj[ii];
}
}
// copy a chunk of symmetric matrix source into dest. dest is D1xD1, and is
// padded with zeros
static inline void
copy_sym_block(double **dest, double **source,
int istart, int ni, int jstart, int nj)
{
int ii,jj;
for (ii=0; ii < ni; ii++) {
double *di = dest[ii];
double *si = &source[istart+ii][jstart];
if (jstart < istart)
for (jj=0; jj < nj; jj++)
di[jj] = si[jj];
else if (jstart==istart)
for (jj=0; jj <= ii; jj++)
di[jj] = dest[jj][ii] = si[jj];
else
for (jj=0; jj < nj; jj++)
di[jj] = source[jstart+jj][istart+ii];
for (jj=nj; jj < D1; jj++)
di[jj] = 0;
}
int left=D1-ii;
if (left)
memset(dest[ii], 0, sizeof(double)*left*D1);
}
static inline void
return_block(double **dest, double **source,
int istart, int ni, int jstart, int nj)
{
int ii,jj;
for (ii=0; ii < ni; ii++)
for (jj=0; jj < nj; jj++)
dest[istart+ii][jstart+jj] = source[ii][jj];
}
// a, b, and c are all D1xD1 blocks
static inline void
mult_block(double **a, double **b, double **c, int ni, int nj, int nk)
{
int ii,jj,kk;
double t00,t10,t20,t30;
double *a0, *a1, *a2, *a3;
double *c0, *c1, *c2, *c3;
for (ii=0; ii < ni; ii += 4) {
a0=a[ii]; a1=a[ii+1]; a2=a[ii+2]; a3=a[ii+3];
c0=c[ii]; c1=c[ii+1]; c2=c[ii+2]; c3=c[ii+3];
for (jj=0; jj < nj; jj++) {
double *bt = b[jj];
t00=c0[jj]; t10=c1[jj]; t20=c2[jj]; t30=c3[jj];
for (kk=0; kk < nk; kk += 2) {
register double b0=bt[kk], b1=bt[kk+1];
t00 += a0[kk]*b0 + a0[kk+1]*b1;
t10 += a1[kk]*b0 + a1[kk+1]*b1;
t20 += a2[kk]*b0 + a2[kk+1]*b1;
t30 += a3[kk]*b0 + a3[kk+1]*b1;
}
c0[jj]=t00;
c1[jj]=t10;
c2[jj]=t20;
c3[jj]=t30;
}
}
}
#endif
// Local Variables:
// mode: c++
// c-file-style: "ETS"
// End:
|