lapacke_?(or/un)mlq_work: inconsistent coding style

Post here if you want to report a bug to the LAPACK team

lapacke_?(or/un)mlq_work: inconsistent coding style

Postby chereshnev » Thu Dec 17, 2015 6:10 am

Recently committed changes into lapacke_?(or/un)mlq_work has introduced inconsistency in coding style.

Here is code of lapacke_cunmql_work routine:
lda_t, ldc_t, a_t and c_t variables are declared inside the block for if( matrix_layout == LAPACK_ROW_MAJOR )

Code: Select all
lapack_int LAPACKE_cunmql_work( int matrix_layout, char side, char trans,
                                lapack_int m, lapack_int n, lapack_int k,
                                const lapack_complex_float* a, lapack_int lda,
                                const lapack_complex_float* tau,
                                lapack_complex_float* c, lapack_int ldc,
                                lapack_complex_float* work, lapack_int lwork )
{
    lapack_int info = 0;
    if( matrix_layout == LAPACK_COL_MAJOR ) {
        /* Call LAPACK function and adjust info */
        LAPACK_cunmql( &side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, work,
                       &lwork, &info );
        if( info < 0 ) {
            info = info - 1;
        }
    } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
        lapack_int r = LAPACKE_lsame( side, 'l' ) ? m : n;
        lapack_int lda_t = MAX(1,r);
        lapack_int ldc_t = MAX(1,m);
        lapack_complex_float* a_t = NULL;
        lapack_complex_float* c_t = NULL;


But these variables are declared in the beginning of the routine lapacke_cunmlq_work :

Code: Select all
lapack_int LAPACKE_cunmlq_work( int matrix_layout, char side, char trans,
                                lapack_int m, lapack_int n, lapack_int k,
                                const lapack_complex_float* a, lapack_int lda,
                                const lapack_complex_float* tau,
                                lapack_complex_float* c, lapack_int ldc,
                                lapack_complex_float* work, lapack_int lwork )
{
    lapack_int info = 0;
    lapack_int r;
    lapack_int lda_t, ldc_t;
    lapack_complex_float* a_t = NULL;
    lapack_complex_float* c_t = NULL;
    if( matrix_layout == LAPACK_COL_MAJOR ) {
        /* Call LAPACK function and adjust info */
        LAPACK_cunmlq( &side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, work,
                       &lwork, &info );
        if( info < 0 ) {
            info = info - 1;
        }
    } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
        r = LAPACKE_lsame( side, 'l' ) ? m : n;
        lda_t = MAX(1,k);
        ldc_t = MAX(1,m);


Please find attached patch for lapacke_?(or/un)mlq_work routines.
Attachments
mlq_work.txt
(4.11 KiB) Downloaded 18 times
chereshnev
 
Posts: 14
Joined: Thu Oct 09, 2014 6:17 am
Location: Intel Corp., Russia, Novosibirsk

Re: lapacke_?(or/un)mlq_work: inconsistent coding style

Postby Julien Langou » Thu Dec 17, 2015 12:15 pm

Hi Eugene,

Thanks for your post. I am not in charge of this commit; but for information and reference, the commit was in answer of the following email (sent to the lapack mailing list on Dec/4/2015).

Cheers,
Julien.

Hi all.

I am **** *****. I compiled Lapack 3.6.0 on Windows both with Visual Studio 2012 and gcc 4.9.2 (TDM-GCC MinGW Compiler).

With gcc it worked all right both for shared and static libraries.

With Visual Studio there was an issue in two files:
Code: Select all
lapacke_cunmlq_work.c line 56
lapacke_zunmlq_work.c line 56


in both files there was a command (r = LAPACKE_lsame( side, 'l' ) ? m : n;) before declaration of parameters

Code: Select all
        lapack_int lda_t = MAX(1,k);
        lapack_int ldc_t = MAX(1,m);
        lapack_complex_double* a_t = NULL;
        lapack_complex_double* c_t = NULL;


Switching position of command (r = LAPACKE_lsame( side, 'l' ) ? m : n;) with parameters declaration it works all right for static library compilation. For shared library compilation there are many linking errors reported in attached file.

Hope this can help for improving quality of library.

Best things,
*******.
Julien Langou
 
Posts: 821
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA


Return to Bug report

Who is online

Users browsing this forum: No registered users and 3 guests