#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <f2c.h>
#include <clapack.h>
#include <gsl/gsl_cblas.h>
#include <cuda_runtime.h>
Go to the source code of this file.
Classes | |
struct | interval_cpu_info_struct |
struct | exec_window_entry_struct |
struct | extract_device_info_struct |
struct | extract_global_info_struct |
Defines | |
#define | SINGLE |
#define | blockSize 256 |
#define | align(x) (((x) + 255) & ~255) |
#define | half_warp 16 |
#define | half_warp_mask 0x0F |
#define | print_vector_gpu(name, v, n) |
#define | T float |
#define | Tsf "%f" |
#define | _nrm2 cblas_snrm2 |
#define | _scal cblas_sscal |
#define | _axpy cblas_saxpy |
#define | _gemv cblas_sgemv |
#define | _gemm cblas_sgemm |
#define | _spmv cblas_sspmv |
#define | _dot cblas_sdot |
#define | _spsv sspsv_ |
#define | _stev sstev_ |
#define | TRUE 1 |
#define | FALSE 0 |
#define | INTERVAL_NONE -1 |
Typedefs | |
typedef struct interval_cpu_info_struct | interval_cpu_info |
typedef struct exec_window_entry_struct | exec_window_entry |
typedef struct extract_device_info_struct | extract_device_info |
typedef struct extract_global_info_struct | extract_global_info |
Functions | |
struct | __align__ (16 *sizeof(T)) tridiagonal_entry_struct |
struct | __align__ (16 *sizeof(float)) interval_gpu_info_struct |
int | readInput (int *n, T **t, FILE *file) |
void | print_vector (const char *name, T *v, int n) |
void | print_matrix (const char *name, T *m, int cols, int rows, int lda) |
void | toeplitz_gershgorin (const T *t, unsigned int n, T *low, T *up) |
void | toeplitz_mult (int n, const T *t, const T *x, T *y) |
void | levinson (unsigned int n, T td, const T *t0, const T *b0, T *x) |
void | sort_eigenvalues (unsigned int extracted, unsigned int n, T *el, T *ev) |
interval_cpu_info * | calc_eigen_intervals (T *t, unsigned int n, T lbg, T ubg, unsigned int max_eig_interval, unsigned int *num_intervals) |
unsigned int | extract_eigenvalues (unsigned int n, unsigned int k, unsigned int max_k, unsigned int p_lda, unsigned int *converged, unsigned int *extracted, unsigned int required, T a, T b, const T *t, const T *p, const T *alpha, const T *beta, T tolerance, T *l, T *v) |
Variables | |
tridiagonal_entry | |
interval_gpu_info |
Definition in file toeplitz.h.
#define _axpy cblas_saxpy |
Definition at line 71 of file toeplitz.h.
#define _dot cblas_sdot |
Definition at line 75 of file toeplitz.h.
#define _gemm cblas_sgemm |
Definition at line 73 of file toeplitz.h.
#define _gemv cblas_sgemv |
Definition at line 72 of file toeplitz.h.
#define _nrm2 cblas_snrm2 |
Definition at line 69 of file toeplitz.h.
#define _scal cblas_sscal |
Definition at line 70 of file toeplitz.h.
#define _spmv cblas_sspmv |
Definition at line 74 of file toeplitz.h.
#define _spsv sspsv_ |
Definition at line 76 of file toeplitz.h.
#define _stev sstev_ |
Definition at line 77 of file toeplitz.h.
#define align | ( | x | ) | (((x) + 255) & ~255) |
Definition at line 55 of file toeplitz.h.
#define blockSize 256 |
Definition at line 54 of file toeplitz.h.
#define FALSE 0 |
Definition at line 98 of file toeplitz.h.
#define half_warp 16 |
Definition at line 57 of file toeplitz.h.
#define half_warp_mask 0x0F |
Definition at line 58 of file toeplitz.h.
#define INTERVAL_NONE -1 |
Definition at line 102 of file toeplitz.h.
#define print_vector_gpu | ( | name, | |||
v, | |||||
n | ) |
Value:
{ if(tid == 0) { \ fprintf(stderr, "%s: [", name); \ for(int _i=0; _i<n; ++_i) fprintf(stderr, " %.6f", v[_i]); \ fprintf(stderr, " ]\n"); } }
Definition at line 60 of file toeplitz.h.
#define SINGLE |
Definition at line 45 of file toeplitz.h.
#define T float |
Definition at line 67 of file toeplitz.h.
#define TRUE 1 |
Definition at line 94 of file toeplitz.h.
#define Tsf "%f" |
Definition at line 68 of file toeplitz.h.
typedef struct exec_window_entry_struct exec_window_entry |
typedef struct extract_device_info_struct extract_device_info |
typedef struct extract_global_info_struct extract_global_info |
typedef struct interval_cpu_info_struct interval_cpu_info |
struct __align__ | ( | 16 * | sizeoffloat | ) | [read] |
< Iteration in which interval extraction was launched.
< Flag indicating if interval has been already processed.
< Shift value used in the interval.
< Matrices of size n_align x max_k. Contains base vectors for symmetric and skew-symmetric Krylov subspaces.
< Vector of size max(5 * align(n), 4 * align(n) + max_k).
< Struct vector of size max_k.
Definition at line 140 of file toeplitz.h.
struct __align__ | ( | 16 * | sizeofT | ) | [read] |
Definition at line 108 of file toeplitz.h.
interval_cpu_info* calc_eigen_intervals | ( | T * | t, | |
unsigned int | n, | |||
T | lbg, | |||
T | ubg, | |||
unsigned int | max_eig_interval, | |||
unsigned int * | num_intervals | |||
) |
Calculates intervals containing approximately the same number of eigenvalues along a given interval. Only interval-specific information is written in the array. All other data is initialized to 0.
t | Vector defining a symmetric Toeplitz matrix whose eigenvalue intervals will be calculated. | |
n | Size of vector t. | |
lbg | Lower bound of the initial interval to be subdivided (usually Gershgorin disc). | |
ubg | Upper bound of the initial interval to be subdivided (usually Gershgorin disc). | |
max_eig_interval | Maximum number of eigenvalues per interval. | |
num_intervals | Number of extracted intervals. |
NULL
in case of error. unsigned int extract_eigenvalues | ( | unsigned int | n, | |
unsigned int | k, | |||
unsigned int | max_k, | |||
unsigned int | p_lda, | |||
unsigned int * | converged, | |||
unsigned int * | extracted, | |||
unsigned int | required, | |||
T | a, | |||
T | b, | |||
const T * | t, | |||
const T * | p, | |||
const T * | alpha, | |||
const T * | beta, | |||
T | tolerance, | |||
T * | l, | |||
T * | v | |||
) |
Check convergence and extract eigenvalues of a symmetric Toeplitz matrix given a tridiagonal shift-and-invert Lanczos approximation.
n | Size of the Toeplitz matrix defined by t and number of rows of p. | |
k | Current size of Krylov subspace and number of columns of p. | |
max_k | Maximum allowed size of the Krylov subspace. | |
p_lda | Leading dimension of Krylov subspace vectors stored in p. | |
converged | Pointer to number of converged eigenvalues. Just initialize to 0 on start and let the function use it. | |
extracted | Pointer to number of currently extracted eigenvalues. | |
required | Number of eigenvalues that should be extracted. | |
a | Start of the interval whose eigenvalues are being extracted. | |
b | End of the interval whose eigenvalues are being extracted. | |
t | Vector of size n defining the symmetric Toeplitz matrix. | |
p | Matrix of size n x k containing Lanczos vectors. | |
alpha | Vector of size k containing the main diagonal of the symmetric tridiagonal matrix. | |
beta | Vector of size k-1 containing the second diagonal of the symmetric tridiagonal matrix. | |
tolerance | Tolerance threshold used to check eigenvalue convergence. | |
l | Output vector where up to required eigenvalues will be stored. | |
v | Output matrix where up to required eigenvectors will be stored (column order). |
void levinson | ( | unsigned int | n, | |
T | td, | |||
const T * | t0, | |||
const T * | b0, | |||
T * | x | |||
) |
Solve system toeplitz(r0) * x = b0 where r0 defines a symmetric positive-definite Toeplitz matrix.
n | Size of r0, b0 and x vectors. | |
td | Main diagonal element of the symmetric Toeplitz matrix. | |
t0 | Rest of the symmetric Toeplitz matrix data in vector form. | |
b0 | Right-hand side vector data. | |
x | Result vector. |
Definition at line 97 of file toeplitz.c.
void print_matrix | ( | const char * | name, | |
T * | m, | |||
int | rows, | |||
int | cols, | |||
int | lda | |||
) |
void print_vector | ( | const char * | name, | |
T * | v, | |||
int | n | |||
) |
int readInput | ( | int * | n, | |
T ** | t, | |||
FILE * | file | |||
) |
Auxiliar function for reading input data from standard input.
n | Pointer to variable that will store input data size. | |
t | Pointer to variable that will store input data vector. | |
file | File where contents should be read from. |
1
if successful, 0
otherwise. void sort_eigenvalues | ( | unsigned int | extracted, | |
unsigned int | n, | |||
T * | el, | |||
T * | ev | |||
) |
void toeplitz_gershgorin | ( | const T * | t, | |
unsigned int | n, | |||
T * | low, | |||
T * | up | |||
) |
Calculate Gershgorin disc for a given Toeplitz symmetric matrix.
t | Vector defining a symmetric Toeplitz matrix. | |
n | Size of vector t. | |
low | Lower bound of the Gershgorin disc interval. | |
up | Upper bound of the Gershgorin disc interval. |
Definition at line 42 of file toeplitz.c.
void toeplitz_mult | ( | int | n, | |
const T * | t, | |||
const T * | x, | |||
T * | y | |||
) |
Calculate y = toeplitz(t) * x matrix-vector product where t is in vector form.
n | Size of t and x, y vectors. | |
t | Data of the symmetric Toeplitz matrix in vector form. | |
x | Data of the input vector. | |
y | Data of the destination vector. Will be overwritten with the result. |
Definition at line 70 of file toeplitz.c.
Definition at line 148 of file toeplitz.h.
Definition at line 114 of file toeplitz.h.