dsysv fail to slove the function AX=B

Open discussion regarding features, bugs, issues, vendors, etc.

dsysv fail to slove the function AX=B

Postby hoding1234 » Tue Apr 14, 2015 12:58 am

Hi,guys
I am a new beginner with lapack. When using dsysv_ to solve AX=B,I constantly get the same B as output, which means I fail to solve the function.I don't no why?The original code is as follow


#include<iostream>
#include <process.h>
#include <array>
#include <vector>
using namespace std;

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


#define SIZE 4


int main()
{
double LHS[36]=
{
1 , 2 , 3 , 4 , 5 , 6,
2 , 4 , 6 , 8 , 10 , 12,
3 , 6 , 9 , 12 , 15 , 18,
4 , 8 , 12 , 16 , 20 , 24,
5 , 10 , 15 , 20 , 25 , 30,
6 , 12 , 18 , 24 , 30, 36
};
double RHS[6]={154,308,462,616,770,924};


char uplo = 'U';
integer n = 6;
integer nrhs = 1;
integer lDA = 6;
integer ipiv[6];
integer lDB = 6;
doublereal worksize;
integer lwork = -1;
integer info;
dsysv_(&uplo, &n, &nrhs, LHS, &lDA, ipiv, RHS, &lDB, &worksize, &lwork, &info);
std::vector<double> work((int)worksize);
lwork = (int)worksize;
dsysv_(&uplo, &n, &nrhs, LHS, &lDA, ipiv, RHS.data(), &lDB, work.data(), &lwork, &info);
for(int i=0;i<6;i++)
std::cout<<RHS[i]<<std::endl;
cout<<info<<endl;
}

Can anyone give me some instructons, great thanks!
hoding1234
 
Posts: 1
Joined: Mon Apr 13, 2015 10:50 pm

Return to User Discussion

Who is online

Users browsing this forum: No registered users and 8 guests