static int DvechmatVecVec(void* AA, double x[], int n, double *v){ dvechmat* A=(dvechmat*)AA; int i,j,k=0; double dd=0,*val=A->AA->val; *v=0.0; if (A->Eig.neigs<n/5){ i=DvechEigVecVec(AA,x,n,&dd); *v=dd*A->alpha; } else { for (i=0; i<n; i++){ for (j=0;j<i;j++){ dd+=2*x[i]*x[j]*val[k]; k++; } dd+=x[i]*x[i]*val[k]; k++; } *v=dd*A->alpha; } return 0; }
static int DvechmatVecVec(void* AA, double x[], int n, double *v){ //printf("File %s line %d DvechmatVecVec with address %d\n",__FILE__, __LINE__,&DvechmatVecVec); dvechmat* A=(dvechmat*)AA; int i,j,k=0; double dd=0,*val=A->AA->val; *v=0.0; if (A->Eig.neigs<n/5){ i=DvechEigVecVec(AA,x,n,&dd); *v=dd*A->alpha; } else { for (i=0; i<n; i++){ for (j=0;j<i;j++){ dd+=2*x[i]*x[j]*val[k]; k++; } dd+=x[i]*x[i]*val[k]; k++; } *v=dd*A->alpha; } return 0; }