<commit_before>/* Begin CVS Header
   $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/elementaryFluxModes/CFluxScore.cpp,v $
   $Revision: 1.6 $
   $Name:  $
   $Author: shoops $ 
   $Date: 2003/10/16 16:23:13 $
   End CVS Header */

/**
 *  CFluxScore class.
 *  Used to compare flux modes
 *
 *  Created for Copasi by <NAME> 2002-05-08
 * (C) <NAME> 2002
 */

// #define COPASI_TRACE_CONSTRUCTION
#include "copasi.h"
#include "CFluxScore.h"

CFluxScore::CFluxScore(){CONSTRUCTOR_TRACE;}

CFluxScore::CFluxScore(const std::vector < C_FLOAT64 > & fluxMode)
{
  CONSTRUCTOR_TRACE;
  unsigned C_INT32 Remainder = fluxMode.size() % (8 * sizeof(int));
  unsigned C_INT32 i, imax = fluxMode.size() / (8 * sizeof(int));
  unsigned C_INT32 j, k;
  int * Score;

  // Size the scoring vector.
  // Note we have to allocate an extra int if Remainder != 0
  mScore.resize(imax + (Remainder ? 1 : 0));

  // Set the bits to 1 if the corresponding fluxMode coefficient is non zero.
  for (i = 0, j = 0; i < imax; i++)
    {
      Score = &mScore[i];
      *Score = 0;

      for (k = 8 * sizeof(int) - 1; k > (unsigned C_INT32) - 1; k--)
        {
          fluxMode[j++] ? (*Score) += 1 << k : 0;
        }
    }

  // Do the same for the remaining fluxMode coefficients.
  if (Remainder)
    {
      Score = &mScore[i];
      *Score = 0;

      for (k = 8 * sizeof(int) - 1; k >= 8*sizeof(int) - Remainder; k--)
        {
          fluxMode[j++] ? (*Score) += 1 << k : 0;<commit_msg>Fixed constructor which waas only working correctly for small problems. The reason for the problem was a comparison between an unsigned integer and -1.<commit_after>/* Begin CVS Header
   $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/elementaryFluxModes/CFluxScore.cpp,v $
   $Revision: 1.7 $
   $Name:  $
   $Author: shoops $ 
   $Date: 2004/10/11 01:39:58 $
   End CVS Header */

/**
 *  CFluxScore class.
 *  Used to compare flux modes
 *
 *  Created for Copasi by <NAME> 2002-05-08
 * (C) <NAME> 2002
 */

// #define COPASI_TRACE_CONSTRUCTION
#include "copasi.h"
#include "CFluxScore.h"

CFluxScore::CFluxScore(){CONSTRUCTOR_TRACE;}

CFluxScore::CFluxScore(const std::vector < C_FLOAT64 > & fluxMode)
{
  CONSTRUCTOR_TRACE;
  unsigned C_INT32 Remainder = fluxMode.size() % (8 * sizeof(int));
  unsigned C_INT32 i, imax = fluxMode.size() / (8 * sizeof(int));
  unsigned C_INT32 j, k;
  int * Score;

  // Size the scoring vector.
  // Note we have to allocate an extra int if Remainder != 0
  mScore.resize(imax + (Remainder ? 1 : 0));

  // Set the bits to 1 if the corresponding fluxMode coefficient is non zero.
  for (i = 0, j = 0; i < imax; i++)
    {
      Score = &mScore[i];
      *Score = 0;

      for (k = 8 * sizeof(int); k > 0;)
        {
          k--;
          fluxMode[j++] ? (*Score) += 1 << k : 0;
        }
    }

  // Do the same for the remaining fluxMode coefficients.
  if (Remainder)
    {
      Score = &mScore[i];
      *Score = 0;

      for (k = 8 * sizeof(int); k > 8 * sizeof(int) - Remainder;)
        {
          k--;
          fluxMode[j++] ? (*Score) += 1 << k : 0;
{'fraction_non_alphanumeric': 0.1475145255003228, 'fraction_numerical': 0.03647514525500323, 'mean_word_length': 2.5661680092059838, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7379194', 'n_tokens_mistral': 1232, 'n_tokens_neox': 1131, 'n_words': 321}