void Num_dcopy_primme(int n, double *x, int incx, double *y, int incy) { PRIMME_BLASINT ln = n; PRIMME_BLASINT lincx = incx; PRIMME_BLASINT lincy = incy; DCOPY(&ln, x, &lincx, y, &lincy); }
void copy(const Matrix& a, Matrix& b) { if ((b.Nrows() != a.Nrows()) || (b.Ncols() != a.Ncols())) b.ReSize(a.Nrows(), a.Ncols()); #ifdef BLAS DCOPY((FORTINT) a.Storage(), a.Store(), (FORTINT) 1, b.Store(), (FORTINT) 1); #else b = a; #endif }
void SpinAdapted::CatenateProduct (const ObjectMatrix<Matrix*>& a, Matrix& b, bool allocate) { try { std::vector<int> indexRows (a.Nrows ()); std::vector<int> indexCols (a.Ncols ()); int rowLength = 0; int colLength = 0; for (int i = 0; i < indexRows.size (); ++i) { indexRows [i] = (i > 0) ? a (i - 1,0)->Nrows () + indexRows [i - 1] : 1; rowLength += a (i,0)->Nrows (); } for (int i = 0; i < indexCols.size (); ++i) { indexCols [i] = (i > 0) ? a (0,i - 1)->Ncols () + indexCols [i - 1] : 1; colLength += a (0,i)->Ncols (); } if (!allocate) assert (b.Nrows () == rowLength && b.Ncols () == colLength); // precondition else b.ReSize (rowLength, colLength); for (int i = 0; i < a.Nrows (); ++i) for (int j = 0; j < a.Ncols (); ++j) { #ifdef BLAS int bcols = b.Ncols(); double* bptr = b.Store() + bcols * (indexRows[i] - 1) + (indexCols[j] - 1); Matrix* aij = a(i, j); double* aptr = aij->Store(); int nrows = aij->Nrows(); int ncols = aij->Ncols(); for (int r = 0; r < nrows; ++r) { DCOPY(ncols, aptr, 1, bptr, 1); aptr += ncols; bptr += bcols; } #else b.SubMatrix (indexRows [i], indexRows [i] + a (i,j)->Nrows () - 1, indexCols [j], indexCols [j] + a (i,j)->Ncols () - 1) = *(a (i,j)); #endif } } catch (Exception) { pout << Exception::what () << endl; abort (); } }
void F77_NAME(dcopy)(const int *n, const double *dx, const int *incx, double *dy, const int *incy) { DCOPY(n, dx, incx, dy, incy); }
/* Interface to FORTRAN routine DCOPY. */ void IpBlasDcopy(Index size, const Number *x, Index incX, Number *y, Index incY) { ipfint N=size, INCX=incX, INCY=incY; DCOPY(&N, x, &INCX, y, &INCY); }