Commit 3d2f155a authored by thomas dettbarn's avatar thomas dettbarn
Browse files

started comparing secdiag and singularvalues. pretty close!!

parent 753a914b
Loading
Loading
Loading
Loading
+43 −12
Original line number Diff line number Diff line
@@ -917,7 +917,7 @@ static void HouseholderReduction_fx(
			printf("compare%d \x1b[1;32mend\x1b[0m\n",nCh);
		}

//                bitwindow=nCh+1;
                bitwindow=2;
		biDiagonalReductionRight_64(
			singularVectors_Left_64,bitwindow,
			secDiag_fx,secDiag_fx_e,
@@ -945,6 +945,23 @@ static void HouseholderReduction_fx(
		}
	}	
	pop_wmops();
	{
		int i;
		printf("SECDIAG: \x1b[1;37m");
		for (i=0;i<nChannelsC;i++)
		{
			secDiag_fx_e[i]+=singularVectors_Left_e;
			printf("%08X<%2d ",secDiag_fx[i],secDiag_fx_e[i]);
		}
		printf("\x1b[0m\n");
		printf("SINGULARVALUES: \x1b[1;37m");
		for (i=0;i<nChannelsC;i++)
		{
			singularValues_fx_e[i]+=singularVectors_Left_e;
			printf("%08X<%2d ",singularValues_fx[i],singularValues_fx_e[i]);
		}
		printf("\x1b[0m\n");
	}
#endif
	push_wmops("HouseholderReduction_fx 32");
    FOR( jCh = 0; jCh < nChannelsL; jCh++ )
@@ -1001,6 +1018,21 @@ static void HouseholderReduction_fx(
        }
    }

	{
		int i;
		printf("SECDIAG: ");
		for (i=0;i<nChannelsC;i++)
		{
			printf("%08X<%2d ",secDiag_fx[i],secDiag_fx_e[i]);
		}
		printf("\n");
		printf("SINGULARVALUES: ");
		for (i=0;i<nChannelsC;i++)
		{
			printf("%08X<%2d ",singularValues_fx[i],singularValues_fx_e[i]);
		}
		printf("\n");
	}



@@ -1036,7 +1068,8 @@ static void HouseholderReduction_fx(
				mine=n;
				printf("MINE:%2d]",n);
				if (!((x^y)&0xff000000)) bettercnt++;
				if (mine==theirs || minemant==singularVectors_Left_fx[i][j])
			//	if (mine==theirs || minemant==singularVectors_Left_fx[i][j])
				if (1)
				{
					singularVectors_Left_fx[i][j]=x;
					singularVectors_Left_fx_e[i][j]=mine;
@@ -1212,13 +1245,13 @@ static void biDiagonalReductionRight_64(
        FOR ( jCh = idx; jCh < nChannelsC; jCh++ )
        {
            Word32 tmp;
            tmp = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow+1) );
            tmp = W_extract_l( W_shr( singularVectors_Left_64[currChannel][jCh], bitwindow) );
            norm_64 = W_add( norm_64, W_mult0_32_32( tmp, tmp) );
            abs_64 = W_add( abs_64, W_abs( singularVectors_Left_64[currChannel][jCh]) );
        }
        norm_x_e = W_norm( norm_64);
        norm_x = W_extract_h( W_shl( norm_64, norm_x_e) );
        norm_x_e = add( sub( shl( bitwindow+1, 1), norm_x_e), 1);
        norm_x_e = add( sub( shl( bitwindow, 1), norm_x_e), 1);
        move16();
        abs_x_e = W_norm( abs_64);
        abs_x = W_extract_h( W_shl( abs_64, abs_x_e) );
@@ -1240,6 +1273,7 @@ static void biDiagonalReductionRight_64(
            Word16 f_e;
            Word32 invVal;
            Word16 invVal_e;
            Word16 r_e2;

            tmp_g_e = norm_x_e;
            move16();
@@ -1252,17 +1286,15 @@ static void biDiagonalReductionRight_64(
            *g_e = tmp_g_e;
            move32();
            move16();
            factor2=W_extract_l( W_shr( singularVectors_Left_64[currChannel][idx], bitwindow+1) );
            tmp_e = sub( tmp_g_e, bitwindow+1);
            factor2=W_extract_l( W_shr( singularVectors_Left_64[currChannel][idx], bitwindow) );
            tmp_e = sub( tmp_g_e, bitwindow);
            tmpmul = W_mult0_32_32( tmp_g, factor2);
            tmpmul = W_shl(tmpmul, tmp_e);
            r_64 = W_sub( tmpmul, norm_64 );
            r_e = W_norm( r_64);
            r = W_extract_h( W_shl( r_64, r_e) );
            r_e = sub( add( shl( bitwindow, 1), 1), r_e );
//	r_e=2*bitwindow+1-r_e;

            invVal_e = r_e;
            invVal_e = 0;
            move16();
            invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e);

@@ -1285,8 +1317,7 @@ static void biDiagonalReductionRight_64(
                norm_x_e = W_norm( norm_64);
                norm_x = W_extract_h( W_shl( norm_64, norm_x_e) );
                f = Mpy_32_32( norm_x, invVal);
                f_e = add( invVal_e, sub( norm_x_e, r_e) );
                magic_shift = 22-2*norm_x_e+4*r_e+3*f_e;		// FIXME: HOW IS THIS WORKING?????!?!?!?!?!?!?!?!?!?
		magic_shift = 25+norm_x_e-  r_e ;	// FIXME: Why does this work?
		
                FOR( jCh = idx; jCh < nChannelsC; jCh++ )
                {