All pastes #898564 Raw Edit

Reviewer

public cpp v1 · immutable
·published 2008-02-10 12:52 UTC
rendered paste body
#include <iostream>#include <vector>using std::cout;inline bool validnet(const int &activators, const int &repressors){   return (activators & repressors) == 0;}inline bool isfp(int activators, int repressors, int state){   int ns = 0;   for(int b = 0; b < 4; ++b)   {      int a = activators & 0xf;      int r = repressors & 0xf;      // Require that all regulated bits = 1      // It matters not whether the unregulated genes are all 0 or all 1.      if((state & a) == a && (~state & r) == r)         ns |= 1 << b;      activators >>= 4;      repressors >>= 4;   }   return ns == state;}inline int fixedpoints(int activators, int repressors){   int fps = 0;   for(int state = 0; state < 16; ++state)      if(isfp(activators, repressors, state))         ++fps;   return fps;}void printfphistogram(){   std::vector<int> fphistogram(17, 0);   for(int act = 0; act < 0x10000; ++act)      for(int rep = 0; rep < 0x10000; ++rep)         if(validnet(act, rep))            ++fphistogram[fixedpoints(act, rep)];   cout << "#FPs\tcount\n";   for(int i = 0; i < 17; ++i)      cout << i << "\t" << fphistogram[i] << "\n";}int main(){   printfphistogram();}/*Output:#FPs    count0       131099301       199079082       76661093       18116824       4264065       928956       243587       50338       18309       33510      20411      012      3013      014      015      016      1*/