void dslashQuda(void *h_out, void *h_in, QudaInvertParam *inv_param, QudaParity parity) { ColorSpinorParam cpuParam(h_in, *inv_param, gaugePrecise->X(), 1); ColorSpinorParam cudaParam(cpuParam, *inv_param); cpuColorSpinorField hIn(cpuParam); cudaColorSpinorField in(hIn, cudaParam); cudaParam.create = QUDA_NULL_FIELD_CREATE; cudaColorSpinorField out(in, cudaParam); if (inv_param->dirac_order == QUDA_CPS_WILSON_DIRAC_ORDER) { if (parity == QUDA_EVEN_PARITY) { parity = QUDA_ODD_PARITY; } else { parity = QUDA_EVEN_PARITY; } axCuda(gaugePrecise->Anisotropy(), in); } bool pc = true; DiracParam diracParam; setDiracParam(diracParam, inv_param, pc); Dirac *dirac = Dirac::create(diracParam); // create the Dirac operator dirac->Dslash(out, in, parity); // apply the operator delete dirac; // clean up cpuParam.v = h_out; cpuColorSpinorField hOut(cpuParam); out.saveCPUSpinorField(hOut); // since this is a reference, this won't work: hOut = out; }
void CategoryDlg::InitializeLists() { CListBox inBox(GetDlgItem(IDC_INCLUDE_LIST)); CListBox exBox(GetDlgItem(IDC_EXCLUDE_LIST)); ClearListBox(inBox); ClearListBox(exBox); int inWidth = 0; int exWidth = 0; ScopedGdiObjectSelection hIn(inBox.GetDC(), inBox.GetFont()); ScopedGdiObjectSelection hEx(exBox.GetDC(), exBox.GetFont()); for (auto it = m_categories.begin(); it != m_categories.end(); ++it) { if (it->second) { inBox.AddString(WStr(it->first)); inWidth = std::max(inWidth, GetTextWidth(inBox.GetDC(), it->first)); } else { exBox.AddString(WStr(it->first)); exWidth = std::max(exWidth, GetTextWidth(exBox.GetDC(), it->first)); } } inBox.SetHorizontalExtent(inWidth + 3*GetSystemMetrics(SM_CXBORDER)); exBox.SetHorizontalExtent(exWidth + 3*GetSystemMetrics(SM_CXBORDER)); UpdateUiState(); }
void MatDagMatQuda(void *h_out, void *h_in, QudaInvertParam *inv_param) { bool pc = (inv_param->solution_type == QUDA_MATPC_SOLUTION || inv_param->solution_type == QUDA_MATPCDAG_MATPC_SOLUTION); ColorSpinorParam cpuParam(h_in, *inv_param, gaugePrecise->X(), pc); ColorSpinorParam cudaParam(cpuParam, *inv_param); cpuColorSpinorField hIn(cpuParam); cudaColorSpinorField in(hIn, cudaParam); cudaParam.create = QUDA_NULL_FIELD_CREATE; cudaColorSpinorField out(in, cudaParam); // double kappa = inv_param->kappa; // if (inv_param->dirac_order == QUDA_CPS_WILSON_DIRAC_ORDER) kappa *= gaugePrecise->anisotropy; DiracParam diracParam; setDiracParam(diracParam, inv_param, pc); Dirac *dirac = Dirac::create(diracParam); // create the Dirac operator dirac->MdagM(out, in); // apply the operator delete dirac; // clean up double kappa = inv_param->kappa; if (pc) { if (inv_param->mass_normalization == QUDA_MASS_NORMALIZATION) { axCuda(1.0/pow(2.0*kappa,4), out); } else if (inv_param->mass_normalization == QUDA_ASYMMETRIC_MASS_NORMALIZATION) { axCuda(0.25/(kappa*kappa), out); } } else { if (inv_param->mass_normalization == QUDA_MASS_NORMALIZATION || inv_param->mass_normalization == QUDA_ASYMMETRIC_MASS_NORMALIZATION) { axCuda(0.25/(kappa*kappa), out); } } cpuParam.v = h_out; cpuColorSpinorField hOut(cpuParam); out.saveCPUSpinorField(hOut); // since this is a reference, this won't work: hOut = out; }