dbengnea.cpp

Go to the documentation of this file.
00001 #include "bnengine.h"
00002 #include "strctbse.h"
00003 #include "datahndl.h"
00004 #include "blas.h"
00005 
00006 void  CAMbinaryEngine::doubleAequalToB(CAMstructureBase &Astructure, CAMdataHandler &Adata,
00007 const CAMstructureBase &Bstructure, const CAMdataHandler &Bdata)
00008 {
00009     double* AdataP = (double*)Adata.getDataPointer();
00010     double* BdataP = (double*)Bdata.getDataPointer();
00011 
00012     CAMdataHandler Btemporary;
00013     if(AdataP == BdataP)
00014     {
00015     Btemporary.initialize(Bdata);
00016     BdataP = (double*)Btemporary.getDataPointer();
00017     }
00018 
00019 #ifndef __NO_BLAS__
00020     long strideA;
00021     long strideB;
00022     long Size;
00023 #endif
00024 
00025     if((Astructure.isSubset() == 0)&&(Bstructure.isSubset() == 0))
00026     {
00027 #ifdef __NO_BLAS__
00028     register double* aptr; register double* bptr;
00029     for(aptr = AdataP, bptr = BdataP;
00030        aptr < AdataP + Adata.getDataSize();
00031        aptr++, bptr++) { *aptr = *bptr; };
00032 #else
00033     strideA    = 1;
00034     strideB    = 1;
00035     Size       = Adata.getDataSize();
00036 
00037     dcopy_(&Size,BdataP,&strideB, AdataP, &strideA);
00038 #endif
00039     }
00040     else
00041     {
00042 //
00043 //  Get Normalized Loops
00044 //
00045     long AloopDimension;
00046     long AOffset;
00047     MVAlongBase ACount;
00048     MVAlongBase AStride;
00049 
00050     long BloopDimension;
00051     long BOffset;
00052     MVAlongBase BCount;
00053     MVAlongBase BStride;
00054 
00055     Astructure.getNormalizedLoops(AloopDimension,AOffset, ACount, AStride);
00056     Bstructure.getNormalizedLoops(BloopDimension,BOffset, BCount, BStride);
00057 
00058     register long i1, i2, i3, i4, i5, i6, i7;
00059     register long j1, j2, j3, j4, j5, j6, j7;
00060 
00061     double* AOffptr = AdataP + AOffset;
00062     double* BOffptr = BdataP + BOffset;
00063 
00064     register double* Ap1; register double* Bp1;
00065     register double* Ap2; register double* Bp2;
00066     register double* Ap3; register double* Bp3;
00067     register double* Ap4; register double* Bp4;
00068     register double* Ap5; register double* Bp5;
00069     register double* Ap6; register double* Bp6;
00070 
00071 #ifndef __NO_BLAS__
00072     strideA = AStride[0];
00073     strideB = BStride[0];
00074     Size    = ACount[0];
00075 #endif
00076 
00077     switch(AloopDimension)
00078     {
00079     case 1 :
00080 #ifdef __NO_BLAS__
00081     for(i1=0, j1=0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00082     {
00083     *(AOffptr + i1) = *(BOffptr + j1);
00084     };
00085 #else
00086     Bp1 = BOffptr;
00087     Ap1 = AOffptr;
00088     dcopy_(&Size,Bp1,&strideB, Ap1, &strideA);
00089 #endif
00090 
00091     break;
00092 
00093     case 2 :
00094     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00095     { Ap1 = AOffptr + i2; Bp1 = BOffptr + j2;
00096 #ifdef __NO_BLAS__
00097     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00098     {
00099     *(Ap1 + i1)= *(Bp1 + j1);
00100     }
00101 #else
00102     dcopy_(&Size,Bp1,&strideB, Ap1, &strideA);
00103 #endif
00104     };
00105     break;
00106 
00107     case 3 :
00108     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00109     { Ap2 = AOffptr + i3; Bp2 = BOffptr + j3;
00110     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00111     { Ap1 = Ap2     + i2; Bp1 = Bp2     + j2;
00112 #ifdef __NO_BLAS__
00113     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00114     {
00115     *(Ap1 + i1) = *(Bp1 + j1);
00116     }
00117 #else
00118     dcopy_(&Size,Bp1,&strideB, Ap1, &strideA);
00119 #endif
00120     }};
00121     break;
00122 
00123     case 4 :
00124     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00125     { Ap3 = AOffptr + i4; Bp3 = BOffptr + j4;
00126     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00127     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00128     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00129     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00130 #ifdef __NO_BLAS__
00131     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00132     {
00133     *(Ap1 + i1) = *(Bp1 + j1);
00134     }
00135 #else
00136     dcopy_(&Size,Bp1,&strideB, Ap1, &strideA);
00137 #endif
00138     }}};
00139     break;
00140 
00141     case 5 :
00142     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00143     { Ap4 = AOffptr + i5; Bp4 = BOffptr + j5;
00144     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00145     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00146     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00147     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00148     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00149     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00150 #ifdef __NO_BLAS__
00151     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00152     {
00153     *(Ap1 + i1) = *(Bp1 + j1);
00154     }
00155 #else
00156     dcopy_(&Size,Bp1,&strideB, Ap1, &strideA);
00157 #endif
00158     }}}};
00159     break;
00160 
00161     case 6 :
00162     for(i6=0, j6 = 0; i6 < ACount[5]*AStride[5]; i6+=AStride[5], j6+=BStride[5])
00163     { Ap5 = AOffptr+ i6; Bp5 = BOffptr + j6;
00164     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00165     { Ap4 = Ap5 + i5; Bp4 = Bp5 + j5;
00166     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00167     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00168     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00169     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00170     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00171     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00172 #ifdef __NO_BLAS__
00173     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00174     {
00175     *(Ap1 + i1) = *(Bp1 + j1);
00176     }
00177 #else
00178     dcopy_(&Size,Bp1,&strideB, Ap1, &strideA);
00179 #endif
00180     }}}}};
00181     break;
00182 
00183     case 7 :
00184     for(i7=0, j7 = 0; i7 < ACount[6]*AStride[6]; i7+=AStride[6], j7+=BStride[6])
00185     { Ap6 = AOffptr + i7; Bp6 = BOffptr + j7;
00186     for(i6=0, j6 = 0; i6 < ACount[5]*AStride[5]; i6+=AStride[5], j6+=BStride[5])
00187     { Ap5 = Ap6 + i6; Bp5 = Bp6 + j6;
00188     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00189     { Ap4 = Ap5 + i5; Bp4 = Bp5 + j5;
00190     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00191     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00192     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00193     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00194     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00195     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00196 #ifdef __NO_BLAS__
00197     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00198     {
00199     *(Ap1 + i1) = *(Bp1 + j1);
00200     }
00201 #else
00202     dcopy_(&Size,Bp1,&strideB, Ap1, &strideA);
00203 #endif
00204     }}}}}};
00205     break;
00206 
00207     }
00208 }
00209 
00210 }
00211 
00212 void  CAMbinaryEngine::doubleAequalToMinusB(CAMstructureBase &Astructure, CAMdataHandler &Adata,
00213 const CAMstructureBase &Bstructure, const CAMdataHandler &Bdata)
00214 {
00215     double* AdataP = (double*)Adata.getDataPointer();
00216     double* BdataP = (double*)Bdata.getDataPointer();
00217 
00218     CAMdataHandler Btemporary;
00219     if(AdataP == BdataP)
00220     {
00221     Btemporary.initialize(Bdata);
00222     BdataP = (double*)Btemporary.getDataPointer();
00223     }
00224 
00225     if((Astructure.isSubset() == 0)&&(Bstructure.isSubset() == 0))
00226     {
00227     register double* aptr; register double* bptr;
00228     for(aptr = AdataP, bptr = BdataP;
00229        aptr < AdataP + Adata.getDataSize();
00230        aptr++, bptr++) { *aptr = -(*bptr);};
00231     }
00232     else
00233     {
00234 //
00235 //  Get Normalized Loops
00236 //
00237     long AloopDimension;
00238     long AOffset;
00239     MVAlongBase ACount;
00240     MVAlongBase AStride;
00241 
00242     long BloopDimension;
00243     long BOffset;
00244     MVAlongBase BCount;
00245     MVAlongBase BStride;
00246 
00247     Astructure.getNormalizedLoops(AloopDimension,AOffset, ACount, AStride);
00248     Bstructure.getNormalizedLoops(BloopDimension,BOffset, BCount, BStride);
00249 
00250     register long i1, i2, i3, i4, i5, i6, i7;
00251     register long j1, j2, j3, j4, j5, j6, j7;
00252 
00253     double* AOffptr = AdataP + AOffset;
00254     double* BOffptr = BdataP + BOffset;
00255 
00256     register double* Ap1; register double* Bp1;
00257     register double* Ap2; register double* Bp2;
00258     register double* Ap3; register double* Bp3;
00259     register double* Ap4; register double* Bp4;
00260     register double* Ap5; register double* Bp5;
00261     register double* Ap6; register double* Bp6;
00262 
00263 
00264     switch(AloopDimension)
00265     {
00266     case 1 :
00267     for(i1=0, j1=0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00268     {
00269     *(AOffptr + i1) = -(*(BOffptr + j1));
00270     };
00271 
00272     break;
00273 
00274     case 2 :
00275     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00276     { Ap1 = AOffptr + i2; Bp1 = BOffptr + j2;
00277     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00278     {
00279     *(Ap1 + i1)= -(*(Bp1 + j1));
00280     }};
00281     break;
00282 
00283     case 3 :
00284     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00285     { Ap2 = AOffptr + i3; Bp2 = BOffptr + j3;
00286     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00287     { Ap1 = Ap2     + i2; Bp1 = Bp2     + j2;
00288     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00289     {
00290     *(Ap1 + i1) = -(*(Bp1 + j1));
00291     }}};
00292     break;
00293 
00294     case 4 :
00295     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00296     { Ap3 = AOffptr + i4; Bp3 = BOffptr + j4;
00297     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00298     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00299     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00300     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00301     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00302     {
00303     *(Ap1 + i1) =-(*(Bp1 + j1));
00304     }}}};
00305     break;
00306 
00307     case 5 :
00308     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00309     { Ap4 = AOffptr + i5; Bp4 = BOffptr + j5;
00310     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00311     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00312     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00313     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00314     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00315     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00316     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00317     {
00318     *(Ap1 + i1) = -(*(Bp1 + j1));
00319     }}}}};
00320     break;
00321 
00322     case 6 :
00323     for(i6=0, j6 = 0; i6 < ACount[5]*AStride[5]; i6+=AStride[5], j6+=BStride[5])
00324     { Ap5 = AOffptr+ i6; Bp5 = BOffptr + j6;
00325     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00326     { Ap4 = Ap5 + i5; Bp4 = Bp5 + j5;
00327     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00328     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00329     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00330     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00331     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00332     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00333     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00334     {
00335     *(Ap1 + i1) =-(*(Bp1 + j1));
00336     }}}}}};
00337     break;
00338 
00339     case 7 :
00340     for(i7=0, j7 = 0; i7 < ACount[6]*AStride[6]; i7+=AStride[6], j7+=BStride[6])
00341     { Ap6 = AOffptr + i7; Bp6 = BOffptr + j7;
00342     for(i6=0, j6 = 0; i6 < ACount[5]*AStride[5]; i6+=AStride[5], j6+=BStride[5])
00343     { Ap5 = Ap6 + i6; Bp5 = Bp6 + j6;
00344     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00345     { Ap4 = Ap5 + i5; Bp4 = Bp5 + j5;
00346     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00347     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00348     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00349     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00350     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00351     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00352     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00353     {
00354     *(Ap1 + i1) = -(*(Bp1 + j1));
00355     }}}}}}};
00356     break;
00357 
00358     }
00359 }
00360 }
00361 
00362 void  CAMbinaryEngine::doubleAplusEqualB(CAMstructureBase &Astructure, CAMdataHandler &Adata,
00363 const CAMstructureBase &Bstructure, const CAMdataHandler &Bdata)
00364 {
00365     double* AdataP = (double*)Adata.getDataPointer();
00366     double* BdataP = (double*)Bdata.getDataPointer();
00367 
00368     CAMdataHandler Btemporary;
00369     if(AdataP == BdataP)
00370     {
00371     Btemporary.initialize(Bdata);
00372     BdataP = (double*)Btemporary.getDataPointer();
00373     }
00374 
00375 #ifndef __NO_BLAS__
00376     long   strideA;
00377     long   strideB;
00378     long   Size;
00379     double dOne = 1.0;
00380 #endif
00381 
00382     if((Astructure.isSubset() == 0)&&(Bstructure.isSubset() == 0))
00383     {
00384 #ifdef __NO_BLAS__
00385     double* aptr; double* bptr;
00386     for(aptr = AdataP, bptr = BdataP;
00387        aptr < AdataP + Adata.getDataSize();
00388        aptr++, bptr++) { *aptr += *bptr; };
00389 #else
00390     strideA    = 1;
00391     strideB    = 1;
00392     Size       = Adata.getDataSize();
00393 
00394     daxpy_(&Size,&dOne, BdataP,&strideB, AdataP, &strideA);
00395 #endif
00396     }
00397     else
00398     {
00399 //
00400 //  Get Normalized Loops
00401 //
00402     long AloopDimension;
00403     long AOffset;
00404     MVAlongBase ACount;
00405     MVAlongBase AStride;
00406 
00407     long BloopDimension;
00408     long BOffset;
00409     MVAlongBase BCount;
00410     MVAlongBase BStride;
00411 
00412     Astructure.getNormalizedLoops(AloopDimension,AOffset, ACount, AStride);
00413     Bstructure.getNormalizedLoops(BloopDimension,BOffset, BCount, BStride);
00414 
00415     register long i1, i2, i3, i4, i5, i6, i7;
00416     register long j1, j2, j3, j4, j5, j6, j7;
00417     double* AOffptr = AdataP + AOffset;
00418     double* BOffptr = BdataP + BOffset;
00419 
00420     register double* Ap1; register double* Bp1;
00421     register double* Ap2; register double* Bp2;
00422     register double* Ap3; register double* Bp3;
00423     register double* Ap4; register double* Bp4;
00424     register double* Ap5; register double* Bp5;
00425     register double* Ap6; register double* Bp6;
00426 
00427 #ifndef __NO_BLAS__
00428     strideA = AStride[0];
00429     strideB = BStride[0];
00430     Size    = ACount[0];
00431 #endif
00432 
00433     switch(AloopDimension)
00434     {
00435     case 1 :
00436 #ifdef __NO_BLAS__
00437     for(i1=0, j1=0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00438     {
00439     *(AOffptr + i1) +=
00440     *(BOffptr + j1);
00441     };
00442 #else
00443     daxpy_(&Size,&dOne, BOffptr,&strideB, AOffptr, &strideA);
00444 #endif
00445 
00446     break;
00447 
00448     case 2 :
00449     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00450     { Ap1 = AOffptr + i2; Bp1 = BOffptr + j2;
00451 #ifdef __NO_BLAS__
00452     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00453     {
00454     *(Ap1 + i1) += *(Bp1 + j1);
00455     }
00456 #else
00457     daxpy_(&Size,&dOne, Bp1,&strideB, Ap1, &strideA);
00458 #endif
00459     };
00460     break;
00461 
00462     case 3 :
00463     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00464     { Ap2 = AOffptr + i3; Bp2 = BOffptr + j3;
00465     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00466     { Ap1 = Ap2     + i2; Bp1 = Bp2     + j2;
00467 #ifdef __NO_BLAS__
00468     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00469     {
00470     *(Ap1 + i1) += *(Bp1 + j1);
00471     }
00472 #else
00473     daxpy_(&Size,&dOne, Bp1,&strideB, Ap1, &strideA);
00474 #endif
00475     }};
00476     break;
00477 
00478     case 4 :
00479     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00480     { Ap3 = AOffptr + i4; Bp3 = BOffptr + j4;
00481     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00482     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00483     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00484     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00485 #ifdef __NO_BLAS__
00486     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00487     {
00488     *(Ap1 + i1) += *(Bp1 + j1);
00489     }
00490 #else
00491     daxpy_(&Size,&dOne, Bp1,&strideB, Ap1, &strideA);
00492 #endif
00493     }}};
00494     break;
00495 
00496     case 5 :
00497     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00498     { Ap4 = AOffptr + i5; Bp4 = BOffptr + j5;
00499     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00500     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00501     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00502     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00503     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00504     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00505 #ifdef __NO_BLAS__
00506     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00507     {
00508     *(Ap1 + i1) += *(Bp1 + j1);
00509     }
00510 #else
00511     daxpy_(&Size,&dOne, Bp1,&strideB, Ap1, &strideA);
00512 #endif
00513     }}}};
00514     break;
00515 
00516     case 6 : 
00517     for(i6=0, j6 = 0; i6 < ACount[5]*AStride[5]; i6+=AStride[5], j6+=BStride[5])
00518     { Ap5 = AOffptr+ i6; Bp5 = BOffptr + j6;
00519     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00520     { Ap4 = Ap5 + i5; Bp4 = Bp5 + j5;
00521     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00522     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00523     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00524     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00525     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00526     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00527 #ifdef __NO_BLAS__
00528     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00529     {
00530     *(Ap1 + i1) += *(Bp1 + j1);
00531     }
00532 #else
00533     daxpy_(&Size,&dOne, Bp1,&strideB, Ap1, &strideA);
00534 #endif
00535     }}}}};
00536     break;
00537 
00538     case 7 :
00539     for(i7=0, j7 = 0; i7 < ACount[6]*AStride[6]; i7+=AStride[6], j7+=BStride[6])
00540     { Ap6 = AOffptr + i7; Bp6 = BOffptr + j7;
00541     for(i6=0, j6 = 0; i6 < ACount[5]*AStride[5]; i6+=AStride[5], j6+=BStride[5])
00542     { Ap5 = Ap6 + i6; Bp5 = Bp6 + j6;
00543     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00544     { Ap4 = Ap5 + i5; Bp4 = Bp5 + j5;
00545     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00546     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00547     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00548     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00549     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00550     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00551 #ifdef __NO_BLAS__
00552     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00553     {
00554     *(Ap1 + i1) += *(Bp1 + j1);
00555     }
00556 #else
00557     daxpy_(&Size,&dOne, Bp1,&strideB, Ap1, &strideA);
00558 #endif
00559     }}}}}};
00560     break;
00561 
00562     }
00563 }
00564 
00565 
00566 }
00567 
00568 
00569 
00570 void  CAMbinaryEngine::doubleAminusEqualB(CAMstructureBase &Astructure, CAMdataHandler &Adata,
00571 const CAMstructureBase &Bstructure, const CAMdataHandler &Bdata)
00572 {
00573     double* AdataP = (double*)Adata.getDataPointer();
00574     double* BdataP = (double*)Bdata.getDataPointer();
00575 
00576     CAMdataHandler Btemporary;
00577     if(AdataP == BdataP)
00578     {
00579     Btemporary.initialize(Bdata);
00580     BdataP = (double*)Btemporary.getDataPointer();
00581     }
00582 
00583 #ifndef __NO_BLAS__
00584     long strideA;
00585     long strideB;
00586     long Size;
00587     double dNegOne = -1.0;
00588 #endif
00589 
00590     if((Astructure.isSubset() == 0)&&(Bstructure.isSubset() == 0))
00591     {
00592 #ifdef __NO_BLAS__
00593     double* aptr; double* bptr;
00594     for(aptr = AdataP, bptr = BdataP;
00595        aptr < AdataP + Adata.getDataSize();
00596        aptr++, bptr++) { *aptr -= *bptr; };
00597 #else
00598     strideA    = 1;
00599     strideB    = 1;
00600     Size       = Adata.getDataSize();
00601 
00602     daxpy_(&Size,&dNegOne, BdataP, &strideB, AdataP,&strideA);
00603 #endif
00604     }
00605     else
00606     {
00607 //
00608 //  Get Normalized Loops
00609 //
00610     long AloopDimension;
00611     long AOffset;
00612     MVAlongBase ACount;
00613     MVAlongBase AStride;
00614 
00615     long BloopDimension;
00616     long BOffset;
00617     MVAlongBase BCount;
00618     MVAlongBase BStride;
00619 
00620     Astructure.getNormalizedLoops(AloopDimension,AOffset, ACount, AStride);
00621     Bstructure.getNormalizedLoops(BloopDimension,BOffset, BCount, BStride);
00622 
00623     register long i1, i2, i3, i4, i5, i6, i7;
00624     register long j1, j2, j3, j4, j5, j6, j7;
00625     double* AOffptr = AdataP + AOffset;
00626     double* BOffptr = BdataP + BOffset;
00627 
00628     register double* Ap1; register double* Bp1;
00629     register double* Ap2; register double* Bp2;
00630     register double* Ap3; register double* Bp3;
00631     register double* Ap4; register double* Bp4;
00632     register double* Ap5; register double* Bp5;
00633     register double* Ap6; register double* Bp6;
00634 
00635 #ifndef __NO_BLAS__
00636     strideA = AStride[0];
00637     strideB = BStride[0];
00638     Size    = ACount[0];
00639 #endif
00640 
00641     switch(AloopDimension)
00642     {
00643     case 1 :
00644 #ifdef __NO_BLAS__
00645     for(i1=0, j1=0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00646     {
00647     *(AOffptr + i1) -=
00648     *(BOffptr + j1);
00649     };
00650 #else
00651     daxpy_(&Size,&dNegOne, BOffptr, &strideB,  AOffptr, &strideA);
00652 #endif
00653 
00654     break;
00655 
00656     case 2 :
00657     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00658     { Ap1 = AOffptr + i2; Bp1 = BOffptr + j2;
00659 #ifdef __NO_BLAS__
00660     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00661     {
00662     *(Ap1 + i1) -= *(Bp1 + j1);
00663     }
00664 #else
00665     daxpy_(&Size,&dNegOne, Bp1,&strideB, Ap1, &strideA);
00666 #endif
00667     };
00668     break;
00669 
00670     case 3 :
00671     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00672     { Ap2 = AOffptr + i3; Bp2 = BOffptr + j3;
00673     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00674     { Ap1 = Ap2     + i2; Bp1 = Bp2     + j2;
00675 #ifdef __NO_BLAS__
00676     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00677     {
00678     *(Ap1 + i1) -= *(Bp1 + j1);
00679     }
00680 #else
00681     daxpy_(&Size,&dNegOne, Bp1,&strideB, Ap1, &strideA);
00682 #endif
00683     }};
00684     break;
00685 
00686     case 4 :
00687     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00688     { Ap3 = AOffptr + i4; Bp3 = BOffptr + j4;
00689     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00690     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00691     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00692     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00693 #ifdef __NO_BLAS__
00694     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00695     {
00696     *(Ap1 + i1) -= *(Bp1 + j1);
00697     }
00698 #else
00699     daxpy_(&Size,&dNegOne, Bp1,&strideB, Ap1, &strideA);
00700 #endif
00701     }}};
00702     break;
00703 
00704     case 5 :
00705     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00706     { Ap4 = AOffptr + i5; Bp4 = BOffptr + j5;
00707     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00708     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00709     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00710     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00711     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00712     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00713 #ifdef __NO_BLAS__
00714     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00715     {
00716     *(Ap1 + i1) -= *(Bp1 + j1);
00717     }
00718 #else
00719     daxpy_(&Size,&dNegOne, Bp1,&strideB, Ap1, &strideA);
00720 #endif
00721     }}}};
00722     break;
00723 
00724     case 6 :
00725     for(i6=0, j6 = 0; i6 < ACount[5]*AStride[5]; i6+=AStride[5], j6+=BStride[5])
00726     { Ap5 = AOffptr+ i6; Bp5 = BOffptr + j6;
00727     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00728     { Ap4 = Ap5 + i5; Bp4 = Bp5 + j5;
00729     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00730     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00731     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00732     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00733     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00734     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00735 #ifdef __NO_BLAS__
00736     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00737     {
00738     *(Ap1 + i1) -= *(Bp1 + j1);
00739     }
00740 #else
00741     daxpy_(&Size,&dNegOne, Bp1,&strideB, Ap1, &strideA);
00742 #endif
00743     }}}}};
00744     break;
00745 
00746     case 7 :
00747     for(i7=0, j7 = 0; i7 < ACount[6]*AStride[6]; i7+=AStride[6], j7+=BStride[6])
00748     { Ap6 = AOffptr + i7; Bp6 = BOffptr + j7;
00749     for(i6=0, j6 = 0; i6 < ACount[5]*AStride[5]; i6+=AStride[5], j6+=BStride[5])
00750     { Ap5 = Ap6 + i6; Bp5 = Bp6 + j6;
00751     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00752     { Ap4 = Ap5 + i5; Bp4 = Bp5 + j5;
00753     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00754     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00755     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00756     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00757     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00758     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00759 #ifdef __NO_BLAS__
00760     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00761     {
00762     *(Ap1 + i1) -= *(Bp1 + j1);
00763     }
00764 #else
00765     daxpy_(&Size,&dNegOne, Bp1,&strideB, Ap1, &strideA);
00766 #endif
00767     }}}}}};
00768     break;
00769 
00770     }
00771 }
00772 
00773 
00774 }
00775 
00776 
00777 void  CAMbinaryEngine::doubleAtimesEqualB(CAMstructureBase &Astructure, CAMdataHandler &Adata,
00778 const CAMstructureBase &Bstructure, const CAMdataHandler &Bdata)
00779 {
00780     double* AdataP = (double*)Adata.getDataPointer();
00781     double* BdataP = (double*)Bdata.getDataPointer();
00782 
00783     CAMdataHandler Btemporary;
00784     if(AdataP == BdataP)
00785     {
00786     Btemporary.initialize(Bdata);
00787     BdataP = (double*)Btemporary.getDataPointer();
00788     }
00789 
00790     if((Astructure.isSubset() == 0)&&(Bstructure.isSubset() == 0))
00791     {
00792     double* aptr; double* bptr;
00793     for(aptr = AdataP, bptr = BdataP;
00794        aptr < AdataP + Adata.getDataSize();
00795        aptr++, bptr++) { *aptr *= *bptr; };
00796     }
00797     else
00798     {
00799 //
00800 //  Get Normalized Loops
00801 //
00802     long AloopDimension;
00803     long AOffset;
00804     MVAlongBase ACount;
00805     MVAlongBase AStride;
00806 
00807     long BloopDimension;
00808     long BOffset;
00809     MVAlongBase BCount;
00810     MVAlongBase BStride;
00811 
00812     Astructure.getNormalizedLoops(AloopDimension,AOffset, ACount, AStride);
00813     Bstructure.getNormalizedLoops(BloopDimension,BOffset, BCount, BStride);
00814 
00815     register long i1, i2, i3, i4, i5, i6, i7;
00816     register long j1, j2, j3, j4, j5, j6, j7;
00817     double* AOffptr = AdataP + AOffset;
00818     double* BOffptr = BdataP + BOffset;
00819 
00820     register double* Ap1; register double* Bp1;
00821     register double* Ap2; register double* Bp2;
00822     register double* Ap3; register double* Bp3;
00823     register double* Ap4; register double* Bp4;
00824     register double* Ap5; register double* Bp5;
00825     register double* Ap6; register double* Bp6;
00826 
00827     switch(AloopDimension)
00828     {
00829     case 1 :
00830 
00831     for(i1=0, j1=0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00832     {
00833     *(AOffptr + i1) *= *(BOffptr + j1);
00834     };
00835 
00836     break;
00837 
00838     case 2 :
00839     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00840     { Ap1 = AOffptr + i2; Bp1 = BOffptr + j2;
00841     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00842     {
00843     *(Ap1 + i1) *= *(Bp1 + j1);
00844     }
00845     };
00846     break;
00847 
00848     case 3 :
00849     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00850     { Ap2 = AOffptr + i3; Bp2 = BOffptr + j3;
00851     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00852     { Ap1 = Ap2     + i2; Bp1 = Bp2     + j2;
00853     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00854     {
00855     *(Ap1 + i1) *= *(Bp1 + j1);
00856     }
00857     }};
00858     break;
00859 
00860     case 4 :
00861     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00862     { Ap3 = AOffptr + i4; Bp3 = BOffptr + j4;
00863     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00864     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00865     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00866     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00867     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00868     {
00869     *(Ap1 + i1) *= *(Bp1 + j1);
00870     }
00871     }}};
00872     break;
00873 
00874     case 5 :
00875     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00876     { Ap4 = AOffptr + i5; Bp4 = BOffptr + j5;
00877     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00878     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00879     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00880     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00881     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00882     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00883     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00884     {
00885     *(Ap1 + i1) *= *(Bp1 + j1);
00886     }
00887     }}}};
00888     break;
00889 
00890     case 6 :
00891 
00892     for(i6=0, j6 = 0; i6 < ACount[5]*AStride[5]; i6+=AStride[5], j6+=BStride[5])
00893     { Ap5 = AOffptr+ i6; Bp5 = BOffptr + j6;
00894     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00895     { Ap4 = Ap5 + i5; Bp4 = Bp5 + j5;
00896     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00897     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00898     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00899     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00900     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00901     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00902     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00903     {
00904     *(Ap1 + i1) *= *(Bp1 + j1);
00905     }
00906     }}}}};
00907     break;
00908 
00909     case 7 :
00910     for(i7=0, j7 = 0; i7 < ACount[6]*AStride[6]; i7+=AStride[6], j7+=BStride[6])
00911     { Ap6 = AOffptr + i7; Bp6 = BOffptr + j7;
00912     for(i6=0, j6 = 0; i6 < ACount[5]*AStride[5]; i6+=AStride[5], j6+=BStride[5])
00913     { Ap5 = Ap6 + i6; Bp5 = Bp6 + j6;
00914     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
00915     { Ap4 = Ap5 + i5; Bp4 = Bp5 + j5;
00916     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
00917     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
00918     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
00919     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
00920     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00921     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
00922     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00923     {
00924     *(Ap1 + i1) *= *(Bp1 + j1);
00925     }
00926     }}}}}};
00927     break;
00928 
00929     }
00930 }
00931 }
00932 
00933 
00934 void  CAMbinaryEngine::doubleAdivideEqualB(CAMstructureBase &Astructure, CAMdataHandler &Adata,
00935 const CAMstructureBase &Bstructure, const CAMdataHandler &Bdata)
00936 {
00937     double* AdataP = (double*)Adata.getDataPointer();
00938     double* BdataP = (double*)Bdata.getDataPointer();
00939 
00940     CAMdataHandler Btemporary;
00941     if(AdataP == BdataP)
00942     {
00943     Btemporary.initialize(Bdata);
00944     BdataP = (double*)Btemporary.getDataPointer();
00945     }
00946 
00947     if((Astructure.isSubset() == 0)&&(Bstructure.isSubset() == 0))
00948     {
00949     double* aptr; double* bptr;
00950     for(aptr = AdataP, bptr = BdataP;
00951        aptr < AdataP + Adata.getDataSize();
00952        aptr++, bptr++) { *aptr /= *bptr; };
00953     }
00954     else
00955     {
00956 //
00957 //  Get Normalized Loops
00958 //
00959     long AloopDimension;
00960     long AOffset;
00961     MVAlongBase ACount;
00962     MVAlongBase AStride;
00963 
00964     long BloopDimension;
00965     long BOffset;
00966     MVAlongBase BCount;
00967     MVAlongBase BStride;
00968 
00969     Astructure.getNormalizedLoops(AloopDimension,AOffset, ACount, AStride);
00970     Bstructure.getNormalizedLoops(BloopDimension,BOffset, BCount, BStride);
00971 
00972     register long i1, i2, i3, i4, i5, i6, i7;
00973     register long j1, j2, j3, j4, j5, j6, j7;
00974     double* AOffptr = AdataP + AOffset;
00975     double* BOffptr = BdataP + BOffset;
00976 
00977     register double* Ap1; register double* Bp1;
00978     register double* Ap2; register double* Bp2;
00979     register double* Ap3; register double* Bp3;
00980     register double* Ap4; register double* Bp4;
00981     register double* Ap5; register double* Bp5;
00982     register double* Ap6; register double* Bp6;
00983     switch(AloopDimension)
00984     {
00985     case 1 :
00986 
00987     for(i1=0, j1=0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00988     {
00989     *(AOffptr + i1) /= *(BOffptr + j1);
00990     };
00991 
00992     break;
00993 
00994     case 2 :
00995     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
00996     { Ap1 = AOffptr + i2; Bp1 = BOffptr + j2;
00997     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
00998     {
00999     *(Ap1 + i1) /= *(Bp1 + j1);
01000     }
01001     };
01002     break;
01003 
01004     case 3 :
01005     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
01006     { Ap2 = AOffptr + i3; Bp2 = BOffptr + j3;
01007     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
01008     { Ap1 = Ap2     + i2; Bp1 = Bp2     + j2;
01009     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
01010     {
01011     *(Ap1 + i1) /= *(Bp1 + j1);
01012     }
01013     }};
01014     break;
01015 
01016     case 4 :
01017     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
01018     { Ap3 = AOffptr + i4; Bp3 = BOffptr + j4;
01019     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
01020     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
01021     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
01022     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
01023     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
01024     {
01025     *(Ap1 + i1) /= *(Bp1 + j1);
01026     }
01027     }}};
01028     break;
01029 
01030     case 5 :
01031     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
01032     { Ap4 = AOffptr + i5; Bp4 = BOffptr + j5;
01033     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
01034     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
01035     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
01036     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
01037     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
01038     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
01039     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
01040     {
01041     *(Ap1 + i1) /= *(Bp1 + j1);
01042     }
01043     }}}};
01044     break;
01045 
01046     case 6 :
01047     for(i6=0, j6 = 0; i6 < ACount[5]*AStride[5]; i6+=AStride[5], j6+=BStride[5])
01048     for(i6=0, j6 = 0; i6 < ACount[5]*AStride[5]; i6+=AStride[5], j6+=BStride[5])
01049     { Ap5 = AOffptr+ i6; Bp5 = BOffptr + j6;
01050     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
01051     { Ap4 = Ap5 + i5; Bp4 = Bp5 + j5;
01052     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
01053     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
01054     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
01055     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
01056     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
01057     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
01058     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
01059     {
01060     *(Ap1 + i1) /= *(Bp1 + j1);
01061     }
01062     }}}}};
01063     break;
01064 
01065     case 7 :
01066     for(i7=0, j7 = 0; i7 < ACount[6]*AStride[6]; i7+=AStride[6], j7+=BStride[6])
01067     { Ap6 = AOffptr + i7; Bp6 = BOffptr + j7;
01068     for(i6=0, j6 = 0; i6 < ACount[5]*AStride[5]; i6+=AStride[5], j6+=BStride[5])
01069     { Ap5 = Ap6 + i6; Bp5 = Bp6 + j6;
01070     for(i5=0, j5 = 0; i5 < ACount[4]*AStride[4]; i5+=AStride[4], j5+=BStride[4])
01071     { Ap4 = Ap5 + i5; Bp4 = Bp5 + j5;
01072     for(i4=0, j4 = 0; i4 < ACount[3]*AStride[3]; i4+=AStride[3], j4+=BStride[3])
01073     { Ap3 = Ap4 + i4; Bp3 = Bp4 + j4;
01074     for(i3=0, j3 = 0; i3 < ACount[2]*AStride[2]; i3+=AStride[2], j3+=BStride[2])
01075     { Ap2 = Ap3 + i3; Bp2 = Bp3 + j3;
01076     for(i2=0, j2 = 0; i2 < ACount[1]*AStride[1]; i2+=AStride[1], j2+=BStride[1])
01077     { Ap1 = Ap2 + i2; Bp1 = Bp2 + j2;
01078     for(i1=0, j1 = 0; i1 < ACount[0]*AStride[0]; i1+=AStride[0], j1+=BStride[0])
01079     {
01080     *(Ap1 + i1) /= *(Bp1 + j1);
01081     }
01082     }}}}}};
01083     break;
01084 
01085     }
01086 }
01087 }
01088 
01089 
01090 
01091 
01092 void  CAMbinaryEngine::doubleCequalAplusB(const CAMstructureBase &Astructure, const CAMdataHandler &Adata,
01093 const CAMstructureBase &Bstructure, const CAMdataHandler &Bdata,
01094 CAMstructureBase &Cstructure, CAMdataHandler &Cdata)
01095 {
01096     CAMbinaryEngine::doubleAequalToB(Cstructure, Cdata, Astructure, Adata);
01097     CAMbinaryEngine::doubleAplusEqualB(Cstructure, Cdata, Bstructure, Bdata);
01098 }
01099 
01100 void  CAMbinaryEngine::doubleCequalAminusB(const CAMstructureBase &Astructure, const CAMdataHandler &Adata,
01101 const CAMstructureBase &Bstructure, const CAMdataHandler &Bdata,
01102 CAMstructureBase &Cstructure, CAMdataHandler &Cdata)
01103 {
01104     CAMbinaryEngine::doubleAequalToB(Cstructure, Cdata, Astructure, Adata);
01105     CAMbinaryEngine::doubleAminusEqualB(Cstructure, Cdata, Bstructure, Bdata);
01106 }
01107 
01108 void  CAMbinaryEngine::doubleCequalAtimesB(const CAMstructureBase &Astructure, const CAMdataHandler &Adata,
01109 const CAMstructureBase &Bstructure, const CAMdataHandler &Bdata,
01110 CAMstructureBase &Cstructure, CAMdataHandler &Cdata)
01111 {
01112     CAMbinaryEngine::doubleAequalToB(Cstructure, Cdata, Astructure, Adata);
01113     CAMbinaryEngine::doubleAtimesEqualB(Cstructure, Cdata, Bstructure, Bdata);
01114 }
01115 
01116 void  CAMbinaryEngine::doubleCequalAdivideB(const CAMstructureBase &Astructure, const CAMdataHandler &Adata,
01117 const CAMstructureBase &Bstructure, const CAMdataHandler &Bdata,
01118 CAMstructureBase &Cstructure, CAMdataHandler &Cdata)
01119 {
01120     CAMbinaryEngine::doubleAequalToB(Cstructure, Cdata, Astructure, Adata);
01121     CAMbinaryEngine::doubleAdivideEqualB(Cstructure, Cdata, Bstructure, Bdata);
01122 }
01123 
01124   

Generated on Wed Aug 6 12:58:45 2003 for Open-Sessame Framework by doxygen1.3