Esempio n. 1
0
int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da_r,FLOAT da_i, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y, FLOAT *dummy, BLASLONG dummy2)
{
	BLASLONG i=0;
	BLASLONG inc_x2;
	BLASLONG ip = 0;
	FLOAT temp;
	BLASLONG n1;

	if ( n <= 0 )
		return(0);

	if ( inc_x <= 0 )
		return(0);

	if (da_r == ZERO && da_i == ZERO) {
	  //clear the vector and return
	  if (inc_x == 1) {
	    memset(x, 0, n*COMPSIZE*SIZE);
	  }else{
	    inc_x2 = 2 * inc_x;
	    for(i=0; i<n; i++){
	      x[ip]=ZERO; 
	      x[ip+1]=ZERO;
	      ip += inc_x2;
	    }
	  }
	  return 0;
	}

	if ( inc_x == 1 )
	{


		n1 = n & -8;
		if ( n1 > 0 )
		{
			zscal_kernel_8(n1, x, da_r, da_i);
			i=n1;
			ip = n1 * 2;

		}

		while ( i < n )
		{

				temp    = da_r * x[ip]   - da_i * x[ip+1] ;
				x[ip+1] = da_r * x[ip+1] + da_i * x[ip]   ;
				x[ip]   = temp;
				ip += 2;
				i++;
		}

	}
	else
	{

		inc_x2 = 2 * inc_x;

		while ( i < n )
		{

				temp    = da_r * x[ip]   - da_i * x[ip+1] ;
				x[ip+1] = da_r * x[ip+1] + da_i * x[ip]   ;
				x[ip]   = temp;
				ip += inc_x2;
				i++;
		}


	}

	return(0);

}
Esempio n. 2
0
int CNAME(BLASLONG n, BLASLONG dummy0, BLASLONG dummy1, FLOAT da_r,FLOAT da_i, FLOAT *x, BLASLONG inc_x, FLOAT *y, BLASLONG inc_y, FLOAT *dummy, BLASLONG dummy2)
{
	BLASLONG i=0;
	BLASLONG inc_x2;
	BLASLONG ip = 0;
	FLOAT temp;
	FLOAT alpha[4] __attribute__ ((aligned (16)));;
	BLASLONG n1;

	if ( n <= 0 )
		return(0);

	if ( inc_x <= 0 )
		return(0);

	if ( inc_x == 1 )
	{


		n1 = n & -8;
		if ( n1 > 0 )
		{
			alpha[0] = da_r;
			alpha[1] = da_r;
			alpha[2] = -da_i;
			alpha[3] = da_i;
			zscal_kernel_8(n1, x, alpha);
			i=n1;
			ip = n1 * 2;

		}

		while ( i < n )
		{

				temp    = da_r * x[ip]   - da_i * x[ip+1] ;
				x[ip+1] = da_r * x[ip+1] + da_i * x[ip]   ;
				x[ip]   = temp;
				ip += 2;
				i++;
		}

	}
	else
	{

		inc_x2 = 2 * inc_x;

		while ( i < n )
		{

				temp    = da_r * x[ip]   - da_i * x[ip+1] ;
				x[ip+1] = da_r * x[ip+1] + da_i * x[ip]   ;
				x[ip]   = temp;
				ip += inc_x2;
				i++;
		}


	}

	return(0);

}