Exemple #1
0
double cblas_dsdot(const int N, const float *X, const int incX,
                   const float *Y, const int incY)
{
   if (N > 0)
   {
      if (incX < 0)
      {
         if (incY < 0) return(ATL_dsdot(N, X, -incX, Y, -incY));
         else return(ATL_dsdot(N, X+(1-N)*incX, incX, Y, incY));
      }
      else if (incY < 0) return(ATL_dsdot(N, X+(N-1)*incX, -incX, Y, -incY));
      else return(ATL_dsdot(N, X, incX, Y, incY));
   }
   else return(0.0);
}
void ATL_F77wrap_dsdot
(
   F77_INTEGER                * N,
   float                      * X,
   F77_INTEGER                * INCX,
   float                      * Y,
   F77_INTEGER                * INCY,
   double                     * DOT
)
{
/*
 * Purpose
 * =======
 *
 * ATL_F77wrap_dsdot  computes  the dot product x^T * y of two n-vectors
 * x and y.  The  result is  internally computed using  double precision
 * arithmetic.
 *
 * 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_dsdot( *N, X, -(*INCX), Y, -(*INCY) );
      }
      else
      {
         *DOT =  ATL_dsdot( *N, V1N( N, X, INCX ), *INCX, Y, *INCY );
      }
   }
   else if( (*INCY) < 0 )
   {
      *DOT = ATL_dsdot( *N, VN1( N, X, INCX ), -(*INCX), Y, -(*INCY) );
   }
   else
   {
      *DOT = ATL_dsdot( *N, X, *INCX, Y, *INCY );
   }
/*
 * End of ATL_F77wrap_dsdot
 */
}