Commit f23ca098 authored by thomas dettbarn's avatar thomas dettbarn
Browse files

biDiagonalReductionRight() was not calculating the secDiag Vector correctly.

parent 1503ea89
Loading
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@
#endif
#include "wmc_auto.h"


/*-----------------------------------------------------------------------*
 * Local constants
 *-----------------------------------------------------------------------*/
@@ -512,6 +511,7 @@ static void HouseholderReduction(
        *eps_x = max( *eps_x, ( fabsf( singularValues[nCh] ) + fabsf( secDiag[nCh] ) ) );
    }


    /* SingularVecotr Accumulation */
    singularVectorsAccumulationRight( singularVectors_Left, singularVectors_Right, secDiag, nChannelsC );
    singularVectorsAccumulationLeft( singularVectors_Left, singularValues, nChannelsL, nChannelsC );
@@ -673,6 +673,7 @@ static void biDiagonalReductionRight(
{
    int16_t iCh, jCh, idx;
    float norm_x, r;
    float abs_x;

    /* Setting values to 0 */
    ( *g ) = 0.0f;
@@ -682,10 +683,12 @@ static void biDiagonalReductionRight(
        idx = currChannel + 1;

        norm_x = 0.0f;
        abs_x = 0.0f;

        for ( jCh = idx; jCh < nChannelsC; jCh++ ) /*nChannelsC */
        {
            norm_x += ( singularVectors[currChannel][jCh] * singularVectors[currChannel][jCh] );
            abs_x += fabs( singularVectors[currChannel][jCh] );
        }

        if ( norm_x ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
@@ -693,10 +696,9 @@ static void biDiagonalReductionRight(
            ( *g ) = -( singularVectors[currChannel][idx] >= 0 ? 1 : ( -1 ) ) * sqrtf( norm_x );
            r = ( *g ) * singularVectors[currChannel][idx] - norm_x;
            singularVectors[currChannel][idx] = ( singularVectors[currChannel][idx] - ( *g ) );

            for ( jCh = idx; jCh < nChannelsC; jCh++ ) /* nChannelsC */
            {
                secDiag[jCh] = singularVectors[currChannel][jCh] / maxWithSign( r );
                secDiag[jCh] = ( singularVectors[currChannel][jCh] * abs_x )/ maxWithSign( r );
            }

            for ( iCh = currChannel + 1; iCh < nChannelsL; iCh++ ) /*  nChannelsL */
@@ -706,7 +708,7 @@ static void biDiagonalReductionRight(
                {
                    norm_x += ( singularVectors[iCh][jCh] * singularVectors[currChannel][jCh] );
                }

                norm_x /= abs_x;
                for ( jCh = idx; jCh < nChannelsC; jCh++ ) /*  nChannelsC */
                {
                    singularVectors[iCh][jCh] += ( norm_x * secDiag[jCh] );
@@ -762,7 +764,6 @@ static void biDiagonalReductionRight(
            {
                secDiag[jCh] = singularVectors[currChannel][jCh] / maxWithSign( r );
            }

            for ( iCh = currChannel + 1; iCh < nChannelsL; iCh++ ) /*  nChannelsL */
            {
                norm_x = 0.0f;