b2ac/ext/src/Eigenmethods_double.c
void givensRotation_double(double *csVect, double a, double b)
{
	double tau;
	double tmpVal;
	if (b == 0.0)
	{
		csVect[0] = 1.0;
		csVect[1] = 0.0;
	}
	else
	{
		if (fabs(b) > fabs(a))
		{
			tau = (-a) / b;
			tmpVal = sqrt(1 + (tau * tau));
			csVect[1] = 1 / tmpVal;
			csVect[0] = tau / tmpVal;
		}
		else
		{
			tau = (-b) / a;
			tmpVal = sqrt(1 + (tau * tau));
			csVect[0] = 1 / tmpVal;
			csVect[1] = tau / tmpVal;
		}
	}
}
/**
 * Gets the cosine and sine values needed for performing Givens rotation.
 *
 * @brief Givens rotations are used for creating zeros in matrices
 * by rotating columns and/or rows of the matrix to accommodate for the
 * value in the cell that is zeroed by orthogonal matrix products.
 *
 */
Gets the cosine and sine values needed for performing Givens rotation.
@brief Givens rotations are used for creating zeros in matrices
by rotating columns and/or rows of the matrix to accommodate for the
value in the cell that is zeroed by orthogonal matrix products.
Gets the cosine and sine values needed for performing Givens rotation . @brief Givens rotations are used for creating zeros in matrices by rotating columns and / or rows of the matrix to accommodate for the value in the cell that is zeroed by orthogonal matrix products .
void givensRotation_double(double *csVect, double a, double b)
{
	double tau;
	double tmpVal;
	if (b == 0.0)
	{
		csVect[0] = 1.0;
		csVect[1] = 0.0;
	}
	else
	{
		if (fabs(b) > fabs(a))
		{
			tau = (-a) / b;
			tmpVal = sqrt(1 + (tau * tau));
			csVect[1] = 1 / tmpVal;
			csVect[0] = tau / tmpVal;
		}
		else
		{
			tau = (-b) / a;
			tmpVal = sqrt(1 + (tau * tau));
			csVect[0] = 1 / tmpVal;
			csVect[1] = tau / tmpVal;
		}
	}
}
void givensRotation_double ( double * csVect , double a , double b ) { double tau ; double tmpVal ; if ( b == 0.0 ) { csVect [ 0 ] = 1.0 ; csVect [ 1 ] = 0.0 ; } else { if ( fabs ( b ) > fabs ( a ) ) { tau = ( - a ) / b ; tmpVal = sqrt ( 1 + ( tau * tau ) ) ; csVect [ 1 ] = 1 / tmpVal ; csVect [ 0 ] = tau / tmpVal ; } else { tau = ( - b ) / a ; tmpVal = sqrt ( 1 + ( tau * tau ) ) ; csVect [ 0 ] = 1 / tmpVal ; csVect [ 1 ] = tau / tmpVal ; } } }
Gets the cosine and sine values needed for performing Givens rotation.
Gets the cosine and sine values needed for performing Givens rotation .