HI,
We are using cgecon api to compute the condition large number of matrices. It seems there is difference in results computed for certain matrices. we have verified results for large set of matrices 10^5 ranging from 2X2 to 10X10 sizes. The calculation of condition number for about 10% are wrongly calculated.
We have verifed the results against matlab aswell. Here is an example result compared against matlab.
% input data
N = 2;
H =[ 0.7989 - 0.2170i -2.1232 + 0.8383i;
0.0180 + 1.2296i 0.2920 + 0.8230i; ];
% norm infinite
matlabNormInf = norm(H, Inf)
% = 3.1105
% This is the expected condition number
matlabCond = 1/cond(H,Inf)
% = 0.3582
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Run DLL (complex I/F), with breakpoint before cgecon()
% We use clange() to compute the norm (result in aNorm)
% We use cgetrf() to compute the LU decomposition (result in A)
% When Breakpoint hits on cgecon(), the input is:
% ntran 73 'I' const char
% n 2 int
% +A[0] 0.017999999+i*1.2296000 std::complex
% +A[1] -0.16693313-i*0.65216720 std::complex
% +A[2] 0.29200000+i*0.82300001 std::complex
% +A[3] -2.6111891+i*1.1661187 std::complex
% lda 2 const int
% aNorm 3.1105480 float
% cond -1.0737418e+008 float
% cwork [4](0.0,0.0,0.0,0.0) std::vector<std::complex,std::allocator<std::complex> >
% fwork [4](3.1105480,2.1029973,0.0,0.0) std::vector<float,std::allocator>
% info 0 int
% After stepping over: cgecon(&ntran, &n, A, &lda, &aNorm, &cond, &cwork[0], &fwork[0], &info);
% The only values that changed are:
% cond 0.54947048 float
% cwork [4](-0.041364070+i*0.18391991,0.88580656-i*0.30841386,0.039692443+i*0.23203264,-0.31928882+i*0.14258970)
% fwork [4](0.81910032,0.00000000,0.00000000,1.1150000)
% The condition number is wrong, it should be 0.3582 (computed in matlab as matlabCond)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Check that the input to cgecon() was correct
% clange() reported aNorm=3.1105480 which is correct (Matlab matlabNormInf=3.1105)
% cgetrf() reported A (the H=PLU decomposition from cgetrf() ) which is also correct:
A=[ 0.017999999+j*1.2296000;
-0.16693313-j*0.65216720;
0.29200000+j*0.82300001;
-2.6111891+j*1.1661187; ];
P = [0 1; 1 0];
L = [ 1 0;
A(2) 1; ];
U = [ A(1) A(3);
0 A(4); ];
PLU = P*L*U
% PLU = 0.7989 - 0.2170i -2.1232 + 0.8383i
% 0.0180 + 1.2296i 0.2920 + 0.8230i
% A is correct because H=P*L*U
% The expected condition number using LU instead of H is of course identical
matlabCond = 1/cond(P*L*U,Inf)
% = 0.3582
Kindly verify the observation and let us know whats wrong with the api
Regards
Rohit




