Ejemplo n.º 1
0
void ATL_crefhemvL
(
   const int                  N,
   const float                * ALPHA,
   const float                * A,
   const int                  LDA,
   const float                * X,
   const int                  INCX,
   const float                * BETA,
   float                      * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_crefhemvL( ... )
 *
 * <=>
 *
 * ATL_crefhemv( AtlasLower, ... )
 *
 * See ATL_crefhemv for details.
 *
 * ---------------------------------------------------------------------
 */
/*
 * .. Local Variables ..
 */
   register float             t0_i, t0_r, t1_i, t1_r;
   int                        i, iaij, ix, iy, j, jaj, jx, jy,
                              incx2 = 2 * INCX, incy2 = 2 * INCY,
                              ldap12 = ( ( LDA + 1 ) << 1 );
/* ..
 * .. Executable Statements ..
 *
 */
   Mcvscal( N, BETA, Y, INCY );

   for( j = 0,      jaj = 0,       jx  = 0,     jy  = 0;
        j < N; j++, jaj += ldap12, jx += incx2, jy += incy2 )
   {
      Mmul( ALPHA[0], ALPHA[1], X[jx], X[jx+1], t0_r, t0_i );
      Mset( ATL_sZERO, ATL_sZERO, 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] );
   }
/*
 * End of ATL_crefhemvL
 */
}
Ejemplo n.º 2
0
void ATL_crefgbmvC
(
   const int                  M,
   const int                  N,
   const int                  KL,
   const int                  KU,
   const float                * ALPHA,
   const float                * A,
   const int                  LDA,
   const float                * X,
   const int                  INCX,
   const float                * BETA,
   float                      * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_crefgbmvC( ... ) <=> ATL_crefgbmv( AtlasConj, ... )
 *
 * See ATL_crefgbmv for details.
 *
 * ---------------------------------------------------------------------
 */
/*
 * .. Local Variables ..
 */
   register float             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 ..
 *
 */
   Mcvscal( 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_crefgbmvC
 */
}
Ejemplo n.º 3
0
void ATL_crefgpmvLN
(
   const int                  M,
   const int                  N,
   const float                * ALPHA,
   const float                * A,
   const int                  LDA,
   const float                * X,
   const int                  INCX,
   const float                * BETA,
   float                      * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_crefgpmvLN( ... )
 *
 * <=>
 *
 * ATL_crefgpmv( AtlasLower, AtlasNoTrans, ... )
 *
 * See ATL_crefgpmv for details.
 *
 * ---------------------------------------------------------------------
 */
/*
 * .. Local Variables ..
 */
   register float             t0_i, t0_r;
   int                        i, iaij, incx2 = 2 * INCX, incy2 = 2 * INCY,
                              iy, j, jaj, jx, lda2 = ( LDA << 1 );
/* ..
 * .. Executable Statements ..
 *
 */
   Mcvscal( M, BETA, Y, INCY );

   for( j = 0, jaj = 0, jx = 0; j < N; j++, 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] ); }
      lda2 -= 2; jaj += lda2;
   }
/*
 * End of ATL_crefgpmvLN
 */
}
Ejemplo n.º 4
0
void ATL_crefsyrkLN
(
   const int                  N,
   const int                  K,
   const float                * ALPHA,
   const float                * A,
   const int                  LDA,
   const float                * BETA,
   float                      * C,
   const int                  LDC
)
{
/*
 * Purpose
 * =======
 *
 * ATL_crefsyrkLN( ... )
 *
 * <=>
 *
 * ATL_crefsyrk( AtlasLower, AtlasNoTrans, ... )
 *
 * See ATL_crefsyrk for details.
 *
 * ---------------------------------------------------------------------
 */
/*
 * .. Local Variables ..
 */
   register float             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 )
   {
      Mcvscal( N-j, BETA, C+(j << 1)+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 = j,      iail  = (j << 1)+jal, icij  = (j << 1)+jcj;
              i < N; i++, iail += 2,            icij += 2 )
         { Mmla( t0_r, t0_i, A[iail], A[iail+1], C[icij], C[icij+1] ); }
      }
   }
/*
 * End of ATL_crefsyrkLN
 */
}
Ejemplo n.º 5
0
void ATL_crefhbmv
(
   const enum ATLAS_UPLO      UPLO,
   const int                  N,
   const int                  K,
   const float                * ALPHA,
   const float                * A,
   const int                  LDA,
   const float                * X,
   const int                  INCX,
   const float                * BETA,
   float                      * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_crefhbmv 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 float *
 *         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 float *
 *         On entry,  A  points  to an array of size equal to or greater
 *         than   LDA * n * sizeof( float [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 float *
 *         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( float [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 float *
 *         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)                float *
 *         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( float [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 ) ||
       ( Mszero( ALPHA[0], ALPHA[1] ) && Msone( BETA[0], BETA[1] ) ) ) return;
   if( Mszero( ALPHA[0], ALPHA[1] ) )
   { Mcvscal( N, BETA, Y, INCY ); return; }

   if( UPLO == AtlasUpper )
   {
      ATL_crefhbmvU( N, K, ALPHA, A, LDA, X, INCX, BETA, Y, INCY );
   }
   else
   {
      ATL_crefhbmvL( N, K, ALPHA, A, LDA, X, INCX, BETA, Y, INCY );
   }
/*
 * End of ATL_crefhbmv
 */
}
Ejemplo n.º 6
0
void ATL_crefhemv
(
   const enum ATLAS_UPLO      UPLO,
   const int                  N,
   const float                * ALPHA,
   const float                * A,
   const int                  LDA,
   const float                * X,
   const int                  INCX,
   const float                * BETA,
   float                      * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_crefhemv 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 float *
 *         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 float *
 *         On entry,  A  points  to an array of size equal to or greater
 *         than   LDA * n * sizeof( float [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 float *
 *         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( float [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 float *
 *         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)                float *
 *         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( float [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 ) ||
       ( Mszero( ALPHA[0], ALPHA[1] ) && Msone( BETA[0], BETA[1] ) ) ) return;
   if( Mszero( ALPHA[0], ALPHA[1] ) )
   { Mcvscal( N, BETA, Y, INCY ); return; }

   if( UPLO == AtlasUpper )
   {
      ATL_crefhemvU( N,    ALPHA, A, LDA, X, INCX, BETA, Y, INCY );
   }
   else
   {
      ATL_crefhemvL( N,    ALPHA, A, LDA, X, INCX, BETA, Y, INCY );
   }
/*
 * End of ATL_crefhemv
 */
}
Ejemplo n.º 7
0
void ATL_crefgpmv
(
   const enum ATLAS_UPLO      UPLO,
   const enum ATLAS_TRANS     TRANS,
   const int                  M,
   const int                  N,
   const float                * ALPHA,
   const float                * A,
   const int                  LDA,
   const float                * X,
   const int                  INCX,
   const float                * BETA,
   float                      * Y,
   const int                  INCY
)
{
/*
 * Purpose
 * =======
 *
 * ATL_crefgpmv 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 n-element vectors and A
 * is an m by n general matrix, supplied in packed form.
 *
 * Arguments
 * =========
 *
 * UPLO    (input)                       const enum ATLAS_UPLO
 *         On entry, UPLO  specifies whether the array A contains an up-
 *         per or lower packed submatrix as follows:
 *
 *             UPLO = AtlasUpper   A is an upper-packed submatrix,
 *
 *             UPLO = AtlasLower   A is a  lower-packed submatrix.
 *
 *         Unchanged on exit.
 *
 * 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 float *
 *         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 float *
 *         On entry,  A  points  to an array of size equal to or greater
 *         than  ( LDA * ka - sum(1 .. ka-1, k) ) * sizeof( float [2] ),
 *         where ka is n when TRANS = AtlasNotrans or TRANS = AtlasConj,
 *         and m otherwise. Before entry with UPLO = AtlasUpper, the ar-
 *         ray  A  must contain the entries of the matrix packed sequen-
 *         tially, column by column, so that A[0] contains a(0,0),  A[1]
 *         and A[2] contain a(1,0) and  a(2,0),  A[LDA]  and  A[2*LDA+1]
 *         contain  a(0,1) and a(0,2) respectively and so on. Before en-
 *         try with UPLO = AtlasLower, the array A  must contain the en-
 *         tries of the matrix packed sequentially, column by column, so
 *         that A[ 0 ] contains a(0,0), A[ 1 ] and A[ 2 ] contain a(1,0)
 *         and a(2,0), A[LDA] and A[2*LDA-1] contain  a(1,1) and  a(2,2)
 *         respectively, and so on. Unchanged on exit.
 *
 * LDA     (input)                       const int
 *         On entry, LDA  specifies the length of the first column of A.
 *         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 float *
 *         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( float [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 float *
 *         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)                float *
 *         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( float [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 ) ||
       ( Mszero( ALPHA[0], ALPHA[1] ) && Msone( BETA[0], BETA[1] ) ) )
      return;

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

   if( UPLO == AtlasUpper )
   {
      if(      TRANS == AtlasNoTrans )
      { ATL_crefgpmvUN( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); }
      else if( TRANS == AtlasConj    )
      { ATL_crefgpmvUC( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); }
      else if( TRANS == AtlasTrans   )
      { ATL_crefgpmvUT( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); }
      else
      { ATL_crefgpmvUH( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); }
   }
   else
   {
      if(      TRANS == AtlasNoTrans )
      { ATL_crefgpmvLN( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); }
      else if( TRANS == AtlasConj    )
      { ATL_crefgpmvLC( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); }
      else if( TRANS == AtlasTrans   )
      { ATL_crefgpmvLT( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); }
      else
      { ATL_crefgpmvLH( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); }
   }
/*
 * End of ATL_crefgpmv
 */
}