Exemplo n.º 1
0
 inline 
 void hpr2 (CBLAS_ORDER const Order, CBLAS_UPLO const Uplo,
            int const N, traits::complex_d const& alpha, 
            traits::complex_d const* X, int const incX, 
            traits::complex_d const* Y, int const incY, 
            traits::complex_d* Ap)
 {
   cblas_zhpr2 (Order, Uplo, N, 
                static_cast<void const*> (&alpha), 
                static_cast<void const*> (X), incX, 
                static_cast<void const*> (Y), incY, 
                static_cast<void*> (Ap)); 
 }
Exemplo n.º 2
0
void F77_zhpr2(int *layout, char *uplow, int *n, CBLAS_TEST_ZOMPLEX *alpha,
               CBLAS_TEST_ZOMPLEX *x, int *incx, CBLAS_TEST_ZOMPLEX *y, int *incy,
               CBLAS_TEST_ZOMPLEX *ap) {
    CBLAS_TEST_ZOMPLEX *A, *AP;
    int i,j,k,LDA;
    CBLAS_UPLO uplo;

    get_uplo_type(uplow,&uplo);

    if (*layout == TEST_ROW_MJR) {
        if (uplo != CblasUpper && uplo != CblasLower )
            cblas_zhpr2( CblasRowMajor, UNDEFINED, *n, alpha, x, *incx, y,
                         *incy, ap );
        else {
            LDA = *n;
            A=(CBLAS_TEST_ZOMPLEX*)malloc( LDA*LDA*sizeof(CBLAS_TEST_ZOMPLEX ) );
            AP=(CBLAS_TEST_ZOMPLEX*)malloc( (((LDA+1)*LDA)/2)*
                                            sizeof( CBLAS_TEST_ZOMPLEX ));
            if (uplo == CblasUpper) {
                for( j=0, k=0; j<*n; j++ )
                    for( i=0; i<j+1; i++, k++ ) {
                        A[ LDA*i+j ].real=ap[ k ].real;
                        A[ LDA*i+j ].imag=ap[ k ].imag;
                    }
                for( i=0, k=0; i<*n; i++ )
                    for( j=i; j<*n; j++, k++ ) {
                        AP[ k ].real=A[ LDA*i+j ].real;
                        AP[ k ].imag=A[ LDA*i+j ].imag;
                    }
            }
            else {
                for( j=0, k=0; j<*n; j++ )
                    for( i=j; i<*n; i++, k++ ) {
                        A[ LDA*i+j ].real=ap[ k ].real;
                        A[ LDA*i+j ].imag=ap[ k ].imag;
                    }
                for( i=0, k=0; i<*n; i++ )
                    for( j=0; j<i+1; j++, k++ ) {
                        AP[ k ].real=A[ LDA*i+j ].real;
                        AP[ k ].imag=A[ LDA*i+j ].imag;
                    }
            }
            cblas_zhpr2( CblasRowMajor, uplo, *n, alpha, x, *incx, y, *incy, AP );
            if (uplo == CblasUpper) {
                for( i=0, k=0; i<*n; i++ )
                    for( j=i; j<*n; j++, k++ ) {
                        A[ LDA*i+j ].real=AP[ k ].real;
                        A[ LDA*i+j ].imag=AP[ k ].imag;
                    }
                for( j=0, k=0; j<*n; j++ )
                    for( i=0; i<j+1; i++, k++ ) {
                        ap[ k ].real=A[ LDA*i+j ].real;
                        ap[ k ].imag=A[ LDA*i+j ].imag;
                    }
            }
            else {
                for( i=0, k=0; i<*n; i++ )
                    for( j=0; j<i+1; j++, k++ ) {
                        A[ LDA*i+j ].real=AP[ k ].real;
                        A[ LDA*i+j ].imag=AP[ k ].imag;
                    }
                for( j=0, k=0; j<*n; j++ )
                    for( i=j; i<*n; i++, k++ ) {
                        ap[ k ].real=A[ LDA*i+j ].real;
                        ap[ k ].imag=A[ LDA*i+j ].imag;
                    }
            }
            free(A);
            free(AP);
        }
    }
    else if (*layout == TEST_COL_MJR)
        cblas_zhpr2( CblasColMajor, uplo, *n, alpha, x, *incx, y, *incy, ap );
    else
        cblas_zhpr2( UNDEFINED, uplo, *n, alpha, x, *incx, y, *incy, ap );
}