Commit 05705d38 authored by Mathieu Faverge's avatar Mathieu Faverge Committed by BOUCHERIE Raphael

Fix D matrix sizes

parent d52bbacf
......@@ -238,7 +238,7 @@ int MORSE_zgelqf_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A,
MORSE_sequence_t *sequence, MORSE_request_t *request)
{
MORSE_context_t *morse;
MORSE_desc_t D;
MORSE_desc_t D, *Dptr = NULL;
morse = morse_context_self();
if (morse == NULL) {
......@@ -283,12 +283,17 @@ int MORSE_zgelqf_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A,
return MORSE_SUCCESS;
*/
#if defined(CHAMELEON_COPY_DIAG)
morse_zdesc_alloc(D, A->mb, A->nb, A->m, chameleon_min(A->m, A->n), 0, 0, A->m, chameleon_min(A->m, A->n), );
morse_pzgelqf_param(qrtree, A, TS, TT, &D, sequence, request);
morse_desc_mat_free(&D);
#else
morse_pzgelqf_param(qrtree, A, TS, TT, NULL, sequence, request);
{
int m = chameleon_min(A->mt, A->nt) * A->mb;
morse_zdesc_alloc(D, A->mb, A->nb, m, A->n, 0, 0, m, A->n, );
Dptr = &D;
}
#endif
morse_pzgelqf_param(qrtree, A, TS, TT, Dptr, sequence, request);
if (Dptr != NULL) {
morse_desc_mat_free(Dptr);
}
(void)D;
return MORSE_SUCCESS;
}
......@@ -271,7 +271,7 @@ int MORSE_zgelqs_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A,
MORSE_desc_t *subB;
MORSE_desc_t *subA;
MORSE_context_t *morse;
MORSE_desc_t D;
MORSE_desc_t D, *Dptr = NULL;
morse = morse_context_self();
if (morse == NULL) {
......@@ -331,13 +331,17 @@ int MORSE_zgelqs_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A,
free(subB);
#if defined(CHAMELEON_COPY_DIAG)
morse_zdesc_alloc(D, A->mb, A->nb, A->m, chameleon_min(A->m, A->n), 0, 0, A->m, chameleon_min(A->m, A->n), );
morse_pzunmlq_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, &D, sequence, request);
morse_desc_mat_free(&D);
#else
morse_pzunmlq_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, NULL, sequence, request);
{
int m = chameleon_min(A->mt, A->nt) * A->mb;
morse_zdesc_alloc(D, A->mb, A->nb, m, A->n, 0, 0, m, A->n, );
Dptr = &D;
}
#endif
morse_pzunmlq_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, Dptr, sequence, request);
if (Dptr != NULL) {
morse_desc_mat_free(Dptr);
}
(void)D;
return MORSE_SUCCESS;
}
......@@ -173,45 +173,45 @@ int MORSE_zgels_param(const libhqr_tree_t *qrtree, MORSE_enum trans, int M, int
morse_sequence_create(morse, &sequence);
if ( M >= N ) {
/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/
morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request,
morse_desc_mat_free(&(descA)) );
morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, M, NRHS, sequence, &request,
morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB)));
/* } else {*/
/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/
/* sequence, &request);*/
/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, M, NRHS,*/
/* sequence, &request);*/
/* }*/
/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/
morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request,
morse_desc_mat_free(&(descA)) );
morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, M, NRHS, sequence, &request,
morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB)));
/* } else {*/
/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/
/* sequence, &request);*/
/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, M, NRHS,*/
/* sequence, &request);*/
/* }*/
} else {
/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/
morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request,
morse_desc_mat_free(&(descA)) );
morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request,
morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB)));
/* } else {*/
/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/
/* sequence, &request);*/
/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/
/* sequence, &request);*/
/* }*/
/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/
morse_zooplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N, sequence, &request,
morse_desc_mat_free(&(descA)) );
morse_zooplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS, sequence, &request,
morse_desc_mat_free(&(descA)); morse_desc_mat_free(&(descB)));
/* } else {*/
/* morse_ziplap2tile( descA, A, NB, NB, LDA, N, 0, 0, M, N,*/
/* sequence, &request);*/
/* morse_ziplap2tile( descB, B, NB, NB, LDB, NRHS, 0, 0, N, NRHS,*/
/* sequence, &request);*/
/* }*/
}
/* Call the tile interface */
MORSE_zgels_param_Tile_Async(qrtree, MorseNoTrans, &descA, descTS, descTT, &descB, sequence, &request);
/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/
morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request);
morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request);
morse_sequence_wait(morse, sequence);
morse_desc_mat_free(&descA);
morse_desc_mat_free(&descB);
/* } else {*/
/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/
/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/
/* morse_sequence_wait(morse, sequence);*/
/* }*/
/* if ( MORSE_TRANSLATION == MORSE_OUTOFPLACE ) {*/
morse_zooptile2lap(descA, A, NB, NB, LDA, N, sequence, &request);
morse_zooptile2lap(descB, B, NB, NB, LDB, NRHS, sequence, &request);
morse_sequence_wait(morse, sequence);
morse_desc_mat_free(&descA);
morse_desc_mat_free(&descB);
/* } else {*/
/* morse_ziptile2lap( descA, A, NB, NB, LDA, N, sequence, &request);*/
/* morse_ziptile2lap( descB, B, NB, NB, LDB, NRHS, sequence, &request);*/
/* morse_sequence_wait(morse, sequence);*/
/* }*/
status = sequence->status;
morse_sequence_destroy(morse, sequence);
......@@ -335,7 +335,7 @@ int MORSE_zgels_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_enum trans,
MORSE_desc_t *subA;
MORSE_desc_t *subB;
MORSE_context_t *morse;
MORSE_desc_t D;
MORSE_desc_t D, *Dptr = NULL;
morse = morse_context_self();
if (morse == NULL) {
......@@ -383,55 +383,53 @@ int MORSE_zgels_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_enum trans,
return morse_request_fail(sequence, request, MORSE_ERR_NOT_SUPPORTED);
}
/* Quick return - currently NOT equivalent to LAPACK's:
if (chameleon_min(M, chameleon_min(N, NRHS)) == 0) {
for (i = 0; i < chameleon_max(M, N); i++)
for (j = 0; j < NRHS; j++)
B[j*LDB+i] = 0.0;
return MORSE_SUCCESS;
}
if (chameleon_min(M, chameleon_min(N, NRHS)) == 0) {
for (i = 0; i < chameleon_max(M, N); i++)
for (j = 0; j < NRHS; j++)
B[j*LDB+i] = 0.0;
return MORSE_SUCCESS;
}
*/
if (A->m >= A->n) {
#if defined(CHAMELEON_COPY_DIAG)
morse_zdesc_alloc(D, A->mb, A->nb, A->m, chameleon_min(A->m, A->n), 0, 0, A->m, chameleon_min(A->m, A->n), );
morse_pzgeqrf_param(qrtree, A, TS, TT, &D, sequence, request);
morse_pzunmqr_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, &D, sequence, request);
morse_desc_mat_free(&D);
#else
morse_pzgeqrf_param(qrtree, A, TS, TT, NULL, sequence, request);
morse_pzunmqr_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, NULL, sequence, request);
{
int n = chameleon_min(A->mt, A->nt) * A->nb;
morse_zdesc_alloc(D, A->mb, A->nb, A->m, n, 0, 0, A->m, n, );
Dptr = &D;
}
#endif
subB = morse_desc_submatrix(B, 0, 0, A->n, B->n);
subA = morse_desc_submatrix(A, 0, 0, A->n, A->n);
morse_pzgeqrf_param(qrtree, A, TS, TT, Dptr, sequence, request);
morse_pzunmqr_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, Dptr, sequence, request);
morse_pztrsm(MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request);
free(subA);
free(subB);
}
else {
#if defined(CHAMELEON_COPY_DIAG)
morse_zdesc_alloc(D, A->mb, A->nb, A->m, chameleon_min(A->m, A->n), 0, 0, A->m, chameleon_min(A->m, A->n), );
morse_pzgelqf_param(qrtree, A, TS, TT, &D, sequence, request);
subB = morse_desc_submatrix(B, 0, 0, A->m, B->n);
subA = morse_desc_submatrix(A, 0, 0, A->m, A->m);
morse_pztrsm(MorseLeft, MorseLower, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request);
free(subA);
free(subB);
morse_pzunmlq_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, &D, sequence, request);
morse_desc_mat_free(&D);
#else
morse_pzgelqf_param(qrtree, A, TS, TT, NULL, sequence, request);
{
int m = chameleon_min(A->mt, A->nt) * A->mb;
morse_zdesc_alloc(D, A->mb, A->nb, m, A->n, 0, 0, m, A->n, );
Dptr = &D;
}
#endif
subB = morse_desc_submatrix(B, 0, 0, A->m, B->n);
subA = morse_desc_submatrix(A, 0, 0, A->m, A->m);
morse_pztrsm(MorseLeft, MorseLower, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request);
free(subA);
free(subB);
morse_pzunmlq_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, NULL, sequence, request);
#endif
morse_pzgelqf_param(qrtree, A, TS, TT, Dptr, sequence, request);
morse_pztrsm(MorseLeft, MorseLower, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request);
morse_pzunmlq_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, Dptr, sequence, request);
}
free(subA);
free(subB);
if (Dptr != NULL) {
morse_desc_mat_free(Dptr);
}
(void)D;
return MORSE_SUCCESS;
}
......@@ -247,7 +247,7 @@ int MORSE_zgeqrf_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A,
MORSE_sequence_t *sequence, MORSE_request_t *request)
{
MORSE_context_t *morse;
MORSE_desc_t D;
MORSE_desc_t D, *Dptr = NULL;
morse = morse_context_self();
if (morse == NULL) {
......@@ -292,12 +292,18 @@ int MORSE_zgeqrf_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A,
return MORSE_SUCCESS;
*/
#if defined(CHAMELEON_COPY_DIAG)
morse_zdesc_alloc(D, A->mb, A->nb, A->m, chameleon_min(A->m, A->n), 0, 0, A->m, chameleon_min(A->m, A->n), );
morse_pzgeqrf_param(qrtree, A, TS, TT, &D, sequence, request);
morse_desc_mat_free(&D);
#else
morse_pzgeqrf_param(qrtree, A, TS, TT, NULL, sequence, request);
{
int n = chameleon_min(A->mt, A->nt) * A->nb;
morse_zdesc_alloc(D, A->mb, A->nb, A->m, n, 0, 0, A->m, n, );
Dptr = &D;
}
#endif
morse_pzgeqrf_param(qrtree, A, TS, TT, Dptr, sequence, request);
if (Dptr != NULL) {
morse_desc_mat_free(Dptr);
}
(void)D;
return MORSE_SUCCESS;
}
......@@ -263,7 +263,7 @@ int MORSE_zgeqrs_param_Tile_Async(const libhqr_tree_t *qrtree,
MORSE_desc_t *subA;
MORSE_desc_t *subB;
MORSE_context_t *morse;
MORSE_desc_t D;
MORSE_desc_t D, *Dptr = NULL;
morse = morse_context_self();
if (morse == NULL) {
......@@ -313,18 +313,25 @@ int MORSE_zgeqrs_param_Tile_Async(const libhqr_tree_t *qrtree,
}
*/
#if defined(CHAMELEON_COPY_DIAG)
morse_zdesc_alloc(D, A->mb, A->nb, A->m, chameleon_min(A->m, A->n), 0, 0, A->m, chameleon_min(A->m, A->n), );
morse_pzunmqr_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, &D, sequence, request);
morse_desc_mat_free(&D);
#else
morse_pzunmqr_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, NULL, sequence, request);
{
int n = chameleon_min(A->mt, A->nt) * A->nb;
morse_zdesc_alloc(D, A->mb, A->nb, A->m, n, 0, 0, A->m, n, );
Dptr = &D;
}
#endif
subB = morse_desc_submatrix(B, 0, 0, A->n, B->n);
subA = morse_desc_submatrix(A, 0, 0, A->n, A->n);
morse_pzunmqr_param(qrtree, MorseLeft, MorseConjTrans, A, B, TS, TT, Dptr, sequence, request);
morse_pztrsm(MorseLeft, MorseUpper, MorseNoTrans, MorseNonUnit, 1.0, subA, subB, sequence, request);
free(subA);
free(subB);
if (Dptr != NULL) {
morse_desc_mat_free(Dptr);
}
(void)D;
return MORSE_SUCCESS;
}
......@@ -254,7 +254,7 @@ int MORSE_zunglq_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A,
MORSE_sequence_t *sequence, MORSE_request_t *request)
{
MORSE_context_t *morse;
MORSE_desc_t D;
MORSE_desc_t D, *Dptr = NULL;
morse = morse_context_self();
if (morse == NULL) {
......@@ -304,14 +304,19 @@ int MORSE_zunglq_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A,
return MORSE_SUCCESS;
*/
#if defined(CHAMELEON_COPY_DIAG)
morse_zdesc_alloc(D, A->mb, A->nb, A->m, chameleon_min(A->m, A->n), 0, 0, A->m, chameleon_min(A->m, A->n), );
morse_pzlaset(MorseUpperLower, 0., 1., Q, sequence, request);
morse_pzunglq_param(qrtree, A, Q, TS, TT, &D, sequence, request);
morse_desc_mat_free(&D);
#else
morse_pzlaset(MorseUpperLower, 0., 1., Q, sequence, request);
morse_pzunglq_param(qrtree, A, Q, TS, TT, NULL, sequence, request);
{
int m = chameleon_min(A->mt, A->nt) * A->mb;
morse_zdesc_alloc(D, A->mb, A->nb, m, A->n, 0, 0, m, A->n, );
Dptr = &D;
}
#endif
morse_pzlaset(MorseUpperLower, 0., 1., Q, sequence, request);
morse_pzunglq_param(qrtree, A, Q, TS, TT, Dptr, sequence, request);
if (Dptr != NULL) {
morse_desc_mat_free(Dptr);
}
(void)D;
return MORSE_SUCCESS;
}
......@@ -254,7 +254,7 @@ int MORSE_zungqr_param_Tile(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_
int MORSE_zungqr_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A, MORSE_desc_t *TS, MORSE_desc_t *TT, MORSE_desc_t *Q, MORSE_sequence_t *sequence, MORSE_request_t *request)
{
MORSE_context_t *morse;
MORSE_desc_t D;
MORSE_desc_t D, *Dptr = NULL;
morse = morse_context_self();
if (morse == NULL) {
morse_fatal_error("MORSE_zungqr_param_Tile", "MORSE not initialized");
......@@ -300,16 +300,21 @@ int MORSE_zungqr_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_desc_t *A,
/*
if (N <= 0)
return MORSE_SUCCESS;
*/
*/
#if defined(CHAMELEON_COPY_DIAG)
morse_zdesc_alloc(D, A->mb, A->nb, A->m, chameleon_min(A->m, A->n), 0, 0, A->m, chameleon_min(A->m, A->n), );
morse_pzlaset(MorseUpperLower, 0., 1., Q, sequence, request);
morse_pzungqr_param(qrtree, A, Q, TS, TT, &D, sequence, request);
morse_desc_mat_free(&D);
#else
morse_pzlaset(MorseUpperLower, 0., 1., Q, sequence, request);
morse_pzungqr_param(qrtree, A, Q, TS, TT, NULL, sequence, request);
{
int n = chameleon_min(A->mt, A->nt) * A->nb;
morse_zdesc_alloc(D, A->mb, A->nb, A->m, n, 0, 0, A->m, n, );
Dptr = &D;
}
#endif
morse_pzlaset(MorseUpperLower, 0., 1., Q, sequence, request);
morse_pzungqr_param(qrtree, A, Q, TS, TT, Dptr, sequence, request);
if (Dptr != NULL) {
morse_desc_mat_free(Dptr);
}
(void)D;
return MORSE_SUCCESS;
}
......@@ -310,7 +310,7 @@ int MORSE_zunmlq_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_enum side,
MORSE_sequence_t *sequence, MORSE_request_t *request)
{
MORSE_context_t *morse;
MORSE_desc_t D;
MORSE_desc_t D, *Dptr = NULL;
morse = morse_context_self();
if (morse == NULL) {
......@@ -367,12 +367,18 @@ int MORSE_zunmlq_param_Tile_Async(const libhqr_tree_t *qrtree, MORSE_enum side,
*/
#if defined(CHAMELEON_COPY_DIAG)
morse_zdesc_alloc(D, A->mb, A->nb, A->m, chameleon_min(A->m, A->n), 0, 0, A->m, chameleon_min(A->m, A->n), );
morse_pzunmlq_param(qrtree, side, trans, A, C, TS, TT, &D, sequence, request);
morse_desc_mat_free(&D);
#else
morse_pzunmlq_param(qrtree, side, trans, A, C, TS, TT, NULL, sequence, request);
{
int m = chameleon_min(A->mt, A->nt) * A->mb;
morse_zdesc_alloc(D, A->mb, A->nb, m, A->n, 0, 0, m, A->n, );
Dptr = &D;
}
#endif
morse_pzunmlq_param(qrtree, side, trans, A, C, TS, TT, Dptr, sequence, request);
if (Dptr != NULL) {
morse_desc_mat_free(Dptr);
}
(void)D;
return MORSE_SUCCESS;
}
......@@ -317,7 +317,7 @@ int MORSE_zunmqr_param_Tile_Async(const libhqr_tree_t *qrtree,
MORSE_sequence_t *sequence, MORSE_request_t *request)
{
MORSE_context_t *morse;
MORSE_desc_t D;
MORSE_desc_t D, *Dptr = NULL;
morse = morse_context_self();
if (morse == NULL) {
......@@ -374,12 +374,18 @@ int MORSE_zunmqr_param_Tile_Async(const libhqr_tree_t *qrtree,
*/
#if defined(CHAMELEON_COPY_DIAG)
morse_zdesc_alloc(D, A->mb, A->nb, A->m, chameleon_min(A->m, A->n), 0, 0, A->m, chameleon_min(A->m, A->n), );
morse_pzunmqr_param(qrtree, side, trans, A, C, TS, TT, &D, sequence, request);
morse_desc_mat_free(&D);
#else
morse_pzunmqr_param(qrtree, side, trans, A, C, TS, TT, NULL, sequence, request);
{
int n = chameleon_min(A->mt, A->nt) * A->nb;
morse_zdesc_alloc(D, A->mb, A->nb, A->m, n, 0, 0, A->m, n, );
Dptr = &D;
}
#endif
morse_pzunmqr_param(qrtree, side, trans, A, C, TS, TT, Dptr, sequence, request);
if (Dptr != NULL) {
morse_desc_mat_free(Dptr);
}
(void)D;
return MORSE_SUCCESS;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment