home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c100 / 3.ddi / BAM.ZIP / BAM.ASC
Encoding:
Text File  |  1990-09-27  |  17.6 KB  |  702 lines

  1. BIDIRECTIONAL ASSOCIATIVE MEMORY SYSTEMS IN C++
  2. by Adam Blum
  3.  
  4.  
  5. [LISTING ONE]
  6.  
  7. ////////////////////////////////////////////////////////////
  8. // BAM.HPP  Provide vector, matrix, vector pair, matrix, BAM matrix, and 
  9. // BAM system classes and methods to implement BAM system concept.
  10. // Extended note:
  11. // This is an implementation of the concept of Bidirectional
  12. // Associative Memories as developed by Bart Kosko and others. 
  13. // It includes the extended concept introduced by Patrick Simpson
  14. // of the "BAM System". Where reasonable Simpson's notation has been
  15. // been maintained. The presentation benefits greatly from C++ and OOP, in that
  16. // (I believe) it is both easier to understand than a "pseudocode" version, 
  17. // yet more precise (in that it works!)
  18. // Developed with Zortech C++ Version 2.0 -- Copyright (c) Adam Blum, 1989,90
  19.  
  20. #include<stdlib.h>
  21. #include<io.h>
  22. #include<stdio.h>
  23. #include<string.h>
  24. #include<limits.h>
  25. #include<ctype.h>
  26. #include<stream.hpp>
  27. #include "debug.h" // debugging devices
  28. // where are Zortech's min,max?
  29. #define max(a,b)    (((a) > (b)) ? (a) : (b))
  30. #define min(a,b)    (((a) < (b)) ? (a) : (b))
  31.  
  32. // will be changed to much higher than these values
  33. const ROWS=16;    // number of rows (length of first pattern)
  34. const COLS=8;    // number of columns (length of second pattern)
  35. const MAXMATS=10; // maximum number of matrices in BAM system
  36. const MAXVEC=16; // default size of vectors
  37.  
  38. class matrix;
  39. class bam_matrix;
  40. class vec {
  41.     friend class matrix;
  42.     friend class bam_matrix;
  43.     friend class bam_system;
  44.         int n;
  45.         int *v;
  46.     public:
  47.         // see BAM.CPP for implementations of these
  48.         vec(int size=MAXVEC,int val=0); // constructor
  49.         ~vec();    // destructor
  50.         vec(vec &v1); // copy-initializer
  51.         int length();
  52.         vec& operator=(const vec& v1); // vector assignment
  53.         vec& operator+(const vec& v1); // vector addition
  54.         vec& operator+=(const vec& v1); // vector additive-assignment
  55.         vec& operator*=(int i); // vector multiply by constant
  56.         // supplied for completeness, but we don't use this now
  57.         int operator*(const vec& v1); // dot product
  58.         vec operator*(int c); // multiply by constant
  59.         // vector transpose multiply needs access to v array
  60.         int operator==(const vec& v1);
  61.         int& operator[](int x);
  62.         friend istream& operator>>(istream& s,vec& v);
  63.         friend ostream& operator<<(ostream& s, vec& v);
  64. }; //vector class
  65.  
  66. class vecpair;
  67.  
  68. class matrix {
  69.     protected: 
  70.     // bam_matrix (a derived class) will need to use these members
  71.     // preferred to "friend class", since there may be many derived
  72.     // classes which need to use this 
  73.         int **m; // the matrix representation
  74.         int r,c; // number of rows and columns
  75.     public: 
  76.         // constructors 
  77.         matrix(int n=ROWS,int p=COLS); 
  78.         matrix(const vec& v1,const vec& v2);
  79.         matrix(const vecpair& vp);
  80.         matrix(matrix& m1); // copy-initializer
  81.         ~matrix();
  82.         int depth();
  83.         int width();
  84.         matrix& operator=(const matrix& m1);
  85.         matrix& operator+(const matrix& m1);
  86.         matrix& operator+=(const matrix& m1);
  87.         vec colslice(int col); 
  88.         vec rowslice(int row); 
  89.         friend ostream& operator<<(ostream& s,matrix& m1);
  90. }; // matrix class
  91.  
  92. class vecpair {
  93.     friend class matrix;
  94.     friend class bam_matrix;
  95.     friend class bam_system;
  96.         int flag; // flag signalling whether encoding succeeded
  97.         vec a;
  98.         vec b;
  99.     public: 
  100.         vecpair(int n=ROWS,int p=COLS); // constructor
  101.         vecpair(const vec& A,const vec& B);
  102.         vecpair(const vecpair& AB); // copy initializer
  103.         ~vecpair();    
  104.         vecpair& operator=(const vecpair& v1);
  105.         int operator==(const vecpair& v1);
  106.         friend istream& operator>>(istream& s,vecpair& v);
  107.         friend ostream& operator<<(ostream& s,vecpair& v);
  108.         friend matrix::matrix(const vecpair& vp);
  109. };
  110.  
  111. class bam_matrix: public matrix {
  112.     private: 
  113.         int K; // number of patterns stored in matrix
  114.         vecpair *C; // actual pattern pairs stored
  115.         int feedthru(const vec&A,vec& B);
  116.         int sigmoid(int n); // sigmoid threshold function
  117.     public: 
  118.         bam_matrix(int n=ROWS,int p=COLS);
  119.         ~bam_matrix();
  120.         // but we supply it with the actual matrix A|B (W is implied)
  121.         void encode(const vecpair& AB); // self-ref version
  122.         // uncode only necessary for BAM-system
  123.         void uncode(const vecpair& AB); // self-ref version
  124.         vecpair recall(const vec& A);
  125.         int check(); 
  126.         int check(const vecpair& AB);
  127.         // Lyapunov energy function: E=-AWBtranspose
  128.         int energy(const matrix& m1); // Lyapunov energy function
  129. }; // BAM matrix
  130.  
  131. class bam_system {
  132.         bam_matrix *W[MAXMATS];
  133.         int M; // number of matrices
  134.     public:
  135.         bam_system(int M=1);
  136.         ~bam_system();
  137.         void encode(const vecpair& AB);
  138.         vecpair& recall(const vec& A);
  139.         // train equiv. to Simpson's encode of all pairs
  140.         void train(char *patternfile); 
  141.         friend ostream& operator<<(ostream& s,bam_system& b);
  142. }; // BAM system class
  143.  
  144.  
  145. [LISTING TWO]
  146.  
  147. ///////////////////////////////////////
  148. // BAM.CPP Provide vector, matrix, vector pair, matrix, BAM matrix, and BAM 
  149. // system classes to implement BAM systems
  150. // Extended note:
  151. // This is an implementation of the concept of Bidirectional
  152. // Associative Memories as developed by Bart Kosko and others. 
  153. // It includes the extended concept introduced by Patrick Simpson
  154. // of the "BAM System". Where reasonable Simpson's notation has been
  155. // been maintained. The presentation benefits greatly from C++ and OOP, in that
  156. // (I believe) it is both easier to understand than a "pseudocode" version, 
  157. // yet more precise (in that it works!)
  158. // Developed with Zortech C++ Version 2.0 -- Copyright (c) 1989,90 Adam Blum
  159.  
  160. #include"bam.hpp"
  161.  
  162. ///////////////////////////////////
  163. // vector class member functions
  164.  
  165. vec::vec(int size,int val) { 
  166.     v = new int[size]; 
  167.     n=size;
  168.     for(int i=0;i<n;i++)
  169.         v[i]=0;
  170. } // constructor
  171. vec::~vec() { delete v;} // destructor
  172. vec::vec(vec& v1) // copy-initializer
  173. {
  174.     v=new int[n=v1.n];
  175.     for(int i=0;i<n;i++)
  176.         v[i]=v1.v[i];
  177. }
  178. vec& vec::operator=(const vec& v1)
  179. {
  180.     delete v;
  181.     v=new int[n=v1.n];
  182.     for(int i=0;i<n;i++)
  183.         v[i]=v1.v[i];
  184.     return *this;
  185. }
  186. vec& vec::operator+(const vec& v1)
  187. {
  188.     vec sum(v1.n);
  189.     sum.n=v1.n;
  190.     for(int i=0;i<v1.n;i++)
  191.         sum.v[i]=v1.v[i]+v[i];
  192.     return sum;
  193. }
  194. vec& vec::operator+=(const vec& v1)
  195. {
  196.     for(int i=0;i<v1.n;i++)
  197.         v[i]+=v1.v[i];
  198.     return *this;
  199. }
  200. vec vec::operator*(int c)
  201. {
  202.     vec prod(length());
  203.     for(int i=0;i<prod.n;i++)
  204.         prod.v[i]=v[i]*c;
  205.     return prod;    
  206. }
  207. int vec::operator*(const vec& v1) // dot-product
  208. {
  209.     int sum=0;
  210.     for(int i=0;i<min(n,v1.n);i++)
  211.         sum+=(v1.v[i]*v[i]);
  212.     //D(cout << "dot product " << *this << v1 << sum << "\n";)
  213.     return sum;
  214. }
  215. int vec::operator==(const vec& v1) 
  216. {
  217.     if(v1.n!=n)return 0;
  218.     for(int i=0;i<min(n,v1.n);i++){
  219.         if(v1.v[i]!=v[i]){
  220.             return 0;
  221.         }
  222.     }
  223.     return 1;
  224. }
  225. int& vec::operator[](int x)
  226. {
  227.     if(x<length() && x>=0)
  228.         return v[x];
  229.     else
  230.         cout << "vec index out of range";
  231. }
  232. int vec::length(){return n;} // length method
  233.  
  234. istream& operator>>(istream& s,vec &v)
  235. // format: list of ints followed by ','
  236. {
  237.     char c;
  238.     v.n=0;
  239.     v.v=new int[MAXVEC];
  240.     for(;;){
  241.         s>>c;
  242.         if(s.eof())return s;        
  243.         if(c==',')return s;
  244.         if(isspace(c))continue;
  245.         v.v[v.n++]=((c!='0')?1:-1);
  246.     }
  247. }
  248. ostream& operator<<(ostream& s, vec& v)
  249. // format: list of ints followed by ','
  250. {
  251.     for(int i=0;i<v.n;i++)
  252.         s << (v.v[i]<0?0:1);
  253.     s << ",";
  254.     return s;
  255. }
  256.  
  257. ///////////////////////////////
  258. // matrix  member functions
  259. matrix::matrix(int n,int p) 
  260.     //D(cout << "Constructing " << n << " x " << p << " matrix.\n";)
  261.     m=new int *[n];
  262.     for(int i=0;i<n;i++){
  263.         m[i]=new int[p];
  264.         for(int j=0;j<p;j++)
  265.             m[i][j]=0;
  266.     }
  267.     r=n; 
  268.     c=p;
  269. } // constructor
  270. matrix::matrix(const vecpair& vp) 
  271. {
  272.     //D(cout << "Constructing matrix from: " << vp;)
  273.     r=vp.a.length();
  274.     c=vp.b.length();
  275.     m=new int *[r];
  276.     for(int i=0;i<r;i++){
  277.         m[i]=new int[c];
  278.         for(int j=0;j<c;j++)
  279.             m[i][j]=vp.a.v[i]*vp.b.v[j];
  280.     }
  281. }// constructor 
  282. matrix::matrix(const vec& v1,const vec& v2) 
  283. {
  284.     //D(cout << "Constructing matrix from " << v1 << v2 << "\n";)
  285.     r=v1.length();
  286.     c=v2.length();
  287.     m=new int *[r];
  288.     for(int i=0;i<r;i++){
  289.         m[i]=new int[c];
  290.         for(int j=0;j<c;j++)
  291.             m[i][j]=v1.v[i]*v2.v[j];
  292.     }
  293. }// constructor 
  294. matrix::matrix(matrix& m1) // copy-initializer
  295. {
  296.     //D(cout << "matrix copy-initializer\n"; )
  297.     r=m1.r;
  298.     c=m1.c;
  299.     m=new int *[r];
  300.     for(int i=0;i<r;i++){
  301.         m[i]=new int[c];
  302.         for(int j=0;j<c;j++)
  303.             m[i][j]=m1.m[i][j];
  304.     }
  305. }
  306. matrix::~matrix() 
  307.     for(int i=0;i<r;i++)
  308.         delete m[i];
  309.     delete m;
  310. } // destructor
  311. matrix& matrix::operator=(const matrix& m1)
  312. {
  313.     for(int i=0;i<r;i++)
  314.         delete m[i];
  315.     r=m1.r;
  316.     c=m1.c;
  317.     m=new int*[r];
  318.     for(i=0;i<r;i++){
  319.         m[i]=new int[c];
  320.         for(int j=0;j<r;j++)
  321.             m[i][j]=m1.m[i][j];
  322.     }
  323.     return *this;        
  324. }
  325. matrix& matrix::operator+(const matrix& m1)
  326. {
  327.     matrix sum(r,c);
  328.     for(int i=0;i<r;i++)
  329.         for(int j=0;j<r;j++)
  330.             sum.m[i][j]=m1.m[i][j]+m[i][j];
  331.     return sum;
  332. }
  333. matrix& matrix::operator+=(const matrix& m1)
  334. {
  335.     //D(cout << "matrix additive assignment\n";)
  336.     for(int i=0;i<r&&i<m1.r;i++)
  337.         for(int j=0;j<c&&j<m1.c;j++)
  338.             m[i][j]+=(m1.m[i][j]);
  339.     return *this;
  340. }
  341. vec matrix::colslice(int col) 
  342. {
  343.     vec temp(r); 
  344.     for(int i=0;i<r;i++)
  345.         temp.v[i]=m[i][col];
  346.     return temp;
  347. }
  348. vec matrix::rowslice(int row) 
  349. {
  350.     vec temp(c); 
  351.     for(int i=0;i<c;i++)
  352.         temp.v[i]=m[row][i];
  353.     return temp;
  354. }
  355. int matrix::depth(){return r;}
  356. int matrix::width(){return c;}
  357.  
  358. ostream& operator<<(ostream& s,matrix& m1)
  359. // print a matrix
  360. {
  361.     for(int i=0;i<m1.r;i++){
  362.         for(int j=0;j<m1.c;j++)
  363.             s << m1.m[i][j] << " ";
  364.         s << "\n";
  365.     }
  366. }
  367. //////////////////////////////////////////
  368. // vecpair  member functions 
  369. // constructor
  370. vecpair::vecpair(int n,int p) { }
  371. vecpair::vecpair(const vec& A,const vec& B) {a=A;b=B;}
  372. vecpair::vecpair(const vecpair& AB) {*this=vecpair(AB.a,AB.b);}
  373. vecpair::~vecpair() {} // destructor
  374. vecpair& vecpair::operator=(const vecpair& v1)
  375. {
  376.     a=v1.a;
  377.     b=v1.b;
  378.     return *this;
  379. }
  380. int vecpair::operator==(const vecpair& v1)
  381. {
  382.     return     (a == v1.a) && (b == v1.b);
  383. }
  384. istream& operator>>(istream& s,vecpair& v1)
  385. // input a vector pair
  386. {
  387.     s>>v1.a>>v1.b;
  388.     return s;
  389. }
  390. ostream& operator<<(ostream& s,vecpair& v1)
  391. // print a vector pair
  392. {
  393.     return s<<v1.a<<v1.b<<"\n";
  394. }
  395. /////////////////////////////////
  396. //bam_matrix  member functions
  397. bam_matrix::bam_matrix(int n,int p):(n,p)
  398. {
  399.     // the maximum number of pattern pairs storable
  400.     // is around min(n,p) where n and p are 
  401.     // the dimensionality of the matrix
  402.     C=new vecpair[min(n,p)*2];
  403.     K=0;
  404. }
  405. bam_matrix::~bam_matrix()
  406. {
  407. } // destructor
  408. void bam_matrix::encode(const vecpair& AB)
  409. // encode a pattern pair
  410. {
  411.     //D(cout << "BAM Matrix encoding: " << AB;)
  412.     matrix T(AB);
  413.     (*this)+=T; // add the matrix transpose to the current matrix
  414.     C[K]=AB;
  415.     K++;
  416. }
  417. void bam_matrix::uncode(const vecpair& AB)
  418. // get rid of a stored pattern (by encoding A-B complement)
  419. {
  420.     //D(cout << "uncode\n";)
  421.     vec v=AB.b*-1;
  422.     matrix T(AB.a,v); // T is A transpose B complement
  423.     *this+=T;// add the matrix transpose to the current matrix
  424.     K--;
  425. }
  426. vecpair bam_matrix::recall(const vec& A)
  427. // BAM Matrix recall algorithm (used by BAM SYSTEM recall)
  428. {
  429.     int givenrow=(A.length()==width());
  430.     D(cout<<"BAM matrix recall of" << A << givenrow?"(row)\n":"(col)\n";)
  431.     vec B(givenrow?depth():width(),1);
  432.     for(;;){ // feed vectors through matrix until "resonant" pattern-pair
  433.         feedthru(A,B);
  434.         if(feedthru(B,A))break; // stop when returned A = input A
  435.     }    
  436.     D(cout<< "resonant pair " << A << "\n and " << B << "\n";)
  437.     if(givenrow)
  438.         return vecpair(B,A);
  439.     else
  440.         return vecpair(A,B);
  441. }
  442. int bam_matrix::feedthru(const vec&A,vec& B)
  443. {
  444.     //D(cout << "Feeding " << A << "\n"; )
  445.     vec temp=B;int n;
  446.     for(int i=0;i<B.length();i++){
  447.         if(A.length()==width())
  448.             n=sigmoid(A*rowslice(i));
  449.         else
  450.             n=sigmoid(A*colslice(i));
  451.         if(n)
  452.             B.v[i]=n;
  453.     }
  454.     return B==temp;
  455. }
  456. int bam_matrix::sigmoid(int n)
  457. // VERY simple (but classic one for BAM) threshold function
  458. //        
  459. //          1    --------------
  460. //              |
  461. //  - -----------       +
  462. //         -1    
  463. {
  464.     if(n<0)return -1;
  465.     if(n>0)return 1;
  466.     return 0;
  467. }
  468. int bam_matrix::check()
  469. // check to see if we have successfully encoded pattern-pair into this matrix
  470. {
  471.     D(cout << "Check BAM matrix for " << K << " pattern pairs\n";)
  472.     vecpair AB;
  473.     for(int i=0;i<K;i++){
  474.         AB=recall(C[i].a);
  475.         if(!(AB==C[i])){
  476.             D(cout <<"failed check\n ";)
  477.             return 0;
  478.         }
  479.     }
  480.     D(cout << "passed check\n ";)
  481.     return 1;    
  482. }
  483. int bam_matrix::check(const vecpair& AB)
  484. {
  485.     // different check routine for orthogonal construction BAM
  486.     //check to see energy of present pattern pair to matrix
  487.     // is equal to orthogonal BAM energy
  488.     matrix T(AB);
  489.     return energy(T)== -depth()*width();
  490. }
  491. int bam_matrix::energy(const matrix& m1)
  492. {
  493.     int sum=0;
  494.     for(int i=0;i<depth();i++)
  495.         for(int j=0;j<width();j++)
  496.             sum+=(m1.m[i][j]*this->m[i][j]);
  497.     D(cout << "Energy of matrix " << -sum << "\n";)
  498.     return -sum;
  499. }
  500.  
  501. ///////////////////////////////////////////
  502. // bam system  functions
  503. // top level of system (for now)
  504.  
  505. // constructor
  506. bam_system::bam_system(int n)
  507. {
  508.     M=n;
  509.     for(int i=0;i<M;i++)
  510.         W[i]=new bam_matrix;
  511. }
  512. bam_system::~bam_system() // destructor
  513. {
  514.     for(int i=0;i<M;i++)
  515.         delete W[i];
  516. }
  517. void bam_system::encode(const vecpair& AB)
  518. // encode the pattern pair AB into the BAOM system
  519. {
  520.     D(cout << "BAM System encode\n";)
  521.     for(int h=0;h<M;h++){
  522.         W[h]->encode(AB);
  523.         if(!W[h]->check())
  524.             W[h]->uncode(AB);
  525.         else                 
  526.             break;            
  527.     }
  528.     if(h==M){ // all matrices full, add another
  529.         if(h<MAXMATS){
  530.             W[M]=new bam_matrix();
  531.             W[M]->encode(AB);
  532.             M++;
  533.         }
  534.         else{
  535.             cout << "BAM System full\n";
  536.             exit(1);
  537.         }
  538.     }
  539. }
  540. vecpair& bam_system::recall(const vec& A)
  541. // presented with pattern A, recall will return pattern-PAIR 
  542. {
  543.     vecpair XY[MAXMATS];matrix *M1,*M2;
  544.     int E,minimum=0,emin=INT_MAX;
  545.     D(cout << "BAM System recall\n";)
  546.     for(int h=0;h<M;h++){
  547.         XY[h]=W[h]->recall(A);
  548.         D(cout << h <<"-th matrix, returned vecpair "<< XY[h];)
  549.         M1=new matrix(XY[h]);
  550.         E=W[h]->energy(*M1);
  551.         if(A.length()==W[h]->width())
  552.             M2=new matrix(XY[h].a,A);
  553.         else
  554.             M2=new matrix(A,XY[h].b);
  555.         if (  ( E-(W[h]->depth()*W[h]->width()) < emin )
  556.                && (E==W[h]->energy(*M2))
  557.         )
  558.         {
  559.             emin=E-(W[h]->depth()*W[h]->width());
  560.             minimum=h;                        
  561.         }
  562.         delete M1;
  563.         delete M2;
  564.     }            
  565.     return XY[minimum];
  566. }
  567. void bam_system::train(char *patternfile)
  568. // A "multiple-pair" encode - which Simpson calls "encode"
  569. // this could be used for initial BAM Sys training. However an up 
  570. // and running BAM Sys should only need to use "encode".
  571. {
  572.     FILE *f=fopen(patternfile,"r");int n=0;
  573.     filebuf sfile(f);
  574.     istream s(&sfile,0);
  575.     vecpair AB;
  576.     for(;;){
  577.         s >> AB;
  578.         if(s.eof())break;
  579.         D(cout << "Encoding " << n++ << "-th pattern pair:\n" << AB;)
  580.         encode(AB);
  581.     }
  582.     D(cout << "Completed training from " << patternfile;)
  583. }
  584. ostream& operator<<(ostream& s,bam_system& b)
  585. // operator to print out contents of entire BAM system
  586. {
  587.     for(int i=0;i<b.M;i++)
  588.         s<< "BAM Matrix " << i << ": \n" << *(b.W[i]) << "\n";
  589. }
  590.  
  591.  
  592. [LISTING THREE]
  593.  
  594. ////////////////////////
  595. // TESTBAM.HPP
  596. // Interactive BAM System Demonstration Program. Used to verify BAM system 
  597. // algorithms and demonstrate them on an abstract (i.e. just 0s and 1s) case.
  598. // Developed with Zortech C++ 2.0 -- Copyright (c) 1989,90 Adam Blum
  599.  
  600. #include"bam.hpp"
  601.  
  602. vec v;
  603. vecpair AB;
  604. bam_system B;
  605. char *p;
  606. char patternfile[16]="TEST.FIL"; // file where test data is stored
  607. int trace=0; // SET TRACE=<whatever> at DOS prompt to turn trace on
  608. main()
  609. {
  610.      cout << "Interactive BAM System Demonstration\n";
  611.      trace=(p=getenv("TRACE"))?1:0;
  612.      cout << "Training from " << patternfile << "\n";
  613.      B.train(patternfile);
  614.      D(cout << "Resulting BAM System\n" << B;)
  615.      cout <<"Enter patterns as 0's and 1's terminated by comma.\n"
  616.      <<"Patterns must be length of " << ROWS << " or " << COLS <<".\n"
  617.      << "Null vector (just "","") to end.\n\n" ;
  618.      for(;;){
  619.           cout << "Enter pattern: ";
  620.           cin >> v;
  621.           if(!v.length())break;
  622.           if(v.length()!=ROWS && v.length()!=COLS){
  623.                cout << "Wrong length.\n";
  624.                continue;
  625.           }
  626.           AB=B.recall(v);
  627.           cout << "Recalled pattern pair\n" << AB;
  628.      }
  629. }
  630.  
  631.  
  632. [LISTING FOUR]
  633.  
  634.  
  635. 1100101011010011,11101010,
  636. 0110110111110110,11010101,
  637. 1101111001010101,11110010,
  638. 1010101000010111,11001101,
  639. 0011001101011011,11110100,
  640. 1100101011010011,11101010,
  641. 0110100111110110,11010101,
  642. 1101110101010101,11110010,
  643. 1011101010010111,11001101,
  644. 0001011101011011,11110100,
  645. 1100101001010011,11101010,
  646. 0110110110110110,11010101,
  647. 1100111011010101,11110011,
  648. 1010000100010111,11001101,
  649. 0001101101011011,11110110,
  650. 1100100011010011,11100110,
  651. 0110110011110110,11010101,
  652. 1101111001010101,11110011,
  653. 1010100000011111,11001101,
  654. 0001100101111011,11111000,
  655. 1100101011010011,11011010,
  656. 0010100111110110,11010101,
  657. 1101111101010101,11110010,
  658. 1010111000010111,11101101,
  659. 0001000001011011,11110100,
  660. 1100101011010011,11101010,
  661. 0110110111110110,11010101,
  662. 1101111000010101,11110110,
  663. 1010100111010111,11001101,
  664. 0001000101011011,11110100,
  665. 0110110101110110,11010111,
  666. 1101111001010101,11110110,
  667. 1010111100110111,11001101,
  668. 0001000101011011,11110100,
  669. 1100101010010011,11101010,
  670. 0110110111110110,11010101,
  671. 1101111001010101,11110010,
  672. 1010110000010111,11001101,
  673. 0011000101011011,11110100,
  674. 0011010101111011,10010111,
  675.  
  676.  
  677. [LISTING FIVE]
  678.  
  679. # TESTBAM.MK
  680. # Make file for BAM System implementation tester
  681. # Uses Microsoft Make 
  682. # Compiler: Zortech C++ 2.0
  683. # To make with diagnostics enabled:
  684. # make CFLAGS="-DDEBUG=1" testbam.mk
  685. #
  686.  
  687. CFLAGS=
  688. .cpp.obj: 
  689.      ztc -c $(CFLAGS) $*.cpp
  690. bam.obj: bam.cpp bam.hpp
  691. testbam.obj: testbam.cpp bam.hpp
  692. testbam.exe: testbam.obj bam.obj
  693.      blink testbam bam;
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.