Ejemplo n.º 1
0
void logisticloss::proxoperator(LocalDenseMatrixType& X, double lambda, LocalTargetMatrixType& T, LocalDenseMatrixType& Y) {
    int m = X.Width();
    int n = X.Height();
    int i;

#ifdef SKYLARK_HAVE_OPENMP
    #pragma omp parallel for private(i)
#endif
    for(int i=0;i<m;i++) {
                logexp((int) T.Get(i, 0), X.Buffer(0, i), n, 1.0/lambda, Y.Buffer(0, i), MAXITER, epsilon, DISPLAY);
    }

}
Ejemplo n.º 2
0
void ExperienceWindow::addExpRecord(const QString &mob_name,
   int mob_level, long xp_gained, QString zone_name ) 
{

   ExperienceRecord *xp = 
     new ExperienceRecord(mob_name, mob_level, xp_gained, time(0), zone_name, 
			  m_player->classVal(), m_player->level(), 
			  m_zoneMgr->zoneExpMultiplier(), 
			  m_group->totalLevels(),
			  m_group->groupBonus());

#ifdef DEBUGEXP
   resize( sizeHint() );
  qDebug("ExperienceWindow::addExpRecord()  '%s', lvl %d, exp %d",
      mob_name.ascii(), mob_level, xp_gained);
#endif

   if (m_log_exp)
      logexp(xp_gained, mob_level);

   m_exp_list.append( xp );

   // convert everything to string representations for the list view
   QString s_mob_name = mob_name;
   QString s_mob_level;
   s_mob_level.setNum(mob_level);
   QString s_xp_gained;
   s_xp_gained.setNum(xp_gained);
   QString s_xp_value;

   if (m_calcZEM)
   {
      calculateZEM(xp_gained, mob_level);
      m_calcZEM = 0;
      m_view_menu->setItemChecked(m_view_menu->idAt(10), false);
   }   
   s_xp_value.setNum(xp->getExpValue());
   QString s_xp_valueZEM;
   switch (m_ZEMviewtype) {
      case 1 : s_xp_valueZEM.setNum(m_zoneMgr->zoneExpMultiplier()); break;
      case 2 : s_xp_valueZEM.setNum(((float)(m_zoneMgr->zoneExpMultiplier()-0.75)/0.75)*100);
         break;
      default: s_xp_valueZEM.setNum(xp->getExpValueZEM()); break;
   }
   QString s_xp_valuep;
   s_xp_valuep.setNum(xp->getExpValuep());
   QString s_xp_valueg;
   s_xp_valueg.setNum(xp->getExpValueg());

   char s_time[64];
   time_t timev = xp->getTime();
   strftime(s_time, 64, "%m/%d %H:%M:%S", localtime( &timev ));

   /* Update suggested by Shag */
   QListViewItem *new_exp_entry = 
     new QListViewItem( m_exp_listview, s_time, s_mob_name, 
			s_mob_level, s_xp_value, s_xp_valueZEM,
			s_xp_valuep, s_xp_valueg, s_xp_gained );

   m_exp_listview->insertItem( new_exp_entry );
   m_exp_listview->setSelected( new_exp_entry, TRUE );
   m_exp_listview->ensureItemVisible( new_exp_entry );

   // Initial work on new logging mechanism with more data
   FILE* newlogfp = NULL;

   // open the file for append
   newlogfp = fopen(m_newExpLogFile, "a");

   if (newlogfp != NULL)
   {   
      // append a new record entry

      fprintf(newlogfp, 
              "0\t%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%d\t%d\t%d", 
              s_time, (const char*)s_mob_name, mob_level, 
              (const char*)s_xp_value, (const char*)s_xp_valueZEM,
              (const char*)s_xp_valuep, (const char*)s_xp_valueg,
              (const char*)s_xp_gained, 
              (const char*)m_player->name(),
              (const char*)m_player->lastName(),
              m_player->level(), 
              m_player->classVal(), m_group->groupSize());

      const Spawn* spawn;
      // continue with info for group members
      for (int i=0; i < MAX_GROUP_MEMBERS; i++)
      {
	spawn = m_group->memberBySlot(i);
	if (spawn)
	  fprintf(newlogfp, "\t%d", spawn->level());
      }

      // finish the record with a line
      fprintf(newlogfp, "\n"); 

      // close the file (so multiple ShowEQ instances can be up at once)
      fclose(newlogfp);
   }

   // and update the average display
   updateAverage();

}