コード例 #1
0
//-------------------------------------------------------------------------
void W::writeMixtureGDRaw(const MixtureGD& m)
{
  unsigned long i;
  writeString("GD");
  writeUInt4(m.getId().length());
  writeString(m.getId());
  writeUInt4(m.getDistribCount());

  for (i=0; i< m.getDistribCount(); i++)
  {
    DistribGD& d = m.getDistrib(i);

    writeUInt4(d.dictIndex(K::k));
    writeDouble(m.weight(i));
  }
}
コード例 #2
0
//-------------------------------------------------------------------------
void W::writeMixtureGDXml(const MixtureGD& m)
{
  unsigned long i;
  writeString("\n\t<MixtureGD");
  writeAttribute("id", m.getId());
  writeAttribute("distribCount", m.getDistribCount());
  writeString(">");

  for (i=0; i< m.getDistribCount(); i++)
  {
    DistribGD& d = m.getDistrib(i);
    writeString("\n\t\t<DistribGD");
    writeAttribute("i", i);
    writeAttribute("dictIdx", d.dictIndex(K::k));
    writeAttribute("weight", m.weight(i));
    writeString("/>");
  }
  writeString("\n\t</MixtureGD>");
}