Skip to content
Snippets Groups Projects
Commit 5e4929c9 authored by Pascal Engeler's avatar Pascal Engeler
Browse files

Bugfixes

parent 13eafeea
No related branches found
No related tags found
No related merge requests found
#ifndef DIAGONALIZER_HPP_INCLUDED
#define DIAGONALIZER_HPP_INCLUDED
#include <vector>
#include <iostream>
extern "C" void dsyev_(
char const & JOBZ, // 'N': Only eigenvalues, 'V': Eigenvalues and -vectors
......@@ -36,7 +37,7 @@ class Diagonalizer{
prepare_workspace('N');
}
dsyev_('N', 'L', N_, matrix_.data(), N_, eigenvalues_.data(), &dwork_, lwork_, info_);
dsyev_('N', 'L', N_, matrix_.data(), N_, eigenvalues_.data(), work_, lwork_, info_);
if(info_ != 0)
throw("Diagonalization failed!");
......@@ -61,7 +62,7 @@ class Diagonalizer{
prepare_workspace('V');
}
dsyev_('V', 'L', N_, matrix_.data(), N_, eigenvalues_.data(), &dwork_, lwork_, info_);
dsyev_('V', 'L', N_, matrix_.data(), N_, eigenvalues_.data(), work_, lwork_, info_);
if(info_ != 0)
throw("Diagonalization failed!");
......@@ -71,10 +72,10 @@ class Diagonalizer{
private:
void prepare_workspace(char type){
delete[] dwork_;
dsyev_(type, 'L', N_, matrix_.data(), N_, eigenvalues_.data(), &dwork_, -1, info_);
lwork_ = static_cast<int>(dwork_);
dwork_ = new double[lwork_];
std::cout << "Allocating " << lwork_ << " doubles\n";
work_ = new double[lwork_];
}
int info_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment