I\'m new to numerical linear algebra, and I have just started using LAPACK and BLAS.
Is there a routine that can copy/convert a symmetric matrix between packed and f
The obvious solution is to symmetrize the matrix by a "home-made/diy" code, the risk being to re-invent the wheel. It is pretty easy to write the for loops needed to symmetrize the matrix after dtpttr.
for(i=0;i
Is it efficient enough for your application ? On a 10000x10000 matrix, these for loops last 0.88s on my PC, while dtpttr
lasts 0.24s.
Here is the test code. Compile it with gcc main.c -o main -llapack -lblas -lm
:
#include
#include
#include
#include
void dtrttp_(char* UPLO,int* N,double* A,int* LDA,double* AP,int* INFO);
void dtpttr_(char* UPLO,int* N,double* AP,double* A,int* LDA,int* INFO);
void daxpy_(int* N,double* DA,double* DX,int* INCX,double* DY,int* INCY);
void dtpttf_(char* TRANSR,char* UPLO,int* N,double* AP,double* ARF,int* INFO);
int main(int argc, char **argv)
{
int n=10;
int info;
double *a=malloc(n*n*sizeof(double));
double *packed=malloc((n*(n+1))/2*sizeof(double));
int i,j;
for(i=0;i