Tool/software:
Hi,
Looks to me that there is a bug in DSPF_sp_cholesky optimized function for odd order values.
_nassert is not actually forcing parameter to be even number so the confusion arises (it only says should be > 0).
Code tries to do two elements in parallel to unroll the loop but for odd order, code will try access out of allocated L array memory of [order x order] size:
for (i=j+1;i<order;i+=2) {
sum=0.0;
sum1=0.0;
delta=1;
if (i==order) {
delta=0;
}
for (k=0;k<=j-1;k++) {
sum+=L[i*order+k]*L[j*order+k];
sum1+=L[(i+delta)*order+k]*L[j*order+k];
}
L[i*order+j]=(A[i*order+j]-sum)*y;
L[(i+delta)*order+j]=(A[(i+delta)*order+j]-sum1)*y; -> here (i+delta)*order + j can go outside memory for odd order values. For example: order = 5; j = 3, i = 4, delta = 1 => (i+delta)*order + j = 25 + 3 = 28, and L is 25 length array
}
If this proves as correct from your team, would be good to update SDK function with either code change or forcing order to be even number.
If this proves as correct from your team, would be good to update SDK function with either code change or forcing order to be even number.
Regards,
Predrag