void ATL_srefsbmvU ( 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_srefsbmvU( ... ) * * <=> * * ATL_srefsbmv( AtlasUpper, ... ) * * See ATL_srefsbmv for details. * * --------------------------------------------------------------------- */ /* * .. Local Variables .. */ register float t0, t1; int i, i0, iaij, ix, iy, j, jaj, jx, jy, kx = 0, ky = 0, l; /* .. * .. Executable Statements .. * */ Msvscal( N, BETA, Y, INCY ); for( j = 0, jaj = 0, jx = kx, jy = ky; j < N; j++, jaj += LDA, jx += INCX, jy += INCY ) { t0 = ALPHA * X[jx]; t1 = ATL_sZERO; l = K - j; i0 = ( j - K > 0 ? j - K : 0 ); for( i = i0, iaij = l+i0+jaj, ix = kx, iy = ky; i < j; i++, iaij += 1, ix += INCX, iy += INCY ) { Y[iy] += A[iaij] * t0; t1 += A[iaij] * X[ix]; } Y[jy] += A[iaij] * t0 + ALPHA * t1; if( j >= K ) { kx += INCX; ky += INCY; } } /* * End of ATL_srefsbmvU */ }
void ATL_crefherkUN ( 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_crefherkUN( ... ) * * <=> * * ATL_crefherk( AtlasUpper, AtlasNoTrans, ... ) * * See ATL_crefherk 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 ) { Msvscal( (j << 1), BETA, C+jcj, 1 ); icij = ( j << 1 ) + jcj; Mselscal( BETA, C[icij] ); C[icij+1] = ATL_sZERO; for( l = 0, iajl = iaj, jal = 0; l < K; l++, iajl += lda2, jal += lda2 ) { Mset( ALPHA * A[iajl], -ALPHA * 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] ); } Mset( C[icij] + t0_r * A[iail] - t0_i * A[iail+1], ATL_sZERO, C[icij], C[icij+1] ); } } /* * End of ATL_crefherkUN */ }
void ATL_srefsyr2kLN ( 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 ) { /* * Purpose * ======= * * ATL_srefsyr2kLN( ... ) * * <=> * * ATL_srefsyr2k( AtlasLower, AtlasNoTrans, ... ) * * See ATL_srefsyr2k for details. * * --------------------------------------------------------------------- */ /* * .. Local Variables .. */ register float t0, t1; int i, iail, iaj, iajl, ibil, ibj, ibjl, icij, j, jal, jbl, jcj, l; /* .. * .. Executable Statements .. * */ for( j = 0, iaj = 0, ibj = 0, jcj = 0; j < N; j++, iaj += 1, ibj += 1, jcj += LDC ) { Msvscal( N-j, BETA, C+j+jcj, 1 ); for( l = 0, iajl = iaj, ibjl = ibj, jal = 0, jbl = 0; l < K; l++, iajl += LDA, ibjl += LDB, jal += LDA, jbl += LDB ) { t0 = ALPHA * A[iajl]; t1 = ALPHA * B[ibjl]; for( i = j, iail = j+jal, ibil = j+jbl, icij = j+jcj; i < N; i++, iail += 1, ibil += 1, icij += 1 ) { C[icij] += t1 * A[iail] + t0 * B[ibil]; } } } /* * End of ATL_srefsyr2kLN */ }
void ATL_srefspmvU ( 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_srefspmvU( ... ) * * <=> * * ATL_srefspmv( AtlasUpper, ... ) * * See ATL_srefspmv for details. * * --------------------------------------------------------------------- */ /* * .. Local Variables .. */ /* * .. Local Variables .. */ register float t0, t1; int i, iaij, ix, iy, j, jaj, jx, jy, lda = LDA; /* .. * .. Executable Statements .. * */ Msvscal( N, BETA, Y, INCY ); for( j = 0, jaj = 0, jx = 0, jy = 0; j < N; j++, jx += INCX, jy += INCY ) { t0 = ALPHA * X[jx]; t1 = ATL_sZERO; for( i = 0, iaij = jaj, ix = 0, iy = 0; i < j; i++, iaij += 1, ix += INCX, iy += INCY ) { Y[iy] += t0 * A[iaij]; t1 += A[iaij] * X[ix]; } Y[jy] += t0 * A[iaij] + ALPHA * t1; jaj += lda; lda += 1; } /* * End of ATL_srefspmvU */ }
void ATL_srefgpmvUN ( 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_srefgpmvLN( ... ) * * <=> * * ATL_srefgpmv( AtlasUpper, AtlasNoTrans, ... ) * * See ATL_srefgpmv for details. * * --------------------------------------------------------------------- */ /* * .. Local Variables .. */ register float t0; int i, iaij, iy, j, jaj, jx, lda = LDA; /* .. * .. Executable Statements .. * */ Msvscal( M, BETA, Y, INCY ); for( j = 0, jaj = 0, jx = 0; j < N; j++, jx += INCX ) { t0 = ALPHA * X[jx]; for( i = 0, iaij = jaj, iy = 0; i < M; i++, iaij += 1, iy += INCY ) { Y[iy] += A[iaij] * t0; } jaj += lda; lda += 1; } /* * End of ATL_srefgpmvUN */ }
void ATL_srefsymv ( 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_srefsymv 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 symmetric 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 ). 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 * symmetric 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 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, 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 ), * 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 ), * 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 ) || ( ( ALPHA == ATL_sZERO ) && ( BETA == ATL_sONE ) ) ) return; if( ALPHA == ATL_sZERO ) { Msvscal( N, BETA, Y, INCY ); return; } if( UPLO == AtlasUpper ) { ATL_srefsymvU( N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); } else { ATL_srefsymvL( N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); } /* * End of ATL_srefsymv */ }
void ATL_srefgpmv ( 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_srefgpmv 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 ) = 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*A *x + beta*y, * * TRANS = AtlasTrans y := alpha*A'*x + beta*y, * * TRANS = AtlasConjTrans y := alpha*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 ), * 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 ), * 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 ), * 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 ) || ( ( ALPHA == ATL_sZERO ) && ( BETA == ATL_sONE ) ) ) return; if( ALPHA == ATL_sZERO ) { Msvscal( M, BETA, Y, INCY ); return; } if( UPLO == AtlasUpper ) { if( ( TRANS == AtlasNoTrans ) || ( TRANS == AtlasConj ) ) { ATL_srefgpmvUN( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); } else { ATL_srefgpmvUT( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); } } else { if( ( TRANS == AtlasNoTrans ) || ( TRANS == AtlasConj ) ) { ATL_srefgpmvLN( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); } else { ATL_srefgpmvLT( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); } } /* * End of ATL_srefgpmv */ }
void ATL_crefher2kUN ( 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 ) { /* * Purpose * ======= * * ATL_crefher2kUN( ... ) * * <=> * * ATL_crefher2k( AtlasUpper, AtlasNoTrans, ... ) * * See ATL_crefher2k for details. * * --------------------------------------------------------------------- */ /* * .. Local Variables .. */ float t0_i, t0_r, t1_i, t1_r; int i, iail, iaj, iajl, ibil, ibj, ibjl, icij, j, jal, jbl, jcj, l, lda2 = ( LDA << 1 ), ldb2 = ( LDB << 1 ), ldc2 = ( LDC << 1 ); /* .. * .. Executable Statements .. * */ for( j = 0, iaj = 0, ibj = 0, jcj = 0; j < N; j++, iaj += 2, ibj += 2, jcj += ldc2 ) { Msvscal( (j << 1), BETA, C+jcj, 1 ); icij = ( j << 1 ) + jcj; Mselscal( BETA, C[icij] ); C[icij+1] = ATL_sZERO; for( l = 0, iajl = iaj, ibjl = ibj, jal = 0, jbl = 0; l < K; l++, iajl += lda2, ibjl += ldb2, jal += lda2, jbl += ldb2 ) { Mmul( ALPHA[0], ALPHA[1], B[ibjl], -B[ibjl+1], t0_r, t0_i ); Mmul( ALPHA[0], -ALPHA[1], A[iajl], -A[iajl+1], t1_r, t1_i ); for( i = 0, iail = jal, ibil = jbl, icij = jcj; i < j; i++, iail += 2, ibil += 2, icij += 2 ) { Mmla( A[iail], A[iail+1], t0_r, t0_i, C[icij], C[icij+1] ); Mmla( B[ibil], B[ibil+1], t1_r, t1_i, C[icij], C[icij+1] ); } Mset( C[icij] + A[iail] * t0_r - A[iail+1] * t0_i + B[ibil] * t1_r - B[ibil+1] * t1_i, ATL_sZERO, C[icij], C[icij+1] ); } } /* * End of ATL_crefher2kUN */ }
void ATL_srefgemv ( 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_srefgemv 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 ) = 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*A *x + beta*y, * * TRANS = AtlasTrans y := alpha*A'*x + beta*y, * * TRANS = AtlasConjTrans y := alpha*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 * sizeof( float ), 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 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 ), * 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 ), * 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 ) || ( ( ALPHA == ATL_sZERO ) && ( BETA == ATL_sONE ) ) ) return; if( ALPHA == ATL_sZERO ) { Msvscal( M, BETA, Y, INCY ); return; } if( ( TRANS == AtlasNoTrans ) || ( TRANS == AtlasConj ) ) { ATL_srefgemvN( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); } else { ATL_srefgemvT( M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY ); } /* * End of ATL_srefgemv */ }