예제 #1
0
void ATL_zrefhpmvL
(
    const int                  N,
    const double               * ALPHA,
    const double               * A,
    const int                  LDA,
    const double               * X,
    const int                  INCX,
    const double               * BETA,
    double                     * Y,
    const int                  INCY
)
{
    /*
     * Purpose
     * =======
     *
     * ATL_zrefhpmvL( ... )
     *
     * <=>
     *
     * ATL_zrefhpmv( AtlasLower, ... )
     *
     * See ATL_zrefhpmv for details.
     *
     * ---------------------------------------------------------------------
     */
    /*
     * .. Local Variables ..
     */
    register double            t0_i, t0_r, t1_i, t1_r;
    int                        i, iaij, ix, iy, j, jaj = 0, jx, jy,
                                                   lda2 = ( LDA << 1 ), incx2 = 2 * INCX,
                                                   incy2 = 2 * INCY;
    /* ..
     * .. Executable Statements ..
     *
     */
    Mzvscal( N, BETA, Y, INCY );

    for( j = 0, jx = 0, jy = 0; j < N; j++, jx += incx2, jy += incy2 )
    {
        Mmul( ALPHA[0], ALPHA[1], X[jx], X[jx+1], t0_r, t0_i );
        Mset( ATL_dZERO, ATL_dZERO, t1_r, t1_i );
        Mset( Y[jy] + A[jaj]*t0_r, Y[jy+1] + A[jaj]*t0_i, Y[jy], Y[jy+1] );
        for( i = j+1,    iaij  = jaj+2, ix  = jx+incx2, iy  = jy+incy2;
                i < N; i++, iaij += 2,     ix += incx2,    iy += incy2 )
        {
            Mmla( A[iaij],  A[iaij+1], t0_r, t0_i, Y[iy], Y[iy+1] );
            Mmla( A[iaij], -A[iaij+1], X[ix], X[ix+1], t1_r, t1_i );
        }
        Mmla( ALPHA[0], ALPHA[1], t1_r, t1_i, Y[jy], Y[jy+1] );
        jaj += lda2;
        lda2 -= 2;
    }
    /*
     * End of ATL_zrefhpmvL
     */
}
예제 #2
0
void ATL_zrefgbmvN
(
   const int                  M,
   const int                  N,
   const int                  KL,
   const int                  KU,
   const double               * ALPHA,
   const double               * A,
   const int                  LDA,
   const double               * X,
   const int                  INCX,
   const double               * BETA,
   double                     * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_zrefgbmvN( ... ) <=> ATL_zrefgbmv( AtlasNoTrans, ... )
 *
 * See ATL_zrefgbmv for details.
 *
 * ---------------------------------------------------------------------
 */
/*
 * .. Local Variables ..
 */
   register double            t0_i, t0_r;
   int                        i, i0, i1, iaij, iy, j, jaj, jx, k, kx=0, ky=0;
   int                        incx2 = 2 * INCX, incy2 = 2 * INCY,
                              lda2 = ( LDA << 1 );
/* ..
 * .. Executable Statements ..
 *
 */
   Mzvscal( M, BETA, Y, INCY );

   for( j = 0, jaj  = 0, jx  = kx; j < N; j++, jaj += lda2, jx += incx2 )
   {
      Mmul( ALPHA[0], ALPHA[1], X[jx], X[jx+1], t0_r, t0_i );
      k = KU - j; i0 = ( j - KU > 0 ? j - KU : 0 );
      i1   = ( M - 1 > j + KL ? j + KL : M - 1 );

      for( i = i0, iaij = ((k+i0) << 1)+jaj, iy = ky; i <= i1;
           i++, iaij += 2, iy += incy2 )
      { Mmla( A[iaij],  A[iaij+1], t0_r, t0_i, Y[iy], Y[iy+1] ); }
      if( j >= KU ) ky += incy2;
   }
/*
 * End of ATL_zrefgbmvN
 */
}
예제 #3
0
void ATL_zrefsyrkUN
(
   const int                  N,
   const int                  K,
   const double               * ALPHA,
   const double               * A,
   const int                  LDA,
   const double               * BETA,
   double                     * C,
   const int                  LDC
)
{
/*
 * Purpose
 * =======
 *
 * ATL_zrefsyrkUN( ... )
 *
 * <=>
 *
 * ATL_zrefsyrk( AtlasUpper, AtlasNoTrans, ... )
 *
 * See ATL_zrefsyrk for details.
 *
 * ---------------------------------------------------------------------
 */
/*
 * .. Local Variables ..
 */
   register double            t0_i, t0_r;
   int                        i, iail, iaj, iajl, icij, j, jal, jcj, l,
                              lda2 = ( LDA << 1 ), ldc2 = ( LDC << 1 );
/* ..
 * .. Executable Statements ..
 *
 */
   for( j = 0, iaj = 0, jcj  = 0; j < N; j++, iaj += 2, jcj += ldc2 )
   {
      Mzvscal( j+1, BETA, C+jcj, 1 );

      for( l = 0, iajl = iaj, jal = 0; l < K; l++, iajl += lda2, jal += lda2 )
      {
         Mmul( ALPHA[0], ALPHA[1], A[iajl], A[iajl+1], t0_r, t0_i );
         for( i = 0, iail = jal, icij = jcj; i <= j; i++, iail += 2, icij += 2 )
         { Mmla( t0_r, t0_i, A[iail], A[iail+1], C[icij], C[icij+1] ); }
      }
   }
/*
 * End of ATL_zrefsyrkUN
 */
}
예제 #4
0
void ATL_zrefgemvN
(
   const int                  M,
   const int                  N,
   const double               * ALPHA,
   const double               * A,
   const int                  LDA,
   const double               * X,
   const int                  INCX,
   const double               * BETA,
   double                     * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_zrefgemvN( ... ) <=> ATL_zrefgemv( AtlasNoTrans, ... )
 *
 * See ATL_zrefgemv for details.
 *
 * ---------------------------------------------------------------------
 */
/*
 * .. Local Variables ..
 */
   register double            t0_i, t0_r;
   int                        i, iaij, iy, j, jaj, jx;
   int                        incx2 = 2 * INCX, incy2 = 2 * INCY,
                              lda2 = ( LDA << 1 );
/* ..
 * .. Executable Statements ..
 *
 */
   Mzvscal( M, BETA, Y, INCY );
   for( j = 0, jaj = 0, jx = 0; j < N; j++, jaj += lda2, jx += incx2 )
   {
      Mmul( ALPHA[0], ALPHA[1], X[jx], X[jx+1], t0_r, t0_i );
      for( i = 0, iaij = jaj, iy = 0; i < M; i++, iaij += 2, iy += incy2 )
      { Mmla( A[iaij],  A[iaij+1], t0_r, t0_i, Y[iy], Y[iy+1] ); }
   }
/*
 * End of ATL_zrefgemvN
 */
}
예제 #5
0
void ATL_zrefhpmv
(
   const enum ATLAS_UPLO      UPLO,
   const int                  N,
   const double               * ALPHA,
   const double               * A,
   const double               * X,
   const int                  INCX,
   const double               * BETA,
   double                     * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_zrefhpmv performs the matrix-vector operation
 *
 *    y := alpha * A * x + beta * y,
 *
 * where alpha and beta are scalars, x and y are n-element vectors and A
 * is an n by n Hermitian matrix, supplied in packed form.
 *
 * Arguments
 * =========
 *
 * UPLO    (input)                       const enum ATLAS_UPLO
 *         On entry, UPLO  specifies whether the upper or lower triangu-
 *         lar part of the matrix A is supplied in the packed array A
 *         as follows:
 *
 *             UPLO = AtlasUpper   The upper triangular part of A is
 *                                 supplied in A.
 *
 *             UPLO = AtlasLower   The lower triangular part of A is
 *                                 supplied in A.
 *
 *         Unchanged on exit.
 *
 * N       (input)                       const int
 *         On entry, N specifies the order of the matrix A. N must be at
 *         least zero. Unchanged on exit.
 *
 * ALPHA   (input)                       const double *
 *         On entry, ALPHA specifies the scalar alpha.   When  ALPHA  is
 *         supplied as zero then  A and X  need not be set on input. Un-
 *         changed on exit.
 *
 * A       (input)                       const double *
 *         On entry,  A  points  to an array of size equal to or greater
 *         than   (( n*(n+1) ) / 2) * sizeof( double[2] ).  Before entry
 *         with UPLO = AtlasUpper, the array  A  must contain  the upper
 *         triangular  part of the Hermitian matrix packed sequentially,
 *         column by column, so that A[ 0 ] contains a(0,0), A[ 1 ]  and
 *         A[ 2 ] contain a(0,1) and a(1,1) respectively, and so on.
 *         Before entry with UPLO = AtlasLower, the array A must contain
 *         the lower triangular  part of the Hermitian matrix packed se-
 *         quentially, column by column, so that A[ 0 ] contains a(0,0),
 *         A[ 1 ] and A[ 2 ] contain a(1,0) and a(2,0) respectively, and
 *         so on. Unchanged on exit.
 *         Note that the  imaginary parts  of the local entries  corres-
 *         ponding to the diagonal elements of A need not be set and as-
 *         sumed to be zero. Unchanged on exit.
 *
 * X       (input)                       const double *
 *         On entry,  X  points to the  first entry to be accessed of an
 *         incremented array of size equal to or greater than
 *            ( 1 + ( n - 1 ) * abs( INCX ) ) * sizeof( double[2] ),
 *         that contains the vector x. Unchanged on exit.
 *
 * INCX    (input)                       const int
 *         On entry, INCX specifies the increment for the elements of X.
 *         INCX must not be zero. Unchanged on exit.
 *
 * BETA    (input)                       const double *
 *         On entry,  BETA  specifies the scalar  beta.   When  BETA  is
 *         supplied as zero then Y  need not be set on input.  Unchanged
 *         on exit.
 *
 * Y       (input/output)                double *
 *         On entry,  Y  points to the  first entry to be accessed of an
 *         incremented array of size equal to or greater than
 *            ( 1 + ( n - 1 ) * abs( INCY ) ) * sizeof( double[2] ),
 *         that contains the vector y.  Before entry with BETA non-zero,
 *         the incremented array  Y  must contain the vector y. On exit,
 *         Y is overwritten by the updated vector y.
 *
 * INCY    (input)                       const int
 *         On entry, INCY specifies the increment for the elements of Y.
 *         INCY must not be zero. Unchanged on exit.
 *
 * ---------------------------------------------------------------------
 */
/* ..
 * .. Executable Statements ..
 *
 */
   if( ( N == 0 ) ||
       ( Mdzero( ALPHA[0], ALPHA[1] ) && Mdone( BETA[0], BETA[1] ) ) ) return;
   if( Mdzero( ALPHA[0], ALPHA[1] ) )
   { Mzvscal( N, BETA, Y, INCY ); return; }

   if( UPLO == AtlasUpper )
   {
      ATL_zrefhpmvU( N,    ALPHA, A, 1,   X, INCX, BETA, Y, INCY );
   }
   else
   {
      ATL_zrefhpmvL( N,    ALPHA, A, N,   X, INCX, BETA, Y, INCY );
   }
/*
 * End of ATL_zrefhpmv
 */
}
예제 #6
0
void ATL_zrefgbmv
(
   const enum ATLAS_TRANS     TRANS,
   const int                  M,
   const int                  N,
   const int                  KL,
   const int                  KU,
   const double               * ALPHA,
   const double               * A,
   const int                  LDA,
   const double               * X,
   const int                  INCX,
   const double               * BETA,
   double                     * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_zrefgbmv performs one of the matrix-vector operations
 *
 *    y := alpha * op( A ) * x + beta * y,
 *
 * where op( X ) is one of
 *
 *    op( X ) = X   or   op( X ) = conjg( X  )   or
 *
 *    op( X ) = X'  or   op( X ) = conjg( X' ).
 *
 * where  alpha and beta are scalars, x and y are vectors and op( A ) is
 * an m by n band matrix, with kl sub-diagonals and ku super-diagonals.
 *
 * Arguments
 * =========
 *
 * TRANS   (input)                       const enum ATLAS_TRANS
 *         On entry,  TRANS  specifies the  operation to be performed as
 *         follows:
 *
 *            TRANS = AtlasNoTrans    y := alpha*A *x + beta*y,
 *
 *            TRANS = AtlasConj       y := alpha*conjg( A  )*x + beta*y,
 *
 *            TRANS = AtlasTrans      y := alpha*A'*x + beta*y,
 *
 *            TRANS = AtlasConjTrans  y := alpha*conjg( A' )*x + beta*y.
 *
 *         Unchanged on exit.
 *
 * M       (input)                       const int
 *         On entry,  M  specifies  the number of rows of  the matrix  A
 *         when TRANS = AtlasNoTrans or TRANS = AtlasConj,  and the num-
 *         ber of columns of the matrix  A otherwise. M must be at least
 *         zero. Unchanged on exit.
 *
 * N       (input)                       const int
 *         On entry, N  specifies  the number of columns of the matrix A
 *         when TRANS = AtlasNoTrans or TRANS = AtlasConj,  and the num-
 *         ber of rows of the matrix A otherwise. N must be at least ze-
 *         ro. Unchanged on exit.
 *
 * KL      (input)                       const int
 *         On entry, KL specifies the number of sub-diagonals of the ma-
 *         trix A. KL must satisfy 0 <= KL. Unchanged on exit.
 *
 * KU      (input)                       const int
 *         On entry, KU specifies the number of  super-diagonals of  the
 *         matrix A. KU must satisfy  0 <= KU. Unchanged on exit.
 *
 * ALPHA   (input)                       const double *
 *         On entry, ALPHA specifies the scalar alpha.   When  ALPHA  is
 *         supplied as zero then  A and X  need not be set on input. Un-
 *         changed on exit.
 *
 * A       (input)                       const double *
 *         On entry,  A  points  to an array of size equal to or greater
 *         than   LDA * ka * sizeof( double[2] ),  where  ka is  n  when
 *         TRANS = AtlasNotrans or TRANS = AtlasConj, and  m  otherwise.
 *         Before entry, the  leading ( kl + ku + 1 ) by ka  part of the
 *         array  A  must contain the matrix of  coefficients,  supplied
 *         column by column,  with the leading diagonal of the matrix in
 *         row ku of the array, the first super-diagonal starting at po-
 *         sition 1 in row ku-1,  the first sub-diagonal starting at po-
 *         sition 0 in row ku+1, and so on. Elements in the array A that
 *         do not correspond to elements in the band matrix (such as the
 *         top left ku by ku triangle) are not referenced.  Unchanged on
 *         exit.
 *
 *         The  following  program segment will transfer a real band ma-
 *         trix from conventional full matrix storage to band storage:
 *
 *            for( j = 0; j < n; j++ )
 *            {
 *               k  = ku - j; i1 = ( m > j + kl + 1 ? j + kl + 1 : m );
 *               for( i = ( k < 0 ? -k : 0 ); i < i1; i++ )
 *               {
 *                  a[((k+i+j*LDA)<<1)+0] = real( matrix( i, j ) );
 *                  a[((k+i+j*LDA)<<1)+1] = imag( matrix( i, j ) );
 *               }
 *            }
 *
 * 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
 *         ( kl + ku + 1 ). Unchanged on exit.
 *
 * X       (input)                       const double *
 *         On entry,  X  points to the  first entry to be accessed of an
 *         incremented array of size equal to or greater than
 *            ( 1 + ( n - 1 ) * abs( INCX ) ) * sizeof( double[2] ),
 *         that contains the vector x. Unchanged on exit.
 *
 * INCX    (input)                       const int
 *         On entry, INCX specifies the increment for the elements of X.
 *         INCX must not be zero. Unchanged on exit.
 *
 * BETA    (input)                       const double *
 *         On entry,  BETA  specifies the scalar  beta.   When  BETA  is
 *         supplied as zero then Y  need not be set on input.  Unchanged
 *         on exit.
 *
 * Y       (input/output)                double *
 *         On entry,  Y  points to the  first entry to be accessed of an
 *         incremented array of size equal to or greater than
 *            ( 1 + ( m - 1 ) * abs( INCY ) ) * sizeof( double[2] ),
 *         that contains the vector y.  Before entry with BETA non-zero,
 *         the incremented array  Y  must contain the vector y. On exit,
 *         Y is overwritten by the updated vector y.
 *
 * INCY    (input)                       const int
 *         On entry, INCY specifies the increment for the elements of Y.
 *         INCY must not be zero. Unchanged on exit.
 *
 * ---------------------------------------------------------------------
 */
/* ..
 * .. Executable Statements ..
 *
 */
   if( ( M == 0 ) || ( N == 0 ) ||
       ( Mdzero( ALPHA[0], ALPHA[1] ) && Mdone( BETA[0], BETA[1] ) ) )
      return;

   if( Mdzero( ALPHA[0], ALPHA[1] ) )
   { Mzvscal( M, BETA, Y, INCY ); return; }

   if(      TRANS == AtlasNoTrans )
   {
      ATL_zrefgbmvN( M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY );
   }
   else if( TRANS == AtlasConj    )
   {
      ATL_zrefgbmvC( M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY );
   }
   else if( TRANS == AtlasTrans   )
   {
      ATL_zrefgbmvT( M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY );
   }
   else
   {
      ATL_zrefgbmvH( M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY );
   }
/*
 * End of ATL_zrefgbmv
 */
}
예제 #7
0
파일: ATL_zrefgemv.c 프로젝트: AIDman/Kaldi
void ATL_zrefgemv
(
   const enum ATLAS_TRANS     TRANS,
   const int                  M,
   const int                  N,
   const double               * ALPHA,
   const double               * A,
   const int                  LDA,
   const double               * X,
   const int                  INCX,
   const double               * BETA,
   double                     * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_zrefgemv performs one of the matrix-vector operations
 *
 *    y := alpha * op( A ) * x + beta * y,
 *
 * where op( X ) is one of
 *
 *    op( X ) = X   or   op( X ) = conjg( X  )   or
 *
 *    op( X ) = X'  or   op( X ) = conjg( X' ).
 *
 * where  alpha and beta are scalars, x and y are vectors and op( A ) is
 * an m by n matrix.
 *
 * Arguments
 * =========
 *
 * TRANS   (input)                       const enum ATLAS_TRANS
 *         On entry,  TRANS  specifies the  operation to be performed as
 *         follows:
 *
 *            TRANS = AtlasNoTrans    y := alpha*A *x + beta*y,
 *
 *            TRANS = AtlasConj       y := alpha*conjg( A  )*x + beta*y,
 *
 *            TRANS = AtlasTrans      y := alpha*A'*x + beta*y,
 *
 *            TRANS = AtlasConjTrans  y := alpha*conjg( A' )*x + beta*y.
 *
 *         Unchanged on exit.
 *
 * M       (input)                       const int
 *         On entry,  M  specifies  the number of rows of  the matrix  A
 *         when TRANS = AtlasNoTrans or TRANS = AtlasConj,  and the num-
 *         ber of columns of the matrix  A otherwise. M must be at least
 *         zero. Unchanged on exit.
 *
 * N       (input)                       const int
 *         On entry, N  specifies  the number of columns of the matrix A
 *         when TRANS = AtlasNoTrans or TRANS = AtlasConj,  and the num-
 *         ber of rows of the matrix A otherwise. N must be at least ze-
 *         ro. Unchanged on exit.
 *
 * ALPHA   (input)                       const double *
 *         On entry, ALPHA specifies the scalar alpha.   When  ALPHA  is
 *         supplied as zero then  A and X  need not be set on input. Un-
 *         changed on exit.
 *
 * A       (input)                       const double *
 *         On entry,  A  points  to an array of size equal to or greater
 *         than   LDA * ka * sizeof( double[2] ), where  ka  is  n  when
 *         TRANS = AtlasNotrans or TRANS = AtlasConj, and  m  otherwise.
 *         Before entry, when TRANS = AtlasNotrans or TRANS = AtlasConj,
 *         the leading m by n part of the array  A  must contain the ma-
 *         trix coefficients,  and otherwise the leading n by m  part of
 *         the array A  must contain the matrix coefficients.  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  TRANS = AtlasNotrans or TRANS = AtlasConj,
 *         and MAX( 1, n ) otherwise. Unchanged on exit.
 *
 * X       (input)                       const double *
 *         On entry,  X  points to the  first entry to be accessed of an
 *         incremented array of size equal to or greater than
 *            ( 1 + ( n - 1 ) * abs( INCX ) ) * sizeof( double[2] ),
 *         that contains the vector x. Unchanged on exit.
 *
 * INCX    (input)                       const int
 *         On entry, INCX specifies the increment for the elements of X.
 *         INCX must not be zero. Unchanged on exit.
 *
 * BETA    (input)                       const double *
 *         On entry,  BETA  specifies the scalar  beta.   When  BETA  is
 *         supplied as zero then Y  need not be set on input.  Unchanged
 *         on exit.
 *
 * Y       (input/output)                double *
 *         On entry,  Y  points to the  first entry to be accessed of an
 *         incremented array of size equal to or greater than
 *            ( 1 + ( m - 1 ) * abs( INCY ) ) * sizeof( double[2] ),
 *         that contains the vector y.  Before entry with BETA non-zero,
 *         the incremented array  Y  must contain the vector y. On exit,
 *         Y is overwritten by the updated vector y.
 *
 * INCY    (input)                       const int
 *         On entry, INCY specifies the increment for the elements of Y.
 *         INCY must not be zero. Unchanged on exit.
 *
 * ---------------------------------------------------------------------
 */
/* ..
 * .. Executable Statements ..
 *
 */
   if( ( M == 0 ) || ( N == 0 ) ||
       ( Mdzero( ALPHA[0], ALPHA[1] ) && Mdone( BETA[0], BETA[1] ) ) )
      return;

   if( Mdzero( ALPHA[0], ALPHA[1] ) )
   { Mzvscal( M, BETA, Y, INCY ); return; }

   if(      TRANS == AtlasNoTrans )
   { ATL_zrefgemvN( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); }
   else if( TRANS == AtlasConj    )
   { ATL_zrefgemvC( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); }
   else if( TRANS == AtlasTrans   )
   { ATL_zrefgemvT( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); }
   else
   { ATL_zrefgemvH( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); }
/*
 * End of ATL_zrefgemv
 */
}
예제 #8
0
void ATL_zrefhbmvU
(
   const int                  N,
   const int                  K,
   const double               * ALPHA,
   const double               * A,
   const int                  LDA,
   const double               * X,
   const int                  INCX,
   const double               * BETA,
   double                     * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_zrefhbmvU( ... )
 *
 * <=>
 *
 * ATL_zrefhbmv( AtlasUpper, ... )
 *
 * See ATL_zrefhbmv for details.
 *
 * ---------------------------------------------------------------------
 */
/*
 * .. Local Variables ..
 */
   register double            t0_i, t0_r, t1_i, t1_r;
   int                        i, i0, iaij, ix, iy, j, jaj, jx, jy, kx = 0,
                              ky = 0, l, incx2 = 2 * INCX, incy2 = 2 * INCY,
                              lda2 = ( LDA << 1 );
/* ..
 * .. Executable Statements ..
 *
 */
   Mzvscal( N, BETA, Y, INCY );

   for( j = 0,      jaj = 0,     jx  = kx,    jy  = ky;
        j < N; j++, jaj += lda2, jx += incx2, jy += incy2 )
   {
      Mmul( ALPHA[0], ALPHA[1], X[jx], X[jx+1], t0_r, t0_i );
      Mset( ATL_dZERO, ATL_dZERO, t1_r, t1_i );
      l = K - j; i0 = ( j - K > 0 ? j - K : 0 );

      for( i = i0,      iaij  = ((l+i0) << 1)+jaj, ix  = kx,    iy  = ky;
           i < j;  i++, iaij += 2,                 ix += incx2, iy += incy2 )
      {
         Mmla( A[iaij], A[iaij+1], t0_r, t0_i, Y[iy], Y[iy+1] );
         Mmla( A[iaij], -A[iaij+1], X[ix], X[ix+1], t1_r, t1_i );
      }
      Mset( Y[jy] + A[iaij]*t0_r, Y[jy+1] + A[iaij]*t0_i, Y[jy], Y[jy+1] );
      Mmla( ALPHA[0], ALPHA[1], t1_r, t1_i, Y[jy], Y[jy+1] );
      if( j >= K ) { kx += incx2; ky += incy2; }
   }
/*
 * End of ATL_zrefhbmvU
 */
}
예제 #9
0
파일: ATL_zrefhbmv.c 프로젝트: AIDman/Kaldi
void ATL_zrefhbmv
(
   const enum ATLAS_UPLO      UPLO,
   const int                  N,
   const int                  K,
   const double               * ALPHA,
   const double               * A,
   const int                  LDA,
   const double               * X,
   const int                  INCX,
   const double               * BETA,
   double                     * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_zrefhbmv performs the matrix-vector operation
 *
 *    y := alpha * A * x + beta * y,
 *
 * where alpha and beta are scalars, x and y are n-element vectors and A
 * is an n by n Hermitian band matrix, with k super-diagonals.
 *
 * Arguments
 * =========
 *
 * UPLO    (input)                       const enum ATLAS_UPLO
 *         On entry, UPLO  specifies whether the upper or lower triangu-
 *         lar part of the band matrix A is being supplied as follows:
 *
 *             UPLO = AtlasUpper   The upper triangular part of A is
 *                                 being supplied.
 *
 *             UPLO = AtlasLower   The lower triangular part of A is
 *                                 being supplied.
 *
 *         Unchanged on exit.
 *
 * N       (input)                       const int
 *         On entry, N specifies the order of the matrix A. N must be at
 *         least zero. Unchanged on exit.
 *
 * K       (input)                       const int
 *         On entry, K  specifies  the number of  super-diagonals of the
 *         matrix A. K must satisfy 0 <= K. Unchanged on exit.
 *
 * ALPHA   (input)                       const double *
 *         On entry, ALPHA specifies the scalar alpha.   When  ALPHA  is
 *         supplied as zero then  A and X  need not be set on input. Un-
 *         changed on exit.
 *
 * A       (input)                       const double *
 *         On entry,  A  points  to an array of size equal to or greater
 *         than   LDA * n * sizeof( double[2] ).    Before  entry   with
 *         UPLO = AtlasUpper, the leading ( k + 1 ) by n part of the ar-
 *         ray  A  must  contain  the  upper triangular band part of the
 *         Hermitian matrix, supplied column by column, with the leading
 *         diagonal  of the matrix in row  k of the array, the first su-
 *         per-diagonal starting  at position 1 in row k-1,  and  so on.
 *         The top left k by k triangle of the array  A  is not referen-
 *         ced. Unchanged on exit.
 *         The  following program segment will transfer the upper trian-
 *         gular part  of a Hermitian band matrix from conventional full
 *         matrix storage to band storage:
 *
 *            for( j = 0; j < n; j++ )
 *            {
 *               m  = k - j;
 *               for( i = ( m < 0 ? -m : 0 ); i < j; i++ )
 *               {
 *                  a[((m+i+j*LDA)<<1)+0] = real( matrix( i, j ) );
 *                  a[((m+i+j*LDA)<<1)+1] = imag( matrix( i, j ) );
 *               }
 *            }
 *
 *         Before entry with UPLO = AtlasLower, the leading ( k + 1 ) by
 *         n part of  the array A must contain the lower triangular band
 *         part of the Hermitian matrix, supplied column by column, with
 *         the leading diagonal of the matrix in row 0 of the array, the
 *         first sub-diagonal starting at position  0  in row  1, and so
 *         on.  The bottom right  k by k  triangle of the array A is not
 *         referenced. Unchanged on exit.
 *         The  following program segment will transfer the lower trian-
 *         gular part  of a Hermitian band matrix from conventional full
 *         matrix storage to band storage:
 *
 *            for( j = 0; j < n; j++ )
 *            {
 *               i1 = ( n > j + k + 1 ? j + k + 1 : n );
 *               for( i = j; i < i1; i++ )
 *               {
 *                  a[((i-j+j*LDA)<<1)+0] = real( matrix( i, j ) );
 *                  a[((i-j+j*LDA)<<1)+1] = imag( matrix( i, j ) );
 *               }
 *            }
 *
 *         Note that the  imaginary parts  of the local entries  corres-
 *         ponding to the diagonal elements of A need not be set and as-
 *         sumed to be zero. 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
 *         k + 1. Unchanged on exit.
 *
 * X       (input)                       const double *
 *         On entry,  X  points to the  first entry to be accessed of an
 *         incremented array of size equal to or greater than
 *            ( 1 + ( n - 1 ) * abs( INCX ) ) * sizeof( double[2] ),
 *         that contains the vector x. Unchanged on exit.
 *
 * INCX    (input)                       const int
 *         On entry, INCX specifies the increment for the elements of X.
 *         INCX must not be zero. Unchanged on exit.
 *
 * BETA    (input)                       const double *
 *         On entry,  BETA  specifies the scalar  beta.   When  BETA  is
 *         supplied as zero then Y  need not be set on input.  Unchanged
 *         on exit.
 *
 * Y       (input/output)                double *
 *         On entry,  Y  points to the  first entry to be accessed of an
 *         incremented array of size equal to or greater than
 *            ( 1 + ( n - 1 ) * abs( INCY ) ) * sizeof( double[2] ),
 *         that contains the vector y.  Before entry with BETA non-zero,
 *         the incremented array  Y  must contain the vector y. On exit,
 *         Y is overwritten by the updated vector y.
 *
 * INCY    (input)                       const int
 *         On entry, INCY specifies the increment for the elements of Y.
 *         INCY must not be zero. Unchanged on exit.
 *
 * ---------------------------------------------------------------------
 */
/* ..
 * .. Executable Statements ..
 *
 */
   if( ( N == 0 ) ||
       ( Mdzero( ALPHA[0], ALPHA[1] ) && Mdone( BETA[0], BETA[1] ) ) ) return;
   if( Mdzero( ALPHA[0], ALPHA[1] ) )
   { Mzvscal( N, BETA, Y, INCY ); return; }

   if( UPLO == AtlasUpper )
   {
      ATL_zrefhbmvU( N, K, ALPHA, A, LDA, X, INCX, BETA, Y, INCY );
   }
   else
   {
      ATL_zrefhbmvL( N, K, ALPHA, A, LDA, X, INCX, BETA, Y, INCY );
   }
/*
 * End of ATL_zrefhbmv
 */
}
예제 #10
0
void ATL_zrefhemv
(
   const enum ATLAS_UPLO      UPLO,
   const int                  N,
   const double               * ALPHA,
   const double               * A,
   const int                  LDA,
   const double               * X,
   const int                  INCX,
   const double               * BETA,
   double                     * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_zrefhemv performs the matrix-vector operation
 *
 *    y := alpha * A * x + beta * y,
 *
 * where alpha and beta are scalars, x and y are n-element vectors and A
 * is an n by n Hermitian matrix.
 *
 * Arguments
 * =========
 *
 * 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.
 *
 * N       (input)                       const int
 *         On entry, N specifies the order of the matrix A. N must be at
 *         least zero. Unchanged on exit.
 *
 * ALPHA   (input)                       const double *
 *         On entry, ALPHA specifies the scalar alpha.   When  ALPHA  is
 *         supplied as zero then  A and X  need not be set on input. Un-
 *         changed on exit.
 *
 * A       (input)                       const double *
 *         On entry,  A  points  to an array of size equal to or greater
 *         than   LDA * n * sizeof( double[2] ).   Before   entry   with
 *         UPLO = AtlasUpper, the leading  n by n  upper triangular part
 *         of the array  A must contain the upper triangular part of the
 *         Hermitian matrix  and  the strictly  lower triangular part of
 *         A is not referenced. Before entry with UPLO = AtlasLower, the
 *         leading  n by n  lower  triangular part of the array  A  must
 *         contain the lower triangular part of the Hermitian matrix and
 *         the  strictly upper triangular part of  A  is not referenced.
 *         Unchanged on exit.
 *         Note that the  imaginary parts  of the local entries  corres-
 *         ponding to the diagonal elements of A need not be set and as-
 *         sumed to be zero.
 *
 * 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, n ). Unchanged on exit.
 *
 * X       (input)                       const double *
 *         On entry,  X  points to the  first entry to be accessed of an
 *         incremented array of size equal to or greater than
 *            ( 1 + ( n - 1 ) * abs( INCX ) ) * sizeof( double[2] ),
 *         that contains the vector x. Unchanged on exit.
 *
 * INCX    (input)                       const int
 *         On entry, INCX specifies the increment for the elements of X.
 *         INCX must not be zero. Unchanged on exit.
 *
 * BETA    (input)                       const double *
 *         On entry,  BETA  specifies the scalar  beta.   When  BETA  is
 *         supplied as zero then Y  need not be set on input.  Unchanged
 *         on exit.
 *
 * Y       (input/output)                double *
 *         On entry,  Y  points to the  first entry to be accessed of an
 *         incremented array of size equal to or greater than
 *            ( 1 + ( n - 1 ) * abs( INCY ) ) * sizeof( double[2] ),
 *         that contains the vector y.  Before entry with BETA non-zero,
 *         the incremented array  Y  must contain the vector y. On exit,
 *         Y is overwritten by the updated vector y.
 *
 * INCY    (input)                       const int
 *         On entry, INCY specifies the increment for the elements of Y.
 *         INCY must not be zero. Unchanged on exit.
 *
 * ---------------------------------------------------------------------
 */
/* ..
 * .. Executable Statements ..
 *
 */
   if( ( N == 0 ) ||
       ( Mdzero( ALPHA[0], ALPHA[1] ) && Mdone( BETA[0], BETA[1] ) ) ) return;
   if( Mdzero( ALPHA[0], ALPHA[1] ) )
   { Mzvscal( N, BETA, Y, INCY ); return; }

   if( UPLO == AtlasUpper )
   {
      ATL_zrefhemvU( N,    ALPHA, A, LDA, X, INCX, BETA, Y, INCY );
   }
   else
   {
      ATL_zrefhemvL( N,    ALPHA, A, LDA, X, INCX, BETA, Y, INCY );
   }
/*
 * End of ATL_zrefhemv
 */
}