Esempio n. 1
0
float cblas_sdsdot(const int N, const float alpha, const float *X,
                   const int incX, const float *Y, const int incY)
{
   if (N > 0)
   {
      if (incX < 0)
      {
         if (incY < 0) return(ATL_sdsdot(N, alpha, X, -incX, Y, -incY));
         else return(ATL_sdsdot(N, alpha, X+(1-N)*incX, incX, Y, incY));
      }
      else if (incY < 0)
         return(ATL_sdsdot(N, alpha, X+(N-1)*incX, -incX, Y, -incY));
      else return(ATL_sdsdot(N, alpha, X, incX, Y, incY));
   }
   else return(0.0f);
}
void ATL_F77wrap_sdsdot
(
   F77_INTEGER                * N,
   float                      * B,
   float                      * X,
   F77_INTEGER                * INCX,
   float                      * Y,
   F77_INTEGER                * INCY,
   float                      * DOT
)
{
/*
 * Purpose
 * =======
 *
 * ATL_F77wrap_sdsdot computes the dot product b + x^T * y of two n vec-
 * tors x and y.  The result is internally computed using  double preci-
 * sion arithmetic and casted to a  single precision  scalar just before
 * being returned.
 *
 * Notes
 * =====
 *
 * This routine is an internal wrapper function written in  C  called by
 * the corresponding Fortran 77 user callable subroutine.  It calls  the
 * appropriate ATLAS routine performing the actual computation.
 *
 * This wrapper layer resolves the following portability issues:
 *
 *    - the routines' name sheme translation imposed by the  Fortran / C
 *      compilers of your target computer,
 *    - the translation of Fortran characters into the ATLAS  correspon-
 *      ding C enumerated type (in cooperation with the Fortan user cal-
 *      lable subroutine),
 *    - the translation of Fortran integers into the proper C correspon-
 *      ding native type;
 *
 * and the following ease-of-programming issue:
 *
 *    - a pointer to the the first entry of vector operands (when appli-
 *      cable) is passed to the  ATLAS computational routine even if the
 *      corresponding input increment value is negative. This allows for
 *      a more natural expression in  C  of the computation performed by
 *      these ATLAS functions.
 *
 * ---------------------------------------------------------------------
 */
/* ..
 * .. Executable Statements ..
 *
 */
   if( (*INCX) < 0 )
   {
      if( (*INCY) < 0 )
      {
         *DOT =  ATL_sdsdot( *N, *B, X, -(*INCX), Y, -(*INCY) );
      }
      else
      {
         *DOT =  ATL_sdsdot( *N, *B, V1N( N, X, INCX ), *INCX, Y, *INCY );
      }
   }
   else if( (*INCY) < 0 )
   {
      *DOT = ATL_sdsdot( *N, *B, VN1( N, X, INCX ), -(*INCX), Y, -(*INCY) );
   }
   else
   {
      *DOT = ATL_sdsdot( *N, *B, X, *INCX, Y, *INCY );
   }
/*
 * End of ATL_F77wrap_sdsdot
 */
}