本文整理汇总了C++中dcopy函数的典型用法代码示例。如果您正苦于以下问题:C++ dcopy函数的具体用法?C++ dcopy怎么用?C++ dcopy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dcopy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: switch
void Tri::PutFace(double *from, int fac){
if(from)
switch(fac){
case 0:
dcopy(qa, from, 1, h[0], 1);
break;
case 1:
dcopy(qb, from, 1, h[0]+qa-1, qa);
break;
case 2:
dcopy(qb, from, 1, h[0], qa);
break;
default:
error_msg(GetFace -- unknown face);
break;
}
else
switch(fac){
case 0:
dzero(qa, h[0], 1);
break;
case 1:
dzero(qb, h[0]+qa-1, qa);
break;
case 2:
dzero(qb, h[0], qa);
break;
default:
error_msg(GetFace -- unknown face);
break;
}
}
开发者ID:archels,项目名称:ParaView,代码行数:32,代码来源:Misc.C
示例2: PackMatrixV
void PackMatrixV(double *a, int n, double *b, int bwidth, char trip){
register int i;
if(n>2*bwidth){ /* banded symmetric lower triangular form */
double *s;
if(trip == 'l'){
for(i = 0,s=b; i < n-bwidth; ++i,s+=bwidth)
dcopy(bwidth,a+i*n+i,1,s,1);
for(i = n-bwidth; i < n; ++i,s+=bwidth)
dcopy(n-i,a+i*n+i,1,s,1);
}
else
error_msg(banded upper form not set up in PackMatrixV);
}
else{
register int j;
if(trip == 'l'){
/* symmetric lower triangular form */
for(i=0, j=0; i < n; j+=n-i++)
dcopy(n-i, a+i*n+i, 1, b+j, 1);
}
else{
/* symmetric upper triangular form */
for(i=0, j=0; i < n; j+= ++i)
dcopy(i+1, a+i*n, 1, b+j, 1);
}
}
}
开发者ID:HerculesCE,项目名称:ParaView,代码行数:30,代码来源:MatrixR.C
示例3: set_order
void set_order(int Je)
{
tmp_order = Je;
dcopy(3, Alpha_SS[Je-1], 1, Alpha_Int, 1);
dcopy(3, Beta_SS[Je-1], 1, Beta_Int, 1);
Gamma_Int = Gamma_SS[Je-1];
}
开发者ID:Holygitzdq,项目名称:ElVis,代码行数:7,代码来源:Integrate.C
示例4: collectAfterPre
void collectAfterPre(Vector u, const Vector v)
{
int source, dest;
if (u->comm_rank == 0) {
int len=u->len-1;
dcopy(&len, v->data, &v->stride, u->data+1, &u->stride);
} else if (u->comm_rank == u->comm_size-1) {
int len=v->len-1;
dcopy(&len, v->data+1, &v->stride, u->data+1, &u->stride);
} else
copyVector(u, v);
// west
double recv;
MPI_Cart_shift(*u->comm, 0, -1, &source, &dest);
MPI_Sendrecv(v->data, 1, MPI_DOUBLE, dest, 0,
u->data, 1, MPI_DOUBLE, source, 0, *u->comm, MPI_STATUS_IGNORE);
if (source > -1)
u->data[u->len-2] += u->data[0];
// east
MPI_Cart_shift(*u->comm, 0, 1, &source, &dest);
MPI_Sendrecv(v->data+v->len-1, 1, MPI_DOUBLE, dest, 1,
u->data, 1, MPI_DOUBLE, source, 1, *u->comm, MPI_STATUS_IGNORE);
if (source > -1)
u->data[1] += u->data[0];
u->data[0] = u->data[u->len-1] = 0.0;
}
开发者ID:akva2,项目名称:tma4280,代码行数:29,代码来源:poisson1D-MPI.c
示例5: strdup
Grid::Grid(Grid *Orig){
int i;
domainname = strdup(Orig->domainname);
domainfile = Orig->domainfile;
totverts = Orig->totverts;
xcoords = dvector(0, totverts-1);
ycoords = dvector(0, totverts-1);
zcoords = dvector(0, totverts-1);
dcopy(totverts, Orig->xcoords, 1, xcoords, 1);
dcopy(totverts, Orig->ycoords, 1, ycoords, 1);
dcopy(totverts, Orig->zcoords, 1, zcoords, 1);
nel = Orig->nel;
nverts = ivector(0, nel-1);
icopy(nel, Orig->nverts, 1, nverts, 1);
vertids = imatrix(0, nel-1, 0, Max_Nverts-1);
icopy(nel*Max_Nverts, Orig->vertids[0], 1, vertids[0], 1);
elmtids = ivector(0, nel-1);
icopy(nel, Orig->elmtids, 1, elmtids, 1);
vertexmap = imatrix(0, nel-1, 0, Max_Nverts-1);
icopy(nel*Max_Nverts, Orig->vertexmap[0], 1, vertexmap[0], 1);
}
开发者ID:HerculesCE,项目名称:ParaView,代码行数:27,代码来源:orienter.C
示例6: mtx_copy
void mtx_copy( Tmtx_ptr from, Tmtx_ptr to )
{
#ifdef DEBUG
// check that the matrix we are copying from is initialised
ASSERT_MSG( from->init, "mtx_copy() : attempt to copy from uninitialised matrix" );
#endif
// initialise the target matrix
if( to->init )
mtx_free( to );
mtx_init( to, from->nrows, from->ncols );
// copy the data
dcopy( from->nrows*from->ncols, from->dat, 1, to->dat, 1 );
if( from->tau )
{
if( to->nrows>to->ncols )
{
to->tau = (double*)malloc( to->nrows*sizeof(double) );
dcopy( from->nrows, from->tau, 1, to->tau, 1 );
}
else
{
to->tau = (double*)malloc( to->ncols*sizeof(double) );
dcopy( from->ncols, from->tau, 1, to->tau, 1 );
}
}
}
开发者ID:jackd,项目名称:FVMPor,代码行数:28,代码来源:linalg_dense.c
示例7: set_order_CNAB_adj
void set_order_CNAB_adj(int Je)
{
dcopy(3, Alpha_CNAB[Je-1], 1, Alpha_Int, 1);
dcopy(3, Beta_CNAB_adj[Je-1], 1, Beta_Int, 1);
Gamma_Int = Gamma_CNAB[Je-1];
if(Je == 3)
{
fprintf(stderr,"Need to set up appropriate adjoint weight for Je=3\n");
exit(1);
}
}
开发者ID:Holygitzdq,项目名称:ElVis,代码行数:11,代码来源:Integrate.C
示例8: offload_dGetVector
void offload_dGetVector(int n, double *x, int incx, double *y, int incy){
/*
* copy x at device to y at host
* incx is the index increment of x, incy is the index increment of y
* n elements are copied
* algorithm works for negative values of incx and incy, but gives undefined behavior
*/
// assert(n >= 0);
// copy x to DBUFFER, offload transfer out to DBUFFER, copy to y
offload_Sync();
int incB = 1;
int start = 0;
int end = start + BUFFERSIZE - 1;
end = MIN(end, n - 1);
int length = MIN(end - start + 1, BUFFERSIZE);
int tlength;
double *ystart = y + start*incy;
double *tystart;
intptr_t xptr = (intptr_t)x;
offload_Sync();
#pragma offload target(mic:MYDEVICE) out(DBUFFER:length(length) alloc_if(0) free_if(0)) \
in(xptr,incx,length,incx,incB)
{
double *xstart = ((double*)xptr) + start*incx;
dcopy(&length, xstart, &incx, DBUFFER, &incB);
}
start = end + 1;
for(; start < n; start = end + 1){
end = start + BUFFERSIZE - 1;
end = MIN(end, n - 1);
tlength = length;
length = MIN(end - start + 1, BUFFERSIZE);
tystart = ystart;
ystart = y + start*incy;
#pragma offload target(mic:MYDEVICE) nocopy(DBUFFER:alloc_if(0) free_if(0)) \
in(xptr,incx,length,incx,incB) signal(&WAIT)
{
double *xstart = ((double*)xptr) + start*incx;
dcopy(&length, xstart, &incx, DBUFFER, &incB);
}
dcopy(&tlength, DBUFFER, &incB, tystart, &incy);
#pragma offload_transfer target(mic:MYDEVICE) out(DBUFFER:length(length) alloc_if(0) free_if(0)) wait(&WAIT)
}
dcopy(&length, DBUFFER, &incB, ystart, &incy);
SYNC = true;
}
开发者ID:ryancoleman,项目名称:lotsofcoresbook1code,代码行数:48,代码来源:ooc_offload.async.cpp
示例9: slope_fn_block
/* compute the slope vector dy for the transient equation
* dy + cy = p. useful in the transient solver
*/
void slope_fn_block(block_model_t *model, double *y, double *p, double *dy)
{
/* shortcuts */
int n = model->n_nodes;
double **c = model->c;
/* for our equation, dy = p - cy */
#if (MATHACCEL == MA_INTEL || MATHACCEL == MA_APPLE)
/* dy = p */
cblas_dcopy(n, p, 1, dy, 1);
/* dy = dy - c*y = p - c*y */
cblas_dgemv(CblasRowMajor, CblasNoTrans, n, n, -1, c[0],
n, y, 1, 1, dy, 1);
#elif (MATHACCEL == MA_AMD || MATHACCEL == MA_SUN)
/* dy = p */
dcopy(n, p, 1, dy, 1);
/* dy = dy - c*y = p - c*y */
dgemv('T', n, n, -1, c[0], n, y, 1, 1, dy, 1);
#else
int i;
double *t = dvector(n);
matvectmult(t, c, y, n);
for (i = 0; i < n; i++)
dy[i] = p[i]-t[i];
free_dvector(t);
#endif
}
开发者ID:cyndwith,项目名称:ThermalAware-FloorPlanning,代码行数:30,代码来源:temperature_block.c
示例10: dcopy
void Quad::fillvec(Mode *v, double *f){
register int i;
for(i = 0; i < qb; ++i)
dcopy(qa,v->a,1,f+i*qa,1);
for(i = 0; i < qa; ++i)
dvmul(qb,v->b,1,f+i,qa,f+i,qa);
}
开发者ID:archels,项目名称:ParaView,代码行数:8,代码来源:Misc.C
示例11: dtransp
void dtransp(long m, long n, double *in, double *out)
{
long i,j;
j = 1;
for (i=0; i<m; i++) {
dcopy(&n, &in[i], &m, &out[i*n], &j);
}
}
开发者ID:Jackyhaorockman,项目名称:TT-Toolbox,代码行数:8,代码来源:eig3d_primme.c
示例12: collectMatrix
void collectMatrix(Matrix u)
{
#ifdef HAVE_MPI
int source, dest;
// south
MPI_Cart_shift(*u->as_vec->comm, 1, -1, &source, &dest);
MPI_Sendrecv(u->data[1]+1, u->rows-2, MPI_DOUBLE, dest, 0,
u->data[u->cols-1]+1, u->rows-2, MPI_DOUBLE, source, 0,
*u->as_vec->comm, MPI_STATUS_IGNORE);
// north
MPI_Cart_shift(*u->as_vec->comm, 1, 1, &source, &dest);
MPI_Sendrecv(u->data[u->cols-2]+1, u->rows-2, MPI_DOUBLE, dest, 1,
u->data[0]+1, u->rows-2, MPI_DOUBLE, source, 1,
*u->as_vec->comm, MPI_STATUS_IGNORE);
Vector sendBuf = createVector(u->cols-2);
Vector recvBuf = createVector(u->cols-2);
// west
MPI_Cart_shift(*u->as_vec->comm, 0, -1, &source, &dest);
if (dest != MPI_PROC_NULL)
copyVectorDispl(sendBuf, u->row[1], u->cols-2, 1);
MPI_Sendrecv(sendBuf->data, sendBuf->len, MPI_DOUBLE, dest, 2,
recvBuf->data, recvBuf->len, MPI_DOUBLE, source, 2,
*u->as_vec->comm, MPI_STATUS_IGNORE);
if (source != MPI_PROC_NULL)
dcopy(&recvBuf->len, recvBuf->data, &recvBuf->stride,
u->row[u->rows-1]->data+u->rows, &u->rows);
// east
MPI_Cart_shift(*u->as_vec->comm, 0, 1, &source, &dest);
if (dest != MPI_PROC_NULL)
copyVectorDispl(sendBuf, u->row[u->rows-2], u->cols-2, 1);
MPI_Sendrecv(sendBuf->data, sendBuf->len, MPI_DOUBLE, dest, 2,
recvBuf->data, recvBuf->len, MPI_DOUBLE, source, 2,
*u->as_vec->comm, MPI_STATUS_IGNORE);
if (source != MPI_PROC_NULL)
dcopy(&recvBuf->len, recvBuf->data, &recvBuf->stride,
u->row[0]->data+u->rows, &u->rows);
freeVector(sendBuf);
freeVector(recvBuf);
#endif
}
开发者ID:georgekw,项目名称:tma4280,代码行数:45,代码来源:common.c
示例13: switch
bool rDenseMatrix::copyFrom(rDenseMatrix& other)
{
if (this == &other) {
return _SUCCESS;
}
int length;
switch(other.De_Di) {
case DENSE:
De_Di = DENSE;
if (de_ele && (other.nRow!=nRow || other.nCol!=nCol)) {
delete[] de_ele;
de_ele = NULL;
}
nRow = other.nRow;
nCol = other.nCol;
if (de_ele==NULL) {
rNewCheck();
de_ele = new double[nRow*nCol];
if (de_ele==NULL) {
rError("rDenseMatrix:: memory exhausted");
}
}
length = nRow*nCol;
dcopy(&length,other.de_ele,&IONE,de_ele,&IONE);
break;
case DIAGONAL:
De_Di = DIAGONAL;
if (di_ele && (other.nRow!=nRow || other.nCol!=nCol)) {
delete[] di_ele;
di_ele = NULL;
}
nRow = other.nRow;
nCol = other.nCol;
if (di_ele==NULL) {
rNewCheck();
di_ele = new double[nCol];
if (di_ele==NULL) {
rError("rDenseMatrix:: memory exhausted");
}
}
dcopy(&nCol,other.di_ele,&IONE,di_ele,&IONE);
break;
}
return _SUCCESS;
}
开发者ID:gilso,项目名称:Packages,代码行数:45,代码来源:rsdpa_struct.cpp
示例14: Matrix_RemoveRow
/* Assumes column-major */
void Matrix_RemoveRow(PT_Matrix pA, ptrdiff_t row)
{
/* ASSERT(pA->rows > 0)*/
dcopy(&(Matrix_Cols(pA)),
&(C_SEL(pA,Matrix_Rows(pA)-1,0)), &(pA->rows_alloc),
&(C_SEL(pA,row,0)), &(pA->rows_alloc));
pA->rows = pA->rows - 1;
}
开发者ID:ssketch,项目名称:motorControl,代码行数:10,代码来源:lcp_matrix.c
示例15: KTR_dcopy
void KNITRO_EXPORT KTR_dcopy (const int n,
const double * const x,
const int incx,
double * const y,
const int incy)
{
dcopy (n, x, incx, y, incy);
return;
}
开发者ID:sductor,项目名称:DimaX,代码行数:9,代码来源:blasAcmlExample.c
示例16: dcopy
//=============================================================================//
matrix::matrix(const matrix &t)
{
rows=t.rows;
cols=t.cols;
int size=rows*cols;
int one=1;
array1d= new double[size];
dcopy(&size,t.array1d,&one,array1d,&one);
}
开发者ID:ezahedin,项目名称:DE_Self-Consistent,代码行数:10,代码来源:matrix.cpp
示例17: interpolate
static void interpolate (void)
/* ------------------------------------------------------------------------- *
* Interpolate from the GLL mesh to an evenly-spaced mesh.
* ------------------------------------------------------------------------- */
{
register int k, m, nplane_new;
const int nplane_old = nr * ns * nel;
const double *imr, *itmr, *ims, *itms;
double *mesh_x, *mesh_y;
double **newplane = (double**) malloc (nz * sizeof (double*));
switch (np) {
case 0: /* interpolation turned off */
return;
break;
case 1: /* no size specified ... use (NR|NS) */
np = MAX (nr, ns);
break;
default: /* size specified on the command line */
break;
}
nplane_new = np * np * nel;
/* -- Compute interpolation matrices. */
proj (&imr, &itmr, nr, GLJ, 0.0, 0.0, np, TRZ, 0.0, 0.0);
proj (&ims, &itms, ns, GLJ, 0.0, 0.0, np, TRZ, 0.0, 0.0);
/* -- Interpolate the mesh. */
mesh_x = do_interp (imr, itmr, ims, itms, x);
mesh_y = do_interp (imr, itmr, ims, itms, y);
free (x); x = mesh_x;
free (y); y = mesh_y;
/* -- Interpolate data plane-by-plane. */
for (k = 0; k < nfields; k++) {
for (m = 0; m < nz; m++)
newplane[m] = do_interp (imr, itmr, ims, itms, data[k] + m * nplane_old);
free (data[k]);
data[k] = (double*) malloc (nplane_new * nzp * sizeof (double));
for (m = 0; m < nz; m++) {
dcopy (nplane_new, newplane[m], 1, data[k] + m * nplane_new, 1);
free (newplane[m]);
}
}
nr = ns = np;
}
开发者ID:hellabyte,项目名称:semtex,代码行数:57,代码来源:sem2tec.c
示例18: Matrix_ReplaceRow
/* Replaces a row with the given vector */
void Matrix_ReplaceRow(PT_Matrix pA, ptrdiff_t krow, double *vec)
{
ptrdiff_t incx = 1;
/* ASSERT(krow < pA->rows)*/
dcopy(&(Matrix_Cols(pA)),
vec, &incx,
&(C_SEL(pA,krow,0)), &(pA->rows_alloc));
}
开发者ID:ssketch,项目名称:motorControl,代码行数:10,代码来源:lcp_matrix.c
示例19: Matrix_ReplaceCol
/* Replaces a column with the given vector */
void Matrix_ReplaceCol(PT_Matrix pA, ptrdiff_t kcol, double *vec)
{
ptrdiff_t incx = 1;
/* ASSERT(kcol < pA->cols)*/
dcopy(&(Matrix_Rows(pA)),
vec, &incx,
&(C_SEL(pA,0,kcol)), &incx);
}
开发者ID:ssketch,项目名称:motorControl,代码行数:10,代码来源:lcp_matrix.c
示例20: decopy
INT NS_DIM_PREFIX decopy (MULTIGRID *mg, INT fl, INT tl, INT mode, EVECDATA_DESC *x, const EVECDATA_DESC *y)
{
INT i,ret,level;
ret=dcopy(mg,fl,tl,mode,x->vd,y->vd); if (ret!=NUM_OK) return ret;
for (level=fl; level<=tl; level++)
for (i=0; i<x->n; i++) EVDD_E(x,level,i)=EVDD_E(y,level,i);
return NUM_OK;
}
开发者ID:rolk,项目名称:ug,代码行数:10,代码来源:ugeblas.c
注:本文中的dcopy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论