Esempio n. 1
0
	void doOneOmega(SizeType it, RealType omega, SizeType threadNum)
	{
		HilbertStateType phiKet0 = phiKet0_;
		HilbertStateType phiKet1 = phiKet1_;
		RealType epsilon = 0.1;
		ComplexType z = ComplexType(omega, epsilon);
		OpDiagonalFactoryType opDiagonalFactory(params_.engine);
		for (SizeType dynType = 0; dynType < 2; ++dynType) {

			RealType signForDen = (dynType == 1) ? -1.0 : 1.0;
			OneOverZminusHType eih(z, signForDen, params_.Eg, params_.engine);
			DiagonalOperatorType& eihOp = opDiagonalFactory(eih);
			if (dynType == 0)
				eihOp.applyTo(phiKet0);
			else
				eihOp.applyTo(phiKet1);
		}

		for (SizeType site1 = 0; site1 < params_.sites; ++site1) {
			result_(it, site1) = doOneOmegaOneSitePair(site1,
			                                          threadNum,
			                                          phiKet0,
			                                          phiKet1);
			std::cerr<<"site1="<<site1<<" "<<result_(it, site1)<<"\n";
		}
	}
Esempio n. 2
0
void RSquaredFieldCurran::RecomputeData(
        const DataBoxAccess& box) const {
    SimpleProfiler prof("RSquaredFieldCurran");
    typedef Tensor<DataMesh> TDm;

    // Retrieve and validate items from DataBox
    const Mesh& mesh = box.Get<Mesh>("Mesh");
    const int dim = mesh.Dim();
    const MyVector<DataMesh>& coords =
            box.Get<MyVector<DataMesh> >("GlobalCoords");
    REQUIRE(3 == dim, "Only coded in three dimensions");
    REQUIRE(coords.Size() == dim, "Dim of GlobalCoords does not match Mesh");

    // Initialize result
    if (result_.Empty() || (mesh != result_(0))) {
        result_.assign(dim, "1", mesh);
    }

    // Perform the computation
    const DataMesh r3 = pow(coords[0]*coords[0] + coords[1]*coords[1] +
                            coords[2]*coords[2], 1.5);
    for (int i = 0; i < dim; ++i) {
        result_(i) = coords[i] / r3;
    }
}
Esempio n. 3
0
//--------------------------------------------------------------
ofVec2f PACManUnit::getRangePos(int iside)
{
	ofVec2f result_(0);
	switch(iside % 4)
	{
	case 0:
		{
			result_.x = ofRandomWidth();
			result_.y = 0;
		}
		break;
	case 1:
		{
			result_.x = ofRandomWidth();
			result_.y = ofGetHeight();
		}
		break;
	case 2:
		{
			result_.x = 0;
			result_.y = ofRandomHeight();
		}
		break;
	case 3:
		{
			result_.x = ofGetWidth();
			result_.y = ofRandomHeight();
		}
		break;
	}
	return result_;
}
Esempio n. 4
0
	void print(std::ostream& os) const
	{
		for (SizeType it = 0; it< result_.n_row(); it++) {
			RealType omega = it * step_ + offset_;
			os<<omega<<" ";
			for (SizeType site1 = 0; site1 < result_.n_col(); ++site1) {
				ComplexType val = result_(it,site1);
				os<<PsimagLite::real(val)<<" "<<PsimagLite::imag(val)<<" ";
			}

			os<<"\n";
		}
	}
Esempio n. 5
0
void NseManager::showNseHelp(const QStringList parameters, QByteArray result, QByteArray errors)
{
    Q_UNUSED(errors);
    // show help result for nse
    if (m_thread) {
        m_thread->quit();
        m_thread->wait();
        delete m_thread;
    }

    QString result_(result);
    QTextDocument *document = new QTextDocument(result_);
    // insert document on cache
    m_nseHelpCache.insert(parameters[parameters.size() - 1], document);
    // load document
    m_ui->m_dialogUi->nseTextHelp->setDocument(document);
}
Esempio n. 6
0
static bool convolve_32F(InputArray _image, InputArray _templ, OutputArray _result)
{
    _result.create(_image.rows() - _templ.rows() + 1, _image.cols() - _templ.cols() + 1, CV_32F);

    if (_image.channels() == 1)
        return(convolve_dft(_image, _templ, _result));
    else
    {
        UMat image = _image.getUMat();
        UMat templ = _templ.getUMat();
        UMat result_(image.rows-templ.rows+1,(image.cols-templ.cols+1)*image.channels(), CV_32F);
        bool ok = convolve_dft(image.reshape(1), templ.reshape(1), result_);
        if (ok==false)
            return false;
        UMat result = _result.getUMat();
        return (extractFirstChannel_32F(result_, _result, _image.channels()));
    }
}
Esempio n. 7
0
void NseManager::showNseScriptHelp(const QStringList parameters, QByteArray result, QByteArray errors)
{
    // result for script search
    Q_UNUSED(errors);
    Q_UNUSED(parameters);
    // show help result for nse
    if (m_threadScript) {
        m_threadScript->quit();
        m_threadScript->wait();
        delete m_threadScript;
    }

    QString result_(result);

    if (m_documentScript) {
        delete m_documentScript;
    }

    m_documentScript = new QTextDocument(result_);
    m_ui->m_dialogUi->textScriptHelp->setDocument(m_documentScript);
}