int EVqrShifted(MAT &A,double mu, double tol,int maxiter){
	int n=A.dim();
    int k=0;
    double err=10;
    MAT Q(n),R(n),T(A); 
    while(err>tol && k<maxiter){
    	for(int i=0;i<n;i++){		//subtract mu*I before QR factorization
    			T[i][i] = T[i][i] - mu;
    	}
        QRDecomp(T,Q,R);  			//QR factorization
        T=R*Q;						//matrix multiplication
        for(int i=0;i<n;i++){		//add mu*I back
    			T[i][i] = T[i][i] + mu;
    	}
        err = ConvErr(T);
        k++;
    }
        
    printf("the three largest EV:\n");
	printf("%lf %lf %lf\n",T[0][0],T[1][1],T[2][2]);
	printf("the three smallest EV:\n");
	printf("%lf %lf %lf\n",T[n-1][n-1],T[n-2][n-2],T[n-3][n-3]);
	printf("iter = %d\n",k);
	printf("error = %e\n",err);
    A=T;
    return k;
}
void myConvert(const T1& in, T2& out) {
  std::stringstream ss;
  ss << in;
  ss >> out;
  if( ! ss.eof() ) {
    throw ConvErr("Fehler beim Konvertieren");
  }
}
int EVqr(MAT &A,double tol,int maxiter){
    int n=A.dim();
    int k=0;
    double err=10;
    MAT Q(n),R(n),T(A); 
    while(err>tol && k<maxiter){
        QRDecomp(T,Q,R);  			//QR factorization
        T=R*Q;						//matrix multiplication
        err = ConvErr(T);			//get the error term in each iteration
        k++;
    }
        
    printf("the three largest EV:\n");
	printf("%lf %lf %lf\n",T[0][0],T[1][1],T[2][2]);
	printf("the three smallest EV:\n");
	printf("%lf %lf %lf\n",T[n-1][n-1],T[n-2][n-2],T[n-3][n-3]);
	printf("iter = %d\n",k);
	printf("error = %e\n",err);
    A=T;
    return k;
}