/usr/include/sdpa_linear.h is in libsdpa-dev 7.3.9+dfsg-1build2.
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 | /* -------------------------------------------------------------
This file is a component of SDPA
Copyright (C) 2004-2013 SDPA Project
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
------------------------------------------------------------- */
#ifndef __sdpa_linear_h__
#define __sdpa_linear_h__
#include "sdpa_struct.h"
namespace sdpa {
class Lal
{
public:
// calculate the minimum eigenvalue of lMat*xMat*(lMat^T)
// by Lanczos metnod
static double getMinEigen(DenseMatrix& lMat, DenseMatrix& xMat,
DenseMatrix& Q,
Vector& out, Vector& b, Vector& r,
Vector& q, Vector& qold,
Vector& w, Vector& tmp,
Vector& diagVec, Vector& diagVec2,
Vector& workVec);
// caluculate all eigenvalues of aMat by QR method
static double getMinEigenValue(DenseMatrix& aMat,
Vector& eigenVec,
Vector& workVec);
static double getOneNorm(Vector& b);
static double getOneNorm(SparseMatrix& C);
static double getOneNorm(SparseLinearSpace& C);
static double getTwoNorm(Vector& b);
static double getTwoNorm(DenseMatrix& X);
static double getTwoNorm(DenseLinearSpace& X);
static bool getInnerProduct(double& ret,
Vector& aVec, Vector& bVec);
static bool getInnerProduct(double& ret,
BlockVector& aVec,
BlockVector& bVec);
static bool getInnerProduct(double& ret,
DenseMatrix& aMat,
DenseMatrix& bMat);
static bool getInnerProduct(double& ret,
SparseMatrix& aMat,
DenseMatrix& bMat);
static bool getCholesky(DenseMatrix& retMat, DenseMatrix& aMat);
// nakata 2004/12/01
// diagonal part of Cholesky matrix is set these inverse.
static bool getCholesky(SparseMatrix& aMat, int* diagonalIndex);
static bool getInvLowTriangularMatrix(DenseMatrix& retMat,
DenseMatrix& aMat);
static bool getSymmetrize(DenseMatrix& aMat);
static bool getTranspose(DenseMatrix& retMat,
DenseMatrix& aMat);
static int rdpotf2_(char*uplo, int *n, double *a, int *lda, int *info);
static int rdpotrf_(char *uplo, int *n, double *a, int *lda, int *info);
static bool choleskyFactorWithAdjust(DenseMatrix& aMat);
static bool solveSystems(Vector& xVec,
DenseMatrix& aMat, Vector& bVec);
// solve aMat * xVec = bVec
// aMat must be Cholesky Factorized.
// nakata 2004/12/01
static bool solveSystems(Vector& xVec,
SparseMatrix& aMat, Vector& bVec);
// solve aMat * xVec = bVec
// aMat must be Cholesky Factorized.
static bool getSymmetrize(DenseLinearSpace& aMat);
static bool getTranspose(DenseLinearSpace& retMat,
DenseLinearSpace& aMat);
static bool multiply(DenseMatrix& retMat,
DenseMatrix& aMat, DenseMatrix& bMat,
double* scalar = NULL);
static bool multiply(DenseMatrix& retMat,
SparseMatrix& aMat, DenseMatrix& bMat,
double* scalar = NULL);
static bool multiply(DenseMatrix& retMat,
DenseMatrix& aMat, SparseMatrix& bMat,
double* scalar = NULL);
static bool multiply(DenseMatrix& retMat,
DenseMatrix& aMat, double* scalar = NULL);
static bool multiply(Vector& retVec,
Vector& aVec, double* scalar = NULL);
static bool multiply(BlockVector& retVec,
BlockVector& aVec,
double* scalar = NULL);
static bool multiply(Vector& retVec,
DenseMatrix& aMat, Vector& bVec,
double* scalar = NULL);
// ret = aMat**T * bMat
static bool tran_multiply(DenseMatrix& retMat,
DenseMatrix& aMat, DenseMatrix& bMat,
double* scalar = NULL);
// ret = aMat * bMat**T
static bool multiply_tran(DenseMatrix& retMat,
DenseMatrix& aMat, DenseMatrix& bMat,
double* scalar = NULL);
// ret = a + (*scalar)*b
static bool plus(Vector& retVec, Vector& aVec,
Vector& bVec, double* scalar = NULL);
static bool plus(DenseMatrix& retMat,
DenseMatrix& aMat, DenseMatrix& bMat,
double* scalar = NULL);
static bool plus(DenseMatrix& retMat,
SparseMatrix& aMat, DenseMatrix& bMat,
double* scalar = NULL);
static bool plus(DenseMatrix& retMat,
DenseMatrix& aMat, SparseMatrix& bMat,
double* scalar = NULL);
static bool plus(BlockVector& retVec,
BlockVector& aVec,
BlockVector& bVec, double* scalar = NULL);
// ret = a '*' (*scalar)
static bool let(Vector& retVec, const char eq,
Vector& aVec, const char op,
double* scalar = NULL);
// ret = a '*' (*scalar)
static bool let(BlockVector& retVec, const char eq,
BlockVector& aVec, const char op,
double* scalar = NULL);
// ret = a '*' (*scalar)
static bool let(DenseMatrix& retMat, const char eq,
DenseMatrix& aMat, const char op,
double* scalar = NULL);
// ret = a '+' '-' b*(*scalar)
static bool let(Vector& retVec, const char eq,
Vector& aVec, const char op,
Vector& bVec, double* scalar = NULL);
// ret = a '+' '-' '*' 't' 'T' b*(*scalar)
static bool let(DenseMatrix& retMat, const char eq,
DenseMatrix& aMat, const char op,
DenseMatrix& bMat, double* scalar = NULL);
// ret = a '+' '-' '*' b*(*scalar)
static bool let(DenseMatrix& retMat, const char eq,
SparseMatrix& aMat, const char op,
DenseMatrix& bMat, double* scalar = NULL);
// ret = a '+' '-' '*' b*(*scalar)
static bool let(DenseMatrix& retMat, const char eq,
DenseMatrix& aMat, const char op,
SparseMatrix& bMat, double* scalar = NULL);
// ret = aMat '*' '/' bVec
static bool let(Vector& rVec, const char eq,
DenseMatrix& aMat, const char op,
Vector& bVec);
// nakata 2004/12/01
// ret = aMat '/' bVec
static bool let(Vector& rVec, const char eq,
SparseMatrix& aMat, const char op,
Vector& bVec);
// ret = inner_product(a,b) // op = '.'
static bool let(double& ret, const char eq,
Vector& aVec, const char op,
Vector& bVec);
// ret = inner_product(a,b) // op = '.'
static bool let(double& ret, const char eq,
DenseMatrix& aMat, const char op,
DenseMatrix& bMat);
// ret = inner_product(a,b) // op = '.'
static bool let(double& ret, const char eq,
DenseMatrix& aMat, const char op,
SparseMatrix& bMat);
// ret = inner_product(a,b) // op = '.'
static bool let(double& ret, const char eq,
SparseMatrix& aMat, const char op,
DenseMatrix& bMat);
// ret = inner_product(a,b) // op = '.'
static bool let(double& ret, const char eq,
BlockVector& aVec, const char op,
BlockVector& bVec);
/////////////////////////////////////////////////////////////////////
static bool getInnerProduct(double& ret,
DenseLinearSpace& aMat,
DenseLinearSpace& bMat);
static bool getInnerProduct(double& ret,
SparseLinearSpace& aMat,
DenseLinearSpace& bMat);
// ret = a (*scalar)*b
static bool multiply(DenseLinearSpace& retMat,
DenseLinearSpace& aMat,
double* scalar = NULL);
// ret = a + (*scalar)*b
static bool plus(DenseLinearSpace& retMat,
DenseLinearSpace& aMat,
DenseLinearSpace& bMat,
double* scalar = NULL);
// CAUTION!!! We don't initialize retMat to zero matrix for efficiently.
static bool plus(DenseLinearSpace& retMat,
SparseLinearSpace& aMat,
DenseLinearSpace& bMat,
double* scalar = NULL);
// CAUTION!!! We don't initialize retMat to zero matrix for efficiently.
static bool plus(DenseLinearSpace& retMat,
DenseLinearSpace& aMat,
SparseLinearSpace& bMat,
double* scalar = NULL);
// ret = a '*' (*scalar)
static bool let(DenseLinearSpace& retMat, const char eq,
DenseLinearSpace& aMat, const char op,
double* scalar = NULL);
// ret = a '+' '-' b*(*scalar)
static bool let(DenseLinearSpace& retMat, const char eq,
DenseLinearSpace& aMat, const char op,
DenseLinearSpace& bMat, double* scalar = NULL);
// ret = a '+' '-' b*(*scalar)
static bool let(DenseLinearSpace& retMat, const char eq,
SparseLinearSpace& aMat, const char op,
DenseLinearSpace& bMat, double* scalar = NULL);
// ret = a '+' '-' '*' b*(*scalar)
static bool let(DenseLinearSpace& retMat, const char eq,
DenseLinearSpace& aMat, const char op,
SparseLinearSpace& bMat, double* scalar = NULL);
// ret = inner_product(a,b) // op = '.'
static bool let(double& ret, const char eq,
DenseLinearSpace& aMat, const char op,
DenseLinearSpace& bMat);
// ret = inner_product(a,b) // op = '.'
static bool let(double& ret, const char eq,
SparseLinearSpace& aMat, const char op,
DenseLinearSpace& bMat);
// ret = inner_product(a,b) // op = '.'
static bool let(double& ret, const char eq,
DenseLinearSpace& aMat, const char op,
SparseLinearSpace& bMat);
};
} // end of namespace 'sdpa'
#endif // __sdpa_linear_h__
|