Ejemplo n.º 1
0
void ATL_crefgemmNT
(
   const int                  M,
   const int                  N,
   const int                  K,
   const float                * ALPHA,
   const float                * A,
   const int                  LDA,
   const float                * B,
   const int                  LDB,
   const float                * BETA,
   float                      * C,
   const int                  LDC
)
{
/*
 * .. Local Variables ..
 */
   register float             t0_i, t0_r;
   int                        i, iail, ibj, ibjl, icij, j, jal, jcj, l,
                              lda2 = ( LDA << 1 ), ldb2 = ( LDB << 1 ),
                              ldc2 = ( LDC << 1 );
/* ..
 * .. Executable Statements ..
 *
 */
   for( j = 0, ibj = 0, jcj = 0; j < N; j++, ibj += 2, jcj += ldc2 )
   {
      Mcgescal( M, 1, BETA, C+jcj, LDC );
      for( l = 0, jal = 0, ibjl = ibj; l < K; l++, jal += lda2, ibjl += ldb2 )
      {
         Mmul( ALPHA[0], ALPHA[1], B[ibjl],  B[ibjl+1], t0_r, t0_i );
         for( i = 0, iail = jal, icij = jcj; i < M; i++, iail += 2, icij += 2 )
         { Mmla( A[iail], A[iail+1], t0_r, t0_i, C[icij], C[icij+1] ); }
      }
   }
/*
 * End of ATL_crefgemmNT
 */
}
Ejemplo n.º 2
0
void ATL_crefsymm
(
   const enum ATLAS_SIDE      SIDE,
   const enum ATLAS_UPLO      UPLO,
   const int                  M,
   const int                  N,
   const float                * ALPHA,
   const float                * A,
   const int                  LDA,
   const float                * B,
   const int                  LDB,
   const float                * BETA,
   float                      * C,
   const int                  LDC
)
{
/*
 * Purpose
 * =======
 *
 * ATL_crefsymm  performs one of the matrix-matrix operations
 *
 *    C := alpha * A * B + beta * C,
 *
 * or
 *
 *    C := alpha * B * A + beta * C,
 *
 * where alpha and beta are scalars,  A is a symmetric matrix and B and
 * C are m by n matrices.
 *
 * Arguments
 * =========
 *
 * SIDE    (input)                       const enum ATLAS_SIDE
 *         On entry,  SIDE  specifies  whether the  symmetric  matrix  A
 *         appears  on  the left or right in the operation as follows:
 *
 *            SIDE = AtlasLeft     C := alpha * A * B + beta * C,
 *
 *            SIDE = AtlasRight    C := alpha * B * A + beta * C.
 *
 *         Unchanged on exit.
 *
 * UPLO    (input)                       const enum ATLAS_UPLO
 *         On entry, UPLO  specifies whether the upper or lower triangu-
 *         lar part of the array A is to be referenced as follows:
 *
 *             UPLO = AtlasUpper   Only the upper triangular part of A
 *                                 is to be referenced.
 *
 *             UPLO = AtlasLower   Only the lower triangular part of A
 *                                 is to be referenced.
 *
 *         Unchanged on exit.
 *
 * M       (input)                       const int
 *         On entry,  M  specifies  the number  of rows of the matrix C.
 *         M  must be at least zero. Unchanged on exit.
 *
 * N       (input)                       const int
 *         On entry, N  specifies the number of columns of the matrix C.
 *         N must be at least zero. Unchanged on exit.
 *
 * ALPHA   (input)                       const float *
 *         On entry, ALPHA specifies the scalar alpha.   When  ALPHA  is
 *         supplied  as  zero  then the elements of the matrices A and B
 *         need not be set on input.
 *
 * A       (input)                       const float *
 *         On entry,  A  points  to an array of size equal to or greater
 *         than   LDA * ka * sizeof( float [2] ),  where ka  is  m  when
 *         SIDE = AtlasLeft   and is  n  otherwise.  Before  entry  with
 *         SIDE = AtlasLeft, the  m by m  part of the  array A must con-
 *         tain the symmetric matrix, such that when  UPLO = AtlasUpper,
 *         the leading m by m upper triangular part of the array A  must
 *         contain the upper triangular part of the symmetric matrix and
 *         the  strictly lower triangular part of  A  is not referenced,
 *         and when  UPLO = AtlasLower, the  leading m by m lower trian-
 *         gular part of the array A must contain the  lower  triangular
 *         part of the symmetric matrix and the  strictly upper triangu-
 *         lar part of  A  is not referenced.
 *         Before  entry  with  SIDE = AtlasRight,  the  n by n  part of
 *         the  array  A  must contain the  symmetric matrix,  such that
 *         when  UPLO = AtlasUpper, the  leading n by n upper triangular
 *         part of the array  A  must  contain the upper triangular part
 *         of the  symmetric matrix  and the  strictly  lower triangular
 *         part of  A  is not  referenced,  and when  UPLO = AtlasLower,
 *         the leading  n by n  lower  triangular part  of the  array  A
 *         must  contain  the  lower  triangular part  of the  symmetric
 *         matrix and the  strictly  upper triangular part of  A  is not
 *         referenced. Unchanged on exit.
 *
 * LDA     (input)                       const int
 *         On entry, LDA  specifies the leading dimension of A as decla-
 *         red  in  the  calling  (sub) program.  LDA  must be  at least
 *         MAX( 1, m ) when SIDE = AtlasLeft, and MAX( 1, n ) otherwise.
 *         Unchanged on exit.
 *
 * B       (input)                       const float *
 *         On entry,  B  points  to an array of size equal to or greater
 *         than   LDB * n * sizeof( float [2] ).  Before entry, the lea-
 *         ding m by n  part of the array  B  must contain the matrix B.
 *         Unchanged on exit.
 *
 * LDB     (input)                       const int
 *         On entry, LDB  specifies the leading dimension of B as decla-
 *         red  in  the  calling  (sub) program.  LDB  must be  at least
 *         MAX( 1, m ). wise. Unchanged on exit.
 *
 * BETA    (input)                       const float *
 *         On entry,  BETA  specifies the scalar  beta.   When  BETA  is
 *         supplied  as  zero  then  the  elements of the matrix C  need
 *         not be set on input. Unchanged on exit.
 *
 * C       (input/output)                float *
 *         On entry,  C  points  to an array of size equal to or greater
 *         than   LDC * n * sizeof( float [2] ).  Before entry, the lea-
 *         ding m by n part of the array  C  must contain the matrix  C,
 *         except when beta is zero,  in which case C need not be set on
 *         entry.  On exit, the array C is overwritten by the m by n up-
 *         dated matrix.
 *
 * LDC     (input)                       const int
 *         On entry, LDC  specifies the leading dimension of A as decla-
 *         red  in  the  calling  (sub) program.  LDC  must be  at least
 *         MAX( 1, m ). Unchanged on exit.
 *
 * ---------------------------------------------------------------------
 */
/* ..
 * .. Executable Statements ..
 *
 */
   if( ( M == 0 ) || ( N == 0 ) || ( Mszero( ALPHA[0], ALPHA[1] ) &&
                                     Msone ( BETA [0], BETA [1] ) ) ) return;

   if( Mszero( ALPHA[0], ALPHA[1] ) )
   { Mcgescal( M, N, BETA, C, LDC ); return; }

   if( SIDE == AtlasLeft )
   {
      if( UPLO == AtlasUpper )
      { ATL_crefsymmLU( M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC ); }
      else
      { ATL_crefsymmLL( M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC ); }
   }
   else
   {
      if( UPLO == AtlasUpper )
      { ATL_crefsymmRU( M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC ); }
      else
      { ATL_crefsymmRL( M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC ); }
   }
/*
 * End of ATL_crefsymm
 */
}