/usr/include/evd.h is in libalglib-dev 2.6.0-3.
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 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | /*************************************************************************
Copyright (c) 2005-2007, Sergey Bochkanov (ALGLIB project).
>>> SOURCE LICENSE >>>
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 (www.fsf.org); 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.
A copy of the GNU General Public License is available at
http://www.fsf.org/licensing/licenses
>>> END OF LICENSE >>>
*************************************************************************/
#ifndef _evd_h
#define _evd_h
#include "ap.h"
#include "ialglib.h"
#include "hblas.h"
#include "reflections.h"
#include "creflections.h"
#include "sblas.h"
#include "ablasf.h"
#include "ablas.h"
#include "ortfac.h"
#include "blas.h"
#include "rotations.h"
#include "hsschur.h"
/*************************************************************************
Finding the eigenvalues and eigenvectors of a symmetric matrix
The algorithm finds eigen pairs of a symmetric matrix by reducing it to
tridiagonal form and using the QL/QR algorithm.
Input parameters:
A - symmetric matrix which is given by its upper or lower
triangular part.
Array whose indexes range within [0..N-1, 0..N-1].
N - size of matrix A.
IsUpper - storage format.
ZNeeded - flag controlling whether the eigenvectors are needed or not.
If ZNeeded is equal to:
* 0, the eigenvectors are not returned;
* 1, the eigenvectors are returned.
Output parameters:
D - eigenvalues in ascending order.
Array whose index ranges within [0..N-1].
Z - if ZNeeded is equal to:
* 0, Z hasn�t changed;
* 1, Z contains the eigenvectors.
Array whose indexes range within [0..N-1, 0..N-1].
The eigenvectors are stored in the matrix columns.
Result:
True, if the algorithm has converged.
False, if the algorithm hasn't converged (rare case).
-- ALGLIB --
Copyright 2005-2008 by Bochkanov Sergey
*************************************************************************/
bool smatrixevd(ap::real_2d_array a,
int n,
int zneeded,
bool isupper,
ap::real_1d_array& d,
ap::real_2d_array& z);
/*************************************************************************
Subroutine for finding the eigenvalues (and eigenvectors) of a symmetric
matrix in a given half open interval (A, B] by using a bisection and
inverse iteration
Input parameters:
A - symmetric matrix which is given by its upper or lower
triangular part. Array [0..N-1, 0..N-1].
N - size of matrix A.
ZNeeded - flag controlling whether the eigenvectors are needed or not.
If ZNeeded is equal to:
* 0, the eigenvectors are not returned;
* 1, the eigenvectors are returned.
IsUpperA - storage format of matrix A.
B1, B2 - half open interval (B1, B2] to search eigenvalues in.
Output parameters:
M - number of eigenvalues found in a given half-interval (M>=0).
W - array of the eigenvalues found.
Array whose index ranges within [0..M-1].
Z - if ZNeeded is equal to:
* 0, Z hasn�t changed;
* 1, Z contains eigenvectors.
Array whose indexes range within [0..N-1, 0..M-1].
The eigenvectors are stored in the matrix columns.
Result:
True, if successful. M contains the number of eigenvalues in the given
half-interval (could be equal to 0), W contains the eigenvalues,
Z contains the eigenvectors (if needed).
False, if the bisection method subroutine wasn't able to find the
eigenvalues in the given interval or if the inverse iteration subroutine
wasn't able to find all the corresponding eigenvectors.
In that case, the eigenvalues and eigenvectors are not returned,
M is equal to 0.
-- ALGLIB --
Copyright 07.01.2006 by Bochkanov Sergey
*************************************************************************/
bool smatrixevdr(ap::real_2d_array a,
int n,
int zneeded,
bool isupper,
double b1,
double b2,
int& m,
ap::real_1d_array& w,
ap::real_2d_array& z);
/*************************************************************************
Subroutine for finding the eigenvalues and eigenvectors of a symmetric
matrix with given indexes by using bisection and inverse iteration methods.
Input parameters:
A - symmetric matrix which is given by its upper or lower
triangular part. Array whose indexes range within [0..N-1, 0..N-1].
N - size of matrix A.
ZNeeded - flag controlling whether the eigenvectors are needed or not.
If ZNeeded is equal to:
* 0, the eigenvectors are not returned;
* 1, the eigenvectors are returned.
IsUpperA - storage format of matrix A.
I1, I2 - index interval for searching (from I1 to I2).
0 <= I1 <= I2 <= N-1.
Output parameters:
W - array of the eigenvalues found.
Array whose index ranges within [0..I2-I1].
Z - if ZNeeded is equal to:
* 0, Z hasn�t changed;
* 1, Z contains eigenvectors.
Array whose indexes range within [0..N-1, 0..I2-I1].
In that case, the eigenvectors are stored in the matrix columns.
Result:
True, if successful. W contains the eigenvalues, Z contains the
eigenvectors (if needed).
False, if the bisection method subroutine wasn't able to find the
eigenvalues in the given interval or if the inverse iteration subroutine
wasn't able to find all the corresponding eigenvectors.
In that case, the eigenvalues and eigenvectors are not returned.
-- ALGLIB --
Copyright 07.01.2006 by Bochkanov Sergey
*************************************************************************/
bool smatrixevdi(ap::real_2d_array a,
int n,
int zneeded,
bool isupper,
int i1,
int i2,
ap::real_1d_array& w,
ap::real_2d_array& z);
/*************************************************************************
Finding the eigenvalues and eigenvectors of a Hermitian matrix
The algorithm finds eigen pairs of a Hermitian matrix by reducing it to
real tridiagonal form and using the QL/QR algorithm.
Input parameters:
A - Hermitian matrix which is given by its upper or lower
triangular part.
Array whose indexes range within [0..N-1, 0..N-1].
N - size of matrix A.
IsUpper - storage format.
ZNeeded - flag controlling whether the eigenvectors are needed or
not. If ZNeeded is equal to:
* 0, the eigenvectors are not returned;
* 1, the eigenvectors are returned.
Output parameters:
D - eigenvalues in ascending order.
Array whose index ranges within [0..N-1].
Z - if ZNeeded is equal to:
* 0, Z hasn�t changed;
* 1, Z contains the eigenvectors.
Array whose indexes range within [0..N-1, 0..N-1].
The eigenvectors are stored in the matrix columns.
Result:
True, if the algorithm has converged.
False, if the algorithm hasn't converged (rare case).
Note:
eigenvectors of Hermitian matrix are defined up to multiplication by
a complex number L, such that |L|=1.
-- ALGLIB --
Copyright 2005, 23 March 2007 by Bochkanov Sergey
*************************************************************************/
bool hmatrixevd(ap::complex_2d_array a,
int n,
int zneeded,
bool isupper,
ap::real_1d_array& d,
ap::complex_2d_array& z);
/*************************************************************************
Subroutine for finding the eigenvalues (and eigenvectors) of a Hermitian
matrix in a given half-interval (A, B] by using a bisection and inverse
iteration
Input parameters:
A - Hermitian matrix which is given by its upper or lower
triangular part. Array whose indexes range within
[0..N-1, 0..N-1].
N - size of matrix A.
ZNeeded - flag controlling whether the eigenvectors are needed or
not. If ZNeeded is equal to:
* 0, the eigenvectors are not returned;
* 1, the eigenvectors are returned.
IsUpperA - storage format of matrix A.
B1, B2 - half-interval (B1, B2] to search eigenvalues in.
Output parameters:
M - number of eigenvalues found in a given half-interval, M>=0
W - array of the eigenvalues found.
Array whose index ranges within [0..M-1].
Z - if ZNeeded is equal to:
* 0, Z hasn�t changed;
* 1, Z contains eigenvectors.
Array whose indexes range within [0..N-1, 0..M-1].
The eigenvectors are stored in the matrix columns.
Result:
True, if successful. M contains the number of eigenvalues in the given
half-interval (could be equal to 0), W contains the eigenvalues,
Z contains the eigenvectors (if needed).
False, if the bisection method subroutine wasn't able to find the
eigenvalues in the given interval or if the inverse iteration
subroutine wasn't able to find all the corresponding eigenvectors.
In that case, the eigenvalues and eigenvectors are not returned, M is
equal to 0.
Note:
eigen vectors of Hermitian matrix are defined up to multiplication by
a complex number L, such as |L|=1.
-- ALGLIB --
Copyright 07.01.2006, 24.03.2007 by Bochkanov Sergey.
*************************************************************************/
bool hmatrixevdr(ap::complex_2d_array a,
int n,
int zneeded,
bool isupper,
double b1,
double b2,
int& m,
ap::real_1d_array& w,
ap::complex_2d_array& z);
/*************************************************************************
Subroutine for finding the eigenvalues and eigenvectors of a Hermitian
matrix with given indexes by using bisection and inverse iteration methods
Input parameters:
A - Hermitian matrix which is given by its upper or lower
triangular part.
Array whose indexes range within [0..N-1, 0..N-1].
N - size of matrix A.
ZNeeded - flag controlling whether the eigenvectors are needed or
not. If ZNeeded is equal to:
* 0, the eigenvectors are not returned;
* 1, the eigenvectors are returned.
IsUpperA - storage format of matrix A.
I1, I2 - index interval for searching (from I1 to I2).
0 <= I1 <= I2 <= N-1.
Output parameters:
W - array of the eigenvalues found.
Array whose index ranges within [0..I2-I1].
Z - if ZNeeded is equal to:
* 0, Z hasn�t changed;
* 1, Z contains eigenvectors.
Array whose indexes range within [0..N-1, 0..I2-I1].
In that case, the eigenvectors are stored in the matrix
columns.
Result:
True, if successful. W contains the eigenvalues, Z contains the
eigenvectors (if needed).
False, if the bisection method subroutine wasn't able to find the
eigenvalues in the given interval or if the inverse iteration
subroutine wasn't able to find all the corresponding eigenvectors.
In that case, the eigenvalues and eigenvectors are not returned.
Note:
eigen vectors of Hermitian matrix are defined up to multiplication by
a complex number L, such as |L|=1.
-- ALGLIB --
Copyright 07.01.2006, 24.03.2007 by Bochkanov Sergey.
*************************************************************************/
bool hmatrixevdi(ap::complex_2d_array a,
int n,
int zneeded,
bool isupper,
int i1,
int i2,
ap::real_1d_array& w,
ap::complex_2d_array& z);
/*************************************************************************
Finding the eigenvalues and eigenvectors of a tridiagonal symmetric matrix
The algorithm finds the eigen pairs of a tridiagonal symmetric matrix by
using an QL/QR algorithm with implicit shifts.
Input parameters:
D - the main diagonal of a tridiagonal matrix.
Array whose index ranges within [0..N-1].
E - the secondary diagonal of a tridiagonal matrix.
Array whose index ranges within [0..N-2].
N - size of matrix A.
ZNeeded - flag controlling whether the eigenvectors are needed or not.
If ZNeeded is equal to:
* 0, the eigenvectors are not needed;
* 1, the eigenvectors of a tridiagonal matrix
are multiplied by the square matrix Z. It is used if the
tridiagonal matrix is obtained by the similarity
transformation of a symmetric matrix;
* 2, the eigenvectors of a tridiagonal matrix replace the
square matrix Z;
* 3, matrix Z contains the first row of the eigenvectors
matrix.
Z - if ZNeeded=1, Z contains the square matrix by which the
eigenvectors are multiplied.
Array whose indexes range within [0..N-1, 0..N-1].
Output parameters:
D - eigenvalues in ascending order.
Array whose index ranges within [0..N-1].
Z - if ZNeeded is equal to:
* 0, Z hasn�t changed;
* 1, Z contains the product of a given matrix (from the left)
and the eigenvectors matrix (from the right);
* 2, Z contains the eigenvectors.
* 3, Z contains the first row of the eigenvectors matrix.
If ZNeeded<3, Z is the array whose indexes range within [0..N-1, 0..N-1].
In that case, the eigenvectors are stored in the matrix columns.
If ZNeeded=3, Z is the array whose indexes range within [0..0, 0..N-1].
Result:
True, if the algorithm has converged.
False, if the algorithm hasn't converged.
-- LAPACK routine (version 3.0) --
Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
Courant Institute, Argonne National Lab, and Rice University
September 30, 1994
*************************************************************************/
bool smatrixtdevd(ap::real_1d_array& d,
ap::real_1d_array e,
int n,
int zneeded,
ap::real_2d_array& z);
/*************************************************************************
Subroutine for finding the tridiagonal matrix eigenvalues/vectors in a
given half-interval (A, B] by using bisection and inverse iteration.
Input parameters:
D - the main diagonal of a tridiagonal matrix.
Array whose index ranges within [0..N-1].
E - the secondary diagonal of a tridiagonal matrix.
Array whose index ranges within [0..N-2].
N - size of matrix, N>=0.
ZNeeded - flag controlling whether the eigenvectors are needed or not.
If ZNeeded is equal to:
* 0, the eigenvectors are not needed;
* 1, the eigenvectors of a tridiagonal matrix are multiplied
by the square matrix Z. It is used if the tridiagonal
matrix is obtained by the similarity transformation
of a symmetric matrix.
* 2, the eigenvectors of a tridiagonal matrix replace matrix Z.
A, B - half-interval (A, B] to search eigenvalues in.
Z - if ZNeeded is equal to:
* 0, Z isn't used and remains unchanged;
* 1, Z contains the square matrix (array whose indexes range
within [0..N-1, 0..N-1]) which reduces the given symmetric
matrix to tridiagonal form;
* 2, Z isn't used (but changed on the exit).
Output parameters:
D - array of the eigenvalues found.
Array whose index ranges within [0..M-1].
M - number of eigenvalues found in the given half-interval (M>=0).
Z - if ZNeeded is equal to:
* 0, doesn't contain any information;
* 1, contains the product of a given NxN matrix Z (from the
left) and NxM matrix of the eigenvectors found (from the
right). Array whose indexes range within [0..N-1, 0..M-1].
* 2, contains the matrix of the eigenvectors found.
Array whose indexes range within [0..N-1, 0..M-1].
Result:
True, if successful. In that case, M contains the number of eigenvalues
in the given half-interval (could be equal to 0), D contains the eigenvalues,
Z contains the eigenvectors (if needed).
It should be noted that the subroutine changes the size of arrays D and Z.
False, if the bisection method subroutine wasn't able to find the
eigenvalues in the given interval or if the inverse iteration subroutine
wasn't able to find all the corresponding eigenvectors. In that case,
the eigenvalues and eigenvectors are not returned, M is equal to 0.
-- ALGLIB --
Copyright 31.03.2008 by Bochkanov Sergey
*************************************************************************/
bool smatrixtdevdr(ap::real_1d_array& d,
const ap::real_1d_array& e,
int n,
int zneeded,
double a,
double b,
int& m,
ap::real_2d_array& z);
/*************************************************************************
Subroutine for finding tridiagonal matrix eigenvalues/vectors with given
indexes (in ascending order) by using the bisection and inverse iteraion.
Input parameters:
D - the main diagonal of a tridiagonal matrix.
Array whose index ranges within [0..N-1].
E - the secondary diagonal of a tridiagonal matrix.
Array whose index ranges within [0..N-2].
N - size of matrix. N>=0.
ZNeeded - flag controlling whether the eigenvectors are needed or not.
If ZNeeded is equal to:
* 0, the eigenvectors are not needed;
* 1, the eigenvectors of a tridiagonal matrix are multiplied
by the square matrix Z. It is used if the
tridiagonal matrix is obtained by the similarity transformation
of a symmetric matrix.
* 2, the eigenvectors of a tridiagonal matrix replace
matrix Z.
I1, I2 - index interval for searching (from I1 to I2).
0 <= I1 <= I2 <= N-1.
Z - if ZNeeded is equal to:
* 0, Z isn't used and remains unchanged;
* 1, Z contains the square matrix (array whose indexes range within [0..N-1, 0..N-1])
which reduces the given symmetric matrix to tridiagonal form;
* 2, Z isn't used (but changed on the exit).
Output parameters:
D - array of the eigenvalues found.
Array whose index ranges within [0..I2-I1].
Z - if ZNeeded is equal to:
* 0, doesn't contain any information;
* 1, contains the product of a given NxN matrix Z (from the left) and
Nx(I2-I1) matrix of the eigenvectors found (from the right).
Array whose indexes range within [0..N-1, 0..I2-I1].
* 2, contains the matrix of the eigenvalues found.
Array whose indexes range within [0..N-1, 0..I2-I1].
Result:
True, if successful. In that case, D contains the eigenvalues,
Z contains the eigenvectors (if needed).
It should be noted that the subroutine changes the size of arrays D and Z.
False, if the bisection method subroutine wasn't able to find the eigenvalues
in the given interval or if the inverse iteration subroutine wasn't able
to find all the corresponding eigenvectors. In that case, the eigenvalues
and eigenvectors are not returned.
-- ALGLIB --
Copyright 25.12.2005 by Bochkanov Sergey
*************************************************************************/
bool smatrixtdevdi(ap::real_1d_array& d,
const ap::real_1d_array& e,
int n,
int zneeded,
int i1,
int i2,
ap::real_2d_array& z);
/*************************************************************************
Finding eigenvalues and eigenvectors of a general matrix
The algorithm finds eigenvalues and eigenvectors of a general matrix by
using the QR algorithm with multiple shifts. The algorithm can find
eigenvalues and both left and right eigenvectors.
The right eigenvector is a vector x such that A*x = w*x, and the left
eigenvector is a vector y such that y'*A = w*y' (here y' implies a complex
conjugate transposition of vector y).
Input parameters:
A - matrix. Array whose indexes range within [0..N-1, 0..N-1].
N - size of matrix A.
VNeeded - flag controlling whether eigenvectors are needed or not.
If VNeeded is equal to:
* 0, eigenvectors are not returned;
* 1, right eigenvectors are returned;
* 2, left eigenvectors are returned;
* 3, both left and right eigenvectors are returned.
Output parameters:
WR - real parts of eigenvalues.
Array whose index ranges within [0..N-1].
WR - imaginary parts of eigenvalues.
Array whose index ranges within [0..N-1].
VL, VR - arrays of left and right eigenvectors (if they are needed).
If WI[i]=0, the respective eigenvalue is a real number,
and it corresponds to the column number I of matrices VL/VR.
If WI[i]>0, we have a pair of complex conjugate numbers with
positive and negative imaginary parts:
the first eigenvalue WR[i] + sqrt(-1)*WI[i];
the second eigenvalue WR[i+1] + sqrt(-1)*WI[i+1];
WI[i]>0
WI[i+1] = -WI[i] < 0
In that case, the eigenvector corresponding to the first
eigenvalue is located in i and i+1 columns of matrices
VL/VR (the column number i contains the real part, and the
column number i+1 contains the imaginary part), and the vector
corresponding to the second eigenvalue is a complex conjugate to
the first vector.
Arrays whose indexes range within [0..N-1, 0..N-1].
Result:
True, if the algorithm has converged.
False, if the algorithm has not converged.
Note 1:
Some users may ask the following question: what if WI[N-1]>0?
WI[N] must contain an eigenvalue which is complex conjugate to the
N-th eigenvalue, but the array has only size N?
The answer is as follows: such a situation cannot occur because the
algorithm finds a pairs of eigenvalues, therefore, if WI[i]>0, I is
strictly less than N-1.
Note 2:
The algorithm performance depends on the value of the internal parameter
NS of the InternalSchurDecomposition subroutine which defines the number
of shifts in the QR algorithm (similarly to the block width in block-matrix
algorithms of linear algebra). If you require maximum performance
on your machine, it is recommended to adjust this parameter manually.
See also the InternalTREVC subroutine.
The algorithm is based on the LAPACK 3.0 library.
*************************************************************************/
bool rmatrixevd(ap::real_2d_array a,
int n,
int vneeded,
ap::real_1d_array& wr,
ap::real_1d_array& wi,
ap::real_2d_array& vl,
ap::real_2d_array& vr);
bool internalbisectioneigenvalues(ap::real_1d_array d,
ap::real_1d_array e,
int n,
int irange,
int iorder,
double vl,
double vu,
int il,
int iu,
double abstol,
ap::real_1d_array& w,
int& m,
int& nsplit,
ap::integer_1d_array& iblock,
ap::integer_1d_array& isplit,
int& errorcode);
void internaldstein(const int& n,
const ap::real_1d_array& d,
ap::real_1d_array e,
const int& m,
ap::real_1d_array w,
const ap::integer_1d_array& iblock,
const ap::integer_1d_array& isplit,
ap::real_2d_array& z,
ap::integer_1d_array& ifail,
int& info);
#endif
|