void utilities_FortranMatrixSymmetrize( utilities_FortranMatrix* mtx ) { hypre_longint i, j, g, h, w, jump; double* p; double* q; hypre_assert( mtx != NULL ); g = mtx->globalHeight; h = mtx->height; w = mtx->width; hypre_assert( h == w ); jump = mtx->globalHeight - h; for ( j = 0, p = mtx->value; j < w; j++ ) { q = p; p++; q += g; for ( i = j + 1; i < h; i++, p++, q += g ) *p = *q = (*p + *q)*0.5; p += ++jump; } }
void utilities_FortranMatrixTransposeSquare( utilities_FortranMatrix* mtx ) { hypre_longint i, j, g, h, w, jump; double* p; double* q; double tmp; hypre_assert( mtx != NULL ); g = mtx->globalHeight; h = mtx->height; w = mtx->width; hypre_assert( h == w ); jump = mtx->globalHeight - h; for ( j = 0, p = mtx->value; j < w; j++ ) { q = p; p++; q += g; for ( i = j + 1; i < h; i++, p++, q += g ) { tmp = *p; *p = *q; *q = tmp; } p += ++jump; } }
void mv_TempMultiVectorCopy( void* src_, void* dest_ ) { HYPRE_Int i, ms, md; void** ps; void** pd; mv_TempMultiVector* src = (mv_TempMultiVector*)src_; mv_TempMultiVector* dest = (mv_TempMultiVector*)dest_; hypre_assert( src != NULL && dest != NULL ); ms = aux_maskCount( src->numVectors, src->mask ); md = aux_maskCount( dest->numVectors, dest->mask ); hypre_assert( ms == md ); ps = (void**) calloc( ms, sizeof(void*) ); hypre_assert( ps != NULL ); pd = (void**) calloc( md, sizeof(void*) ); hypre_assert( pd != NULL ); mv_collectVectorPtr( src->mask, src, ps ); mv_collectVectorPtr( dest->mask, dest, pd ); for ( i = 0; i < ms; i++ ) (src->interpreter->CopyVector)(ps[i],pd[i]); free(ps); free(pd); }
void mv_TempMultiVectorAxpy( double a, void* x_, void* y_ ) { HYPRE_Int i, mx, my; void** px; void** py; mv_TempMultiVector* x; mv_TempMultiVector* y; x = (mv_TempMultiVector*)x_; y = (mv_TempMultiVector*)y_; hypre_assert( x != NULL && y != NULL ); mx = aux_maskCount( x->numVectors, x->mask ); my = aux_maskCount( y->numVectors, y->mask ); hypre_assert( mx == my ); px = (void**) calloc( mx, sizeof(void*) ); hypre_assert( px != NULL ); py = (void**) calloc( my, sizeof(void*) ); hypre_assert( py != NULL ); mv_collectVectorPtr( x->mask, x, px ); mv_collectVectorPtr( y->mask, y, py ); for ( i = 0; i < mx; i++ ) (x->interpreter->Axpy)(a,px[i],py[i]); free(px); free(py); }
HYPRE_Int hypre_ParMultiVectorTempPrint(hypre_ParMultiVector *vector, const char *fileName) { HYPRE_Int i, ierr; char fullName[128]; hypre_ParVector * temp_vec; hypre_assert( vector != NULL ); temp_vec=hypre_ParVectorCreate(vector->comm,vector->global_size, vector->partitioning); hypre_assert(temp_vec!=NULL); temp_vec->owns_partitioning=0; temp_vec->local_vector->owns_data=0; /* no initialization for temp_vec needed! */ ierr = 0; for ( i = 0; i < vector->local_vector->num_vectors; i++ ) { hypre_sprintf( fullName, "%s.%d", fileName, i ); temp_vec->local_vector->data=vector->local_vector->data + i * vector->local_vector->size; ierr = ierr || hypre_ParVectorPrint(temp_vec, fullName); } ierr = ierr || hypre_ParVectorDestroy(temp_vec); /* line above won't free data or partitioning */ return ierr; }
void utilities_FortranMatrixIndexCopy( HYPRE_Int* index, utilities_FortranMatrix* src, HYPRE_Int t, utilities_FortranMatrix* dest ) { hypre_longint i, j, h, w; hypre_longint jp, jq, jr; double* p; double* q; double* r; hypre_assert( src != NULL && dest != NULL ); h = dest->height; w = dest->width; jp = dest->globalHeight - h; if ( t == 0 ) { hypre_assert( src->height == h && src->width == w ); jq = 1; jr = src->globalHeight; } else { hypre_assert( src->height == w && src->width == h ); jr = 1; jq = src->globalHeight; } for ( j = 0, p = dest->value; j < w; j++, p += jp ) { r = src->value + (index[j]-1)*jr; for ( i = 0, q = r; i < h; i++, p++, q += jq ) *p = *q; } }
void* mv_TempMultiVectorCreateFromSampleVector( void* ii_, HYPRE_Int n, void* sample ) { HYPRE_Int i; mv_TempMultiVector* x; mv_InterfaceInterpreter* ii = (mv_InterfaceInterpreter*)ii_; x = (mv_TempMultiVector*) malloc(sizeof(mv_TempMultiVector)); hypre_assert( x != NULL ); x->interpreter = ii; x->numVectors = n; x->vector = (void**) calloc( n, sizeof(void*) ); hypre_assert( x->vector != NULL ); x->ownsVectors = 1; x->mask = NULL; x->ownsMask = 0; for ( i = 0; i < n; i++ ) x->vector[i] = (ii->CreateVector)(sample); return x; }
/* temporary function; allows to do "matvec" and preconditioner in vector-by-vector fashion */ HYPRE_Int hypre_ParMultiVectorEval(void (*f)( void*, void*, void* ), void* par, hypre_ParMultiVector * x, hypre_ParMultiVector * y) { hypre_ParVector *temp_x, *temp_y; HYPRE_Int i; HYPRE_Int num_active_vectors; HYPRE_Int *x_active_indices, *y_active_indices; double * x_data, *y_data; HYPRE_Int size; hypre_assert(x->local_vector->num_active_vectors == y->local_vector->num_active_vectors); hypre_assert(x->local_vector->size == y->local_vector->size); temp_x=hypre_ParVectorCreate(x->comm,x->global_size, x->partitioning); hypre_assert(temp_x!=NULL); temp_x->owns_partitioning=0; temp_x->local_vector->owns_data=0; temp_x->local_vector->vecstride = temp_x->local_vector->size; temp_x->local_vector->idxstride = 1; /* no initialization for temp_x needed! */ temp_y=hypre_ParVectorCreate(y->comm,y->global_size, y->partitioning); hypre_assert(temp_y!=NULL); temp_y->owns_partitioning=0; temp_y->local_vector->owns_data=0; temp_y->local_vector->vecstride = temp_y->local_vector->size; temp_y->local_vector->idxstride = 1; /* no initialization for temp_y needed! */ num_active_vectors = x->local_vector->num_active_vectors; x_active_indices = x->local_vector->active_indices; y_active_indices = y->local_vector->active_indices; x_data = x->local_vector->data; y_data = y->local_vector->data; size = x->local_vector->size; for ( i=0; i<num_active_vectors; i++ ) { temp_x->local_vector->data = x_data + x_active_indices[i]*size; temp_y->local_vector->data = y_data + y_active_indices[i]*size; /*** here i make an assumption that "f" will treat temp_x and temp_y like "hypre_ParVector *" variables ***/ f( par, temp_x, temp_y ); } hypre_ParVectorDestroy(temp_x); hypre_ParVectorDestroy(temp_y); /* 2 lines above won't free data or partitioning */ return 0; }
double* utilities_FortranMatrixValuePtr( utilities_FortranMatrix* mtx, hypre_longint i, hypre_longint j ) { hypre_longint k; hypre_assert( mtx != NULL ); hypre_assert( 1 <= i && i <= mtx->height ); hypre_assert( 1 <= j && j <= mtx->width ); k = i - 1 + (j - 1)*mtx->globalHeight; return mtx->value + k; }
void utilities_FortranMatrixUpperInv( utilities_FortranMatrix* u ) { hypre_longint i, j, k; hypre_longint n, jc, jd; double v; double* diag; /* diag(i) = u(i,i)_original */ double* pin; /* &u(i-1,n) */ double* pii; /* &u(i,i) */ double* pij; /* &u(i,j) */ double* pik; /* &u(i,k) */ double* pkj; /* &u(k,j) */ double* pd; /* &diag(i) */ n = u->height; hypre_assert( u->width == n ); diag = (double*)calloc( n, sizeof(double) ); hypre_assert( diag != NULL ); jc = u->globalHeight; jd = jc + 1; pii = u->value; pd = diag; for ( i = 0; i < n; i++, pii += jd, pd++ ) { v = *pd = *pii; *pii = 1.0/v; } pii -= jd; pin = pii - 1; pii -= jd; pd -= 2; for ( i = n - 1; i > 0; i--, pii -= jd, pin--, pd-- ) { pij = pin; for ( j = n; j > i; j--, pij -= jc ) { v = 0; pik = pii + jc; pkj = pij + 1; for ( k = i + 1; k <= j; k++, pik += jc, pkj++ ) { v -= (*pik) * (*pkj); } *pij = v/(*pd); } } free( diag ); }
double* utilities_FortranMatrixValues( utilities_FortranMatrix* mtx ) { hypre_assert( mtx != NULL ); return mtx->value; }
int32_t impl_bHYPRE_ParCSRDiagScale_SetOperator( /* in */ bHYPRE_ParCSRDiagScale self, /* in */ bHYPRE_Operator A, /* out */ sidl_BaseInterface *_ex) { *_ex = 0; { /* DO-NOT-DELETE splicer.begin(bHYPRE.ParCSRDiagScale.SetOperator) */ /* Insert the implementation of the SetOperator method here... */ int ierr = 0; struct bHYPRE_ParCSRDiagScale__data * data; bHYPRE_IJParCSRMatrix bH_A; bH_A = (bHYPRE_IJParCSRMatrix) bHYPRE_Operator__cast2( A, "bHYPRE.IJParCSRMatrix", _ex ); SIDL_CHECK(*_ex); hypre_assert( bH_A!=NULL ); data = bHYPRE_ParCSRDiagScale__get_data( self ); data->matrix = bH_A; bHYPRE_IJParCSRMatrix_addRef( data->matrix, _ex ); SIDL_CHECK(*_ex); return ierr; hypre_babel_exception_return_error(_ex); /* DO-NOT-DELETE splicer.end(bHYPRE.ParCSRDiagScale.SetOperator) */ } }
bHYPRE_IJParCSRMatrix impl_bHYPRE_IJParCSRMatrix_Create( /* in */ bHYPRE_MPICommunicator mpi_comm, /* in */ int32_t ilower, /* in */ int32_t iupper, /* in */ int32_t jlower, /* in */ int32_t jupper, /* out */ sidl_BaseInterface *_ex) { *_ex = 0; { /* DO-NOT-DELETE splicer.begin(bHYPRE.IJParCSRMatrix.Create) */ /* Insert-Code-Here {bHYPRE.IJParCSRMatrix.Create} (Create method) */ int ierr = 0; HYPRE_IJMatrix dummy; HYPRE_IJMatrix * Hmat = &dummy; struct bHYPRE_IJParCSRMatrix__data * data; bHYPRE_IJParCSRMatrix mat = bHYPRE_IJParCSRMatrix__create(_ex); SIDL_CHECK(*_ex); data = bHYPRE_IJParCSRMatrix__get_data( mat ); data->comm = bHYPRE_MPICommunicator__get_data(mpi_comm)->mpi_comm; ierr += HYPRE_IJMatrixCreate( data -> comm, ilower, iupper, jlower, jupper, Hmat ); ierr += HYPRE_IJMatrixSetObjectType( *Hmat, HYPRE_PARCSR ); hypre_assert( ierr == 0 ); data -> ij_A = *Hmat; return mat; hypre_babel_exception_no_return(_ex); /* DO-NOT-DELETE splicer.end(bHYPRE.IJParCSRMatrix.Create) */ } }
hypre_longint utilities_FortranMatrixWidth( utilities_FortranMatrix* mtx ) { hypre_assert( mtx != NULL ); return mtx->width; }
double utilities_FortranMatrixFNorm( utilities_FortranMatrix* mtx ) { hypre_longint i, j, h, w, jump; double* p; double norm; hypre_assert( mtx != NULL ); h = mtx->height; w = mtx->width; jump = mtx->globalHeight - h; norm = 0.0; for ( j = 0, p = mtx->value; j < w; j++ ) { for ( i = 0; i < h; i++, p++ ) norm += (*p) * (*p); p += jump; } norm = sqrt(norm); return norm; }
void impl_bHYPRE_IJParCSRMatrix__dtor( /* in */ bHYPRE_IJParCSRMatrix self, /* out */ sidl_BaseInterface *_ex) { *_ex = 0; { /* DO-NOT-DELETE splicer.begin(bHYPRE.IJParCSRMatrix._dtor) */ /* Insert the implementation of the destructor method here... */ int ierr = 0; struct bHYPRE_IJParCSRMatrix__data * data; HYPRE_IJMatrix ij_A; data = bHYPRE_IJParCSRMatrix__get_data( self ); ij_A = data -> ij_A; if ( ij_A && data->owns_matrix ) ierr += HYPRE_IJMatrixDestroy( ij_A ); hypre_assert( ierr == 0 ); hypre_TFree( data ); /* DO-NOT-DELETE splicer.end(bHYPRE.IJParCSRMatrix._dtor) */ } }
hypre_longint utilities_FortranMatrixHeight( utilities_FortranMatrix* mtx ) { hypre_assert( mtx != NULL ); return mtx->height; }
double utilities_FortranMatrixMaxValue( utilities_FortranMatrix* mtx ) { hypre_longint i, j, jump; hypre_longint h, w; double* p; double maxVal; hypre_assert( mtx != NULL ); h = mtx->height; w = mtx->width; jump = mtx->globalHeight - h; maxVal = mtx->value[0]; for ( j = 0, p = mtx->value; j < w; j++ ) { for ( i = 0; i < h; i++, p++ ) if ( *p > maxVal ) maxVal = *p; p += jump; } return maxVal; }
HYPRE_Int utilities_FortranMatrixPrint( utilities_FortranMatrix* mtx, const char *fileName) { hypre_longint i, j, h, w, jump; double* p; FILE* fp; hypre_assert( mtx != NULL ); if ( !(fp = fopen(fileName,"w")) ) return 1; h = mtx->height; w = mtx->width; hypre_fprintf(fp,"%ld\n",h); hypre_fprintf(fp,"%ld\n",w); jump = mtx->globalHeight - h; for ( j = 0, p = mtx->value; j < w; j++ ) { for ( i = 0; i < h; i++, p++ ) hypre_fprintf(fp,"%.14e\n",*p); p += jump; } fclose(fp); return 0; }
void mv_TempMultiVectorByDiagonal( void* x_, HYPRE_Int* mask, HYPRE_Int n, double* diag, void* y_ ) { HYPRE_Int j; HYPRE_Int mx, my, m; void** px; void** py; HYPRE_Int* index; mv_TempMultiVector* x; mv_TempMultiVector* y; x = (mv_TempMultiVector*)x_; y = (mv_TempMultiVector*)y_; hypre_assert( x != NULL && y != NULL ); mx = aux_maskCount( x->numVectors, x->mask ); my = aux_maskCount( y->numVectors, y->mask ); m = aux_maskCount( n, mask ); hypre_assert( mx == m && my == m ); if ( m < 1 ) return; px = (void**) calloc( mx, sizeof(void*) ); hypre_assert( px != NULL ); py = (void**) calloc( my, sizeof(void*) ); hypre_assert( py != NULL ); index = (HYPRE_Int*)calloc( m, sizeof(HYPRE_Int) ); aux_indexFromMask( n, mask, index ); mv_collectVectorPtr( x->mask, x, px ); mv_collectVectorPtr( y->mask, y, py ); for ( j = 0; j < my; j++ ) { (x->interpreter->ClearVector)(py[j]); (x->interpreter->Axpy)(diag[index[j]-1],px[j],py[j]); } free(px); free(py); free( index ); }
void* hypre_ParCSRMultiVectorRead( MPI_Comm comm, void* ii_, const char* fileName ) { int i, n, id; FILE* fp; char fullName[128]; mv_TempMultiVector* x; mv_InterfaceInterpreter* ii = (mv_InterfaceInterpreter*)ii_; MPI_Comm_rank( comm, &id ); n = 0; do { sprintf( fullName, "%s.%d.%d", fileName, n, id ); if ( (fp = fopen(fullName, "r")) ) { n++; fclose( fp ); } } while ( fp ); if ( n == 0 ) return NULL; x = (mv_TempMultiVector*) malloc(sizeof(mv_TempMultiVector)); hypre_assert( x != NULL ); x->interpreter = ii; x->numVectors = n; x->vector = (void**) calloc( n, sizeof(void*) ); hypre_assert( x->vector != NULL ); x->ownsVectors = 1; for ( i = 0; i < n; i++ ) { sprintf( fullName, "%s.%d", fileName, i ); x->vector[i] = hypre_ParReadVector( comm, fullName ); } x->mask = NULL; x->ownsMask = 0; return x; }
/* this shallow copy of the mask is convenient but not safe; a proper copy should be considered */ void mv_TempMultiVectorSetMask( void* x_, HYPRE_Int* mask ) { mv_TempMultiVector* x = (mv_TempMultiVector*)x_; hypre_assert( x != NULL ); x->mask = mask; x->ownsMask = 0; }
void utilities_FortranMatrixAllocateData( hypre_longint h, hypre_longint w, utilities_FortranMatrix* mtx ) { hypre_assert( h > 0 && w > 0 ); hypre_assert( mtx != NULL ); if ( mtx->value != NULL && mtx->ownsValues ) free( mtx->value ); mtx->value = (double*) calloc( h*w, sizeof(double) ); hypre_assert ( mtx->value != NULL ); mtx->globalHeight = h; mtx->height = h; mtx->width = w; mtx->ownsValues = 1; }
void utilities_FortranMatrixWrap( double* v, hypre_longint gh, hypre_longint h, hypre_longint w, utilities_FortranMatrix* mtx ) { hypre_assert( h > 0 && w > 0 ); hypre_assert( mtx != NULL ); if ( mtx->value != NULL && mtx->ownsValues ) free( mtx->value ); mtx->value = v; hypre_assert ( mtx->value != NULL ); mtx->globalHeight = gh; mtx->height = h; mtx->width = w; mtx->ownsValues = 0; }
hypre_ParVector *hypre_ParVectorRead( MPI_Comm comm, const char *file_name ) { char new_file_name[80]; hypre_ParVector *par_vector; HYPRE_Int my_id, num_procs; HYPRE_Int *partitioning; HYPRE_Int global_size, i; FILE *fp; hypre_MPI_Comm_rank(comm,&my_id); hypre_MPI_Comm_size(comm,&num_procs); partitioning = hypre_CTAlloc(HYPRE_Int,num_procs+1); hypre_sprintf(new_file_name,"%s.INFO.%d",file_name,my_id); fp = fopen(new_file_name, "r"); hypre_fscanf(fp, "%d\n", &global_size); #ifdef HYPRE_NO_GLOBAL_PARTITION for (i=0; i < 2; i++) hypre_fscanf(fp, "%d\n", &partitioning[i]); fclose (fp); #else for (i=0; i < num_procs; i++) hypre_fscanf(fp, "%d\n", &partitioning[i]); fclose (fp); partitioning[num_procs] = global_size; #endif par_vector = hypre_CTAlloc(hypre_ParVector, 1); hypre_ParVectorComm(par_vector) = comm; hypre_ParVectorGlobalSize(par_vector) = global_size; #ifdef HYPRE_NO_GLOBAL_PARTITION hypre_ParVectorFirstIndex(par_vector) = partitioning[0]; hypre_ParVectorLastIndex(par_vector) = partitioning[1]-1; #else hypre_ParVectorFirstIndex(par_vector) = partitioning[my_id]; hypre_ParVectorLastIndex(par_vector) = partitioning[my_id+1]-1; #endif hypre_ParVectorPartitioning(par_vector) = partitioning; hypre_ParVectorOwnsData(par_vector) = 1; hypre_ParVectorOwnsPartitioning(par_vector) = 1; hypre_sprintf(new_file_name,"%s.%d",file_name,my_id); hypre_ParVectorLocalVector(par_vector) = hypre_SeqVectorRead(new_file_name); /* multivector code not written yet >>> */ hypre_assert( hypre_ParVectorNumVectors(par_vector) == 1 ); return par_vector; }
void mv_TempMultiVectorByMatrix( void* x_, HYPRE_Int rGHeight, HYPRE_Int rHeight, HYPRE_Int rWidth, double* rVal, void* y_ ) { HYPRE_Int i, j, jump; HYPRE_Int mx, my; double* p; void** px; void** py; mv_TempMultiVector* x; mv_TempMultiVector* y; x = (mv_TempMultiVector*)x_; y = (mv_TempMultiVector*)y_; hypre_assert( x != NULL && y != NULL ); mx = aux_maskCount( x->numVectors, x->mask ); my = aux_maskCount( y->numVectors, y->mask ); hypre_assert( mx == rHeight && my == rWidth ); px = (void**) calloc( mx, sizeof(void*) ); hypre_assert( px != NULL ); py = (void**) calloc( my, sizeof(void*) ); hypre_assert( py != NULL ); mv_collectVectorPtr( x->mask, x, px ); mv_collectVectorPtr( y->mask, y, py ); jump = rGHeight - rHeight; for ( j = 0, p = rVal; j < my; j++ ) { (x->interpreter->ClearVector)( py[j] ); for ( i = 0; i < mx; i++, p++ ) (x->interpreter->Axpy)(*p,px[i],py[j]); p += jump; } free(px); free(py); }
void mv_TempMultiVectorByMultiVector( void* x_, void* y_, HYPRE_Int xyGHeight, HYPRE_Int xyHeight, HYPRE_Int xyWidth, double* xyVal ) { /* xy = x'*y */ HYPRE_Int ix, iy, mx, my, jxy; double* p; void** px; void** py; mv_TempMultiVector* x; mv_TempMultiVector* y; x = (mv_TempMultiVector*)x_; y = (mv_TempMultiVector*)y_; hypre_assert( x != NULL && y != NULL ); mx = aux_maskCount( x->numVectors, x->mask ); hypre_assert( mx == xyHeight ); my = aux_maskCount( y->numVectors, y->mask ); hypre_assert( my == xyWidth ); px = (void**) calloc( mx, sizeof(void*) ); hypre_assert( px != NULL ); py = (void**) calloc( my, sizeof(void*) ); hypre_assert( py != NULL ); mv_collectVectorPtr( x->mask, x, px ); mv_collectVectorPtr( y->mask, y, py ); jxy = xyGHeight - xyHeight; for ( iy = 0, p = xyVal; iy < my; iy++ ) { for ( ix = 0; ix < mx; ix++, p++ ) *p = (x->interpreter->InnerProd)(px[ix],py[iy]); p += jxy; } free(px); free(py); }
void mv_TempMultiVectorClear( void* x_ ) { HYPRE_Int i; mv_TempMultiVector* x = (mv_TempMultiVector*)x_; hypre_assert( x != NULL ); for ( i = 0; i < x->numVectors; i++ ) if ( x->mask == NULL || (x->mask)[i] ) (x->interpreter->ClearVector)(x->vector[i]); }
void mv_TempMultiVectorByMultiVectorDiag( void* x_, void* y_, HYPRE_Int* mask, HYPRE_Int n, double* diag ) { /* diag = diag(x'*y) */ HYPRE_Int i, mx, my, m; void** px; void** py; HYPRE_Int* index; mv_TempMultiVector* x; mv_TempMultiVector* y; x = (mv_TempMultiVector*)x_; y = (mv_TempMultiVector*)y_; hypre_assert( x != NULL && y != NULL ); mx = aux_maskCount( x->numVectors, x->mask ); my = aux_maskCount( y->numVectors, y->mask ); m = aux_maskCount( n, mask ); hypre_assert( mx == my && mx == m ); px = (void**) calloc( mx, sizeof(void*) ); hypre_assert( px != NULL ); py = (void**) calloc( my, sizeof(void*) ); hypre_assert( py != NULL ); mv_collectVectorPtr( x->mask, x, px ); mv_collectVectorPtr( y->mask, y, py ); index = (HYPRE_Int*)calloc( m, sizeof(HYPRE_Int) ); aux_indexFromMask( n, mask, index ); for ( i = 0; i < m; i++ ) *(diag+index[i]-1) = (x->interpreter->InnerProd)(px[i],py[i]); free(index); free(px); free(py); }
void utilities_FortranMatrixGetDiagonal( utilities_FortranMatrix* mtx, utilities_FortranMatrix* vec ) { hypre_longint j, h, w, jump; double* p; double* q; hypre_assert( mtx != NULL && vec != NULL ); h = mtx->height; w = mtx->width; hypre_assert( vec->height >= h ); jump = mtx->globalHeight + 1; for ( j = 0, p = mtx->value, q = vec->value; j < w && j < h; j++, p += jump, q++ ) *q = *p; }