linalg.cpp 867 Bytes

// This file contains a set of wrapper functions that are linked to the corresponding functions in CLAPACK

extern "C" {
#include "f2c.h"
#include "clapack.h"
}

void LINALG_dgeev(
	char JOBVL,
	char JOBVR,
	int n,
	double* A,
	int LDA,
	double* WR,
	double* WI,
	double* VL,
	int LDVL,
	double* VR,
	int LDVR)
{
	integer LWORK = -1;
	double WORK[1];
	integer INFO;
	dgeev_(&JOBVL, &JOBVR, (integer*)&n, A, (integer*)&LDA, WR, WI, VL, (integer*)&LDVL, VR, (integer*)&LDVR, WORK, &LWORK, &INFO);
}

void LINALG_dgetrf(
	int M,
	int N,
	double* A,
	int LDA,
	int* IPIV)
{
	integer INFO;
	dgetrf_((integer*)&M, (integer*)&N, A, (integer*)&LDA, (integer*)IPIV, &INFO);
}

void LINALG_dgetri(
	int N,
	double* A,
	int LDA,
	int* IPIV)
{
	integer LWORK = -1;
	double WORK[1];
	integer INFO;
	dgetri_((integer*)&N, A, (integer*)&LDA, (integer*)IPIV, WORK, &LWORK, &INFO);
}