Esempio n. 1
0
void ColumnBundle::setSub(int colStart, const ColumnBundle& Y)
{	myassert(colStart>=0);
	myassert(colStart<nCols());
	myassert(colLength()==Y.colLength());
	int nColsSub = std::min(Y.nCols(), nCols()-colStart);
	callPref(eblas_copy)(dataPref()+colStart*colLength(), Y.dataPref(), nColsSub*colLength());
}
Esempio n. 2
0
ColumnBundle ColumnBundle::getSub(int colStart, int colStop) const
{	myassert(colStart>=0);
	myassert(colStop<=nCols());
	int nColsSub = colStop - colStart;
	myassert(nColsSub>0);
	ColumnBundle ret = this->similar(nColsSub);
	callPref(eblas_copy)(ret.dataPref(), dataPref()+colStart*colLength(), nColsSub*colLength());
	return ret;
}
Esempio n. 3
0
// Called by other constructors to do the work
void ColumnBundle::init(int nc, size_t len, const Basis *b, const QuantumNumber* q, bool onGpu)
{
	ncols = nc;
	col_length = len;
	basis = b;
	qnum = q;

	if(nCols() == 0) { memFree(); return; } //must be default constructor or assignment to empty ColumnBundle
	myassert(colLength() != 0);
	memInit("ColumnBundle", nCols()*colLength(), onGpu); //in base class ManagedMemory
}
Esempio n. 4
0
// Randomize with a high frequency cutoff of 0.75 hartrees
void ColumnBundle::randomize(int colStart, int colStop)
{	myassert(basis->nbasis==colLength() || 2*basis->nbasis==colLength());
	complex* thisData = data(); //currently only on cpu
	for(size_t j=0; j<colLength(); j++)
	{	size_t jBasis = (j < basis->nbasis) ? j : (j - basis->nbasis);
		vector3<> kplusG = basis->iGarr[jBasis] + qnum->k;
		double KE = 0.5*dot(kplusG, basis->gInfo->GGT*kplusG);
		double t = KE/0.75;
		double sigma = 1.0/(1.0+t*t*t*t*t*t);
		for(int i=colStart; i < colStop; i++)
			thisData[index(i,j)] = Random::normalComplex(sigma);
	}
}
Esempio n. 5
0
int
OracleResultSet::colLength(const char * colname) {
    ORSMetaData::iterator beg = _meta.begin();
    ORSMetaData::iterator end = _meta.end();
    int idx = -1;
    while (beg != end) {
        ++idx;
        if ((*beg).colName.compare(colname) == 0) {
            return colLength(idx);
        }
        ++beg;
    }
    PANICV("No such column!  [%s]",  colname );
}