45 if ( B_ptr == NULL ) {
46 pastix_print_error(
"pastixRhsInit: wrong B parameter" );
54 B->flttype = PastixPattern;
89 pastix_print_error(
"pastixRhsFinalize: wrong B parameter" );
94 if ( B->allocated > 0 ) {
98 pastix_print_warning(
"Calling pastixRhsFinalize before restoring the ordering of vector b.\n"
100 " pastix_subtask_applyorder( pastix_data, flttype, PastixDirBackward, m, n,\n"
102 "prior to this call to restore it.\n" );
106 if ( B->cblkb != NULL ) {
107 memFree_null( B->cblkb );
110 if ( B->Ploc2Pglob != NULL ) {
111 memFree_null( B->Ploc2Pglob );
113 if ( B->rhs_comm != NULL ) {
114 memFree_null( B->rhs_comm );
153 if ( ( dB->flttype != PastixComplex64 ) &&
154 ( dB->flttype != PastixDouble ) )
156 pastix_print_error(
"bvecDoubletoSingle: Invalid float type for mixed-precision" );
160 if ( sB->allocated == -1 ) {
161 size_t size = dB->ld * dB->n;
166 sB->flttype = dB->flttype - 1;
167 sB->b = malloc( size * pastix_size_of( sB->flttype ) );
171 assert( sB->allocated >= 0 );
172 assert( sB->flttype == (dB->flttype - 1) );
173 assert( sB->b != NULL );
174 assert( sB->m == dB->m );
175 assert( sB->n == dB->n );
177 switch( dB->flttype ) {
178 case PastixComplex64:
179 rc = LAPACKE_zlag2c_work( LAPACK_COL_MAJOR, dB->m, dB->n, dB->b, dB->ld, sB->b, sB->ld );
182 rc = LAPACKE_dlag2s_work( LAPACK_COL_MAJOR, dB->m, dB->n, dB->b, dB->ld, sB->b, sB->ld );
186 pastix_print_error(
"bvecDoubletoSingle: Invalid input float type for mixed-precision" );
233 if ( ( sB->flttype != PastixComplex32 ) &&
234 ( sB->flttype != PastixFloat ) )
236 pastix_print_error(
"bvecSingleToDouble: Invalid input float type for mixed-precision" );
240 if ( dB->allocated == -1 ) {
241 size_t size = sB->ld * sB->n;
246 dB->flttype = sB->flttype + 1;
247 dB->b = malloc( size * pastix_size_of( dB->flttype ) );
251 assert( dB->allocated >= 0 );
252 assert( dB->flttype == (sB->flttype + 1) );
253 assert( dB->b != NULL );
254 assert( dB->m == sB->m );
255 assert( dB->n == sB->n );
257 switch( sB->flttype ) {
258 case PastixComplex32:
259 rc = LAPACKE_clag2z_work( LAPACK_COL_MAJOR, sB->m, sB->n, sB->b, sB->ld, dB->b, dB->ld );
262 rc = LAPACKE_slag2d_work( LAPACK_COL_MAJOR, sB->m, sB->n, sB->b, sB->ld, dB->b, dB->ld );
266 pastix_print_error(
"bvecSingleToDouble: Invalid float type for mixed-precision" );
int pastixRhsInit(pastix_rhs_t *B_ptr)
Initialize an RHS data structure.
int pastixRhsFinalize(pastix_rhs_t B)
Cleanup an RHS data structure.
@ PASTIX_ERR_BADPARAMETER
int pastixRhsDoubletoSingle(const pastix_rhs_t dB, pastix_rhs_t sB)
Reduces the precision of an RHS.
int pastixRhsSingleToDouble(const pastix_rhs_t sB, pastix_rhs_t dB)
Increases the precision of an RHS.
Main PaStiX RHS structure.