示例#1
0
STDMETHODIMP CCoAutoRun::ShellExec(BSTR verb, BSTR program, VARIANT parameter, int* ret)
{
	CComVariant vParam(parameter);
	ATLENSURE_SUCCEEDED( vParam.ChangeType(VT_BSTR) );

	HINSTANCE sret = ::ShellExecute(
		hWndMainFrame, COLE2CT(verb), COLE2CT(program), COLE2CT(vParam.bstrVal), NULL, SW_NORMAL);
	*ret = reinterpret_cast<int>(sret);
	return S_OK;
}
示例#2
0
文件: CQLRIO.cpp 项目: jdc2172/clop
/////////////////////////////////////////////////////////////////////////////
// Write data files for plotting 1D distribution
/////////////////////////////////////////////////////////////////////////////
void CQLRIO::Distrib(CRegression &reg, const std::string &sPrefix)
{
 {
  std::ostringstream oss;
  oss << sPrefix << "MAP.dat";
  std::ofstream ofs(oss.str().c_str());
  CQLRIO::Plot(ofs, reg.GetPF(), reg.MAP());
 }

 {
  std::ostringstream ossRandom;
  ossRandom << sPrefix << "random.dat";
  std::ofstream ofs(ossRandom.str().c_str());

  std::ostringstream ossMax;
  ossMax << sPrefix << "max.dat";
  std::ofstream ofsMax(ossMax.str().c_str());

  CRandom<unsigned> rnd;

  const int PosteriorSamples = 50;

  for (int i = PosteriorSamples; --i >= 0;)
  {
   std::vector<double> vParam(reg.GetPF().GetParameters());
//   reg.GaussianSample(rnd, vParam);
   reg.MCMCSample(rnd, vParam, 20);

   if (reg.GetPF().GetDimensions() <= 1 || i < 5)
   {
    CQLRIO::Plot(ofs, reg.GetPF(), &vParam[0]);
    ofs << '\n';
   }

   std::vector<double> vMax(reg.GetPF().GetDimensions());
   if (reg.GetPF().GetMax(&vParam[0], &vMax[0]))
   {
    for (unsigned j = 0; j < vMax.size(); j++)
     ofsMax << std::setw(13) << vMax[j];
    ofsMax << std::setw(13) << reg.GetPF().GetValue(&vParam[0], &vMax[0]);
    ofsMax << '\n';
   }
  }
 }
}
示例#3
0
/////////////////////////////////////////////////////////////////////////////
// Posterior Samples
/////////////////////////////////////////////////////////////////////////////
void CTikZTwoD::Posterior(int Samples,
                          CRegression &reg,
                          CRandom<unsigned> &rnd)
{
 *pout << "\\begin{scope}[green]\n";
 {
  std::vector<double> vParam(reg.GetPF().GetParameters());
  std::vector<double> v(2);

  for (int i = Samples; --i >= 0;)
  {
   reg.GaussianSample(rnd, vParam);
   reg.GetPF().GetMax(&vParam[0], &v[0]);
   CPGF::Cross(*pout, v[0] * Scale, v[1] * Scale, Radius * Scale);
  }
 }
 *pout << "\\pgfusepathqstroke\n";
 *pout << "\\end{scope}\n";
}