accelerInt
v0.1
|
Implementation of LU factorization of complex (variable-sized) matricies. More...
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <float.h>
#include <complex.h>
#include <string.h>
#include "solver_props.h"
#include "lapack_dfns.h"
Go to the source code of this file.
Functions | |
static int | getHessenbergLU (const int n, double complex *__restrict__ A, int *__restrict__ indPivot) |
Computes the LU factorization of a (n x STRIDE) Hessenberg Matrix using partial pivoting with row interchanges. More... | |
void | scaleComplex (const int n, const double complex val, double complex *__restrict__ arrX) |
scaleComplex scales a vector (with increment equal to one) by a constant val. More... | |
void | multiplyComplexUpperMV (const int n, double complex *x, const int lda, const double complex *A) |
Performs the matrix-vector operation \(x_v:= A*x_v\). More... | |
void | complexGEMV (const int m, const int n, const int lda, const double alpha, const double complex *__restrict__ A, const double complex *arrX, double complex *arrY) |
Computes the matrix-vector operation \(alpha*A*x + y\) where alpha is a scalar, x and y are vectors and A is an m by n matrix. More... | |
int | getComplexInverseHessenbergLU (const int n, double complex *__restrict__ A, const int *__restrict__ indPivot) |
getComplexInverseHessenbergLU computes the inverse of a matrix using the LU factorization computed by getHessenbergLU. More... | |
void | getComplexInverseHessenberg (const int n, double complex *__restrict__ A, int *__restrict__ ipiv, int *__restrict__ info) |
getComplexInverseHessenberg computes the inverse of an upper Hessenberg matrix A using a LU factorization method More... | |
Implementation of LU factorization of complex (variable-sized) matricies.
Adapted from Lapack LU factorization and inversion routines
Definition in file complexInverse.c.
void complexGEMV | ( | const int | m, |
const int | n, | ||
const int | lda, | ||
const double | alpha, | ||
const double complex *__restrict__ | A, | ||
const double complex * | arrX, | ||
double complex * | arrY | ||
) |
Computes the matrix-vector operation \(alpha*A*x + y\) where alpha is a scalar, x and y are vectors and A is an m by n matrix.
[in] | m | On entry, M specifies the number of rows of the matrix A. Must be >= 0 |
[out] | n | On entry, N specifies the number of columns of the matrix A. Must be >= 0 |
[in] | lda | The stride of the matrix |
[in] | alpha | The scalar value |
[in] | A | A is an array of dimension (lda, n). Before entry, the leading m by n part of the array A must contain the matrix of coefficients. |
[in] | arrX | arrX is an array of dimension at least (n) Before entry, the incremented array arrX must contain the vector x. |
[in,out] | arrY | arrY is an array of dimension at least (m). Before entry, the incremented array arrY must contain the vector y. On exit, arrY is overwritten by the updated vector y. |
Note: These pointers cannot use the __restrict__ modifier, as they may overlap
Definition at line 146 of file complexInverse.c.
void getComplexInverseHessenberg | ( | const int | n, |
double complex *__restrict__ | A, | ||
int *__restrict__ | ipiv, | ||
int *__restrict__ | info | ||
) |
getComplexInverseHessenberg computes the inverse of an upper Hessenberg matrix A using a LU factorization method
[in] | n | The order of the matrix A. n >= 0. |
[in,out] | A | The array, dimension (STRIDE, n) |
[out] | ipiv | ipiv is an array of dimension (n). The pivot indices from getHessenbergLU; for 0<=i<=n-1, row i of the matrix was interchanged with row indPiv[i]. |
[out] | info | If not zero, an error occured during factorization |
Definition at line 238 of file complexInverse.c.
int getComplexInverseHessenbergLU | ( | const int | n, |
double complex *__restrict__ | A, | ||
const int *__restrict__ | indPivot | ||
) |
getComplexInverseHessenbergLU computes the inverse of a matrix using the LU factorization computed by getHessenbergLU.
This method inverts U and then computes inv(A) by solving the system inv(A)*L = inv(U) for inv(A).
[in] | n | The order of the matrix A. n >= 0. |
[in,out] | A | The array, dimension (STRIDE, n) |
[in] | indPivot | indPivot is an array of dimension (n). The pivot indices from getHessenbergLU; for 0<=i<=n-1, row i of the matrix was interchanged with row indPiv[i]. |
Definition at line 178 of file complexInverse.c.
|
inlinestatic |
Computes the LU factorization of a (n x STRIDE) Hessenberg Matrix using partial pivoting with row interchanges.
[in] | n | The matrix size |
[in,out] | A | The matrix to factorize (nxn) with stride defined in solver_props.h |
[out] | indPivot | indPivot is an array of dimension (n). The pivot indices from getHessenbergLU; for 0<=i<=n-1, row i of the matrix was interchanged with row indPiv[i]. |
The factorization has the form: \(A = P * L * U\) where P is a permutation matrix, L is lower triangular with unit diagonal elements (lower trapezoidal if m > n), and U is upper triangular (upper trapezoidal if m < n). For full reference see: G. W. Stewart, Matrix Algorithms: Volume 1: Basic Decompositions, SIAM, Philadelphia, 1998. doi:10.1137/1.9781611971408.
Definition at line 35 of file complexInverse.c.
void multiplyComplexUpperMV | ( | const int | n, |
double complex * | x, | ||
const int | lda, | ||
const double complex * | A | ||
) |
Performs the matrix-vector operation \(x_v:= A*x_v\).
[in] | n | On entry, n specifies the order of the matrix A. n must be at least zero. |
[out] | x | x is an array of dimension at least (n). Before entry, the incremented array X must contain the n element vector \(x_v\). On exit, X is overwritten with the transformed vector \(x_v\). |
[in] | lda | The stride of the matrix |
[in] | A | A is an array of dimension (lda, n). Before entry the leading n by n upper triangular part of the array A must contain the upper triangular matrix and the strictly lower triangular part of A is not referenced. |
Note: These pointers can't use the __restrict__ attribute, as they may overlap
Definition at line 108 of file complexInverse.c.
void scaleComplex | ( | const int | n, |
const double complex | val, | ||
double complex *__restrict__ | arrX | ||
) |
scaleComplex scales a vector (with increment equal to one) by a constant val.
[in] | n | The vector size |
[out] | val | The value to scale by |
[out] | arrX | The vector to scale |
Definition at line 83 of file complexInverse.c.