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

f okay.

parent 3809a87b
Loading
Loading
Loading
Loading
+16 −22
Original line number Diff line number Diff line
@@ -1033,17 +1033,13 @@ static void biDiagonalReductionLeft_64(
        r=W_extract_h(W_shl(r_64,tmpe2));
        r_e = sub(sub(add(add(1,singularVectors_e),g_e),tmpe),tmpe2);

		printf("MYR: \x1b[1;33m-%08X  %08X<%02X   ",-r,r,r_e);
        invVal_e = r_e;
        invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, r, &invVal_e);
		printf(" inv: -%08X %08X<%02X\x1b[0m\n",-invVal,invVal,invVal_e);
		

        tmpe=add(32,sub(singularVectors_e,g_e));	// TODO: maybe the other way around??
        tmp64=W_shr(W_deposit32_h(g),tmpe);
	printf("MY PROBLEM: \x1b[1;31m singularVectors_Left_64[currChannel][currChannel]:%016llX - %016llX = ",singularVectors_Left_64[currChannel][currChannel],tmp64);
	singularVectors_Left_64[currChannel][currChannel]=W_sub(singularVectors_Left_64[currChannel][currChannel],tmp64);	// exponent +1
	printf(" = %016llX\x1b[0m\n",singularVectors_Left_64[currChannel][currChannel]);


        tmpe=add(singularVectors_e,2);
@@ -1063,16 +1059,23 @@ static void biDiagonalReductionLeft_64(
                norm_64=W_add(norm_64, W_mult0_32_32(tmp2,tmp3));
            }
            norm_x_e=W_norm(norm_64);
            norm_x=W_shl(norm_64,norm_x_e);
            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 ));
		printf("\nMYF: \x1b[1;33m%08X<%2X\x1b[0m\n",f,f_e);

		printf("MYADD:  \x1b[1;33m");
            for (jCh=currChannel;jCh<nChannelsL; jCh++)
            {
                tmp2=W_extract_l(W_shr(singularVectors_Left_64[jCh][currChannel],tmpe));
		singularVectors_Left_64[jCh][iCh]=W_add(singularVectors_Left_64[jCh][iCh],W_mult0_32_32(f,tmp2));	// exponent +1
		printf("%016llX + %08X*%08X  (%016llX  %08X  ) =",singularVectors_Left_64[jCh][iCh],f,tmp2,
		-W_mult0_32_32(f,tmp2),
		-Mpy_32_32(f,tmp2)

		);
		singularVectors_Left_64[jCh][iCh]=W_add(singularVectors_Left_64[jCh][iCh],W_shr(W_mult0_32_32(f,tmp2),28));	// exponent +1
		printf("%016llX    ",-singularVectors_Left_64[jCh][iCh]);
            }
		printf("\x1b[0m\n");
        }
    }
}
@@ -1181,7 +1184,7 @@ static void biDiagonalReductionRight_64(
                Word32 tmp3;
    
        
                tmp2=W_extract_l(W_shr(singularVectors_Left_64[jCh][iCh],tmpe));
                tmp2=W_extract_l(W_shr(singularVectors_Left_64[currChannel][iCh],tmpe));
                norm_64=W_mult0_32_32(tmp,tmp2);
                for (jCh=currChannel+1;jCh<nChannelsL; jCh++)
                {
@@ -1190,7 +1193,7 @@ static void biDiagonalReductionRight_64(
                    norm_64=W_add(norm_64, W_mult0_32_32(tmp2,tmp3));
                }
                norm_x_e=W_norm(norm_64);
                norm_x=W_shl(norm_64,norm_x_e);
                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 ));
    
@@ -1265,7 +1268,6 @@ static void biDiagonalReductionLeft_fx(
	if (currChannel==0)
	{
		Word16 tmpe;
		printf("\nNORM64:");
		exponent0=singularVectors2_e[0][0];
		norm_64	=0;
		move64();
@@ -1274,7 +1276,6 @@ static void biDiagonalReductionLeft_fx(
			Word32 tmp;
			tmp=L_shr(singularVectors[jCh][currChannel],1);
			norm_64 = W_add(norm_64, W_mult0_32_32(tmp,tmp ));
			printf("%016llx ",norm_64);
		}
		tmpe=W_norm(norm_64);
		norm_x = W_extract_h(W_shl(norm_64, tmpe ));
@@ -1282,12 +1283,7 @@ static void biDiagonalReductionLeft_fx(

		zwei=norm_x;
		zwei_e=norm_x_e;
		printf("[%08X<%2X  %08X<%2X]",eins,eins_e,zwei,zwei_e);
		if (eins==zwei) printf(" okay "); else printf("      ");
		if (eins_e==zwei_e) printf(" okay "); else printf(" FAIL ");
		printf("\n");
	}
	printf("DAFUQ3: %08X\n",singularVectors[0][0]);

        IF( norm_x ) /*(fabsf(*sig_x) > EPSILON * fabsf(*sig_x)) { */
        {
@@ -1346,17 +1342,13 @@ static void biDiagonalReductionLeft_fx(
//		else 
		{

			printf("MY PROBLEM: %08X<%2X - %08X<%2X = ",singularVectors[currChannel][currChannel], singularVectors2_e[currChannel][currChannel],g,g_e);
		    singularVectors[currChannel][currChannel] = BASOP_Util_Add_Mant32Exp( singularVectors[currChannel][currChannel], singularVectors2_e[currChannel][currChannel], -g, g_e, &singularVectors2_e[currChannel][currChannel] ); /* sing_exp */
			printf("%08X<%2X\n",singularVectors[currChannel][currChannel],singularVectors2_e[currChannel][currChannel]);
		    move32();
		}

            invVal_e = r_e;
            move16();
		printf("\nMYR: -%08X  %08X<%02X   ",-r,r,r_e);
            invVal = BASOP_Util_Divide3232_Scale_newton( MAXVAL_WORD32, maxWithSign_fx( r ), &invVal_e );
		printf(" inv: -%08X %08X<%02X\n",-invVal,invVal,invVal_e);

            FOR( iCh = currChannel + 1; iCh < nChannelsC; iCh++ ) /* nChannelsC */
            {
@@ -1368,16 +1360,18 @@ static void biDiagonalReductionLeft_fx(
                {
                    norm_x = BASOP_Util_Add_Mant32Exp( norm_x, norm_x_e, Mpy_32_32( singularVectors[jCh][currChannel], singularVectors[jCh][iCh] ), add( singularVectors2_e[jCh][currChannel], singularVectors2_e[jCh][iCh] ), &norm_x_e ); /* exp(norm_x_e) */
                }

                f = Mpy_32_32( norm_x, invVal ); /* invVal_e + (norm_x_e - r_e) */
                f_e = add( invVal_e, sub( norm_x_e, r_e ) );
		printf("\nMYF: %08X<%2X\n",f,f_e);

		printf("MYADD:  ");
                FOR( jCh = currChannel; jCh < nChannelsL; jCh++ ) /* nChannelsL */
                {
			printf("%08X<%02X + %08X<%02X*%08X<%02X= ",singularVectors[jCh][iCh],singularVectors2_e[jCh][iCh], f,f_e, singularVectors[jCh][currChannel], singularVectors2_e[jCh][currChannel]);
                    singularVectors[jCh][iCh] = BASOP_Util_Add_Mant32Exp( singularVectors[jCh][iCh], singularVectors2_e[jCh][iCh], Mpy_32_32( f, singularVectors[jCh][currChannel] ), add( f_e, singularVectors2_e[jCh][currChannel] ), &singularVectors2_e[jCh][iCh] );
			printf("%08X<%02X    ",-singularVectors[jCh][iCh],singularVectors2_e[jCh][iCh]);
                    move32();
                }
		printf("\n");
            }
        }
        // rescaling block