Esempio n. 1
0
        public void Setup()
        {
            /* Construct a test matrix (that is not at all sparse) containing characters like:
             *
             *       0 1 2 3
             *      --------
             *   0 | A B C D
             *   1 | E F G H
             *   2 | I J   L   <-- Note empty cell where 'K' should be...
             *   3 | M N O P
             *
             */
            matrix = new RowOrientedSparseMatrix <char>(WIDTH, HEIGHT);
            int firstChar = 65;

            for (int i = 0; i < HEIGHT; i++)
            {
                for (int j = 0; j < WIDTH; j++)
                {
                    if (i == 2 && j == 2)
                    {
                        continue;
                    }                                   //Leave empty cell where 'K' should be
                    matrix[i, j] = Convert.ToChar(firstChar + (HEIGHT * i) + j);
                }
            }
        }
 public WordCooccurrenceMatrix(SortedSet<string> words)
 {
     _lookupTable = words.ToArray();
     //Create a square (n x n) matrix with the same rows and columns.
     _n = _lookupTable.Length;
     //_matrix = new SparseMatrix<int>(_n, _n);
     _matrix = new RowOrientedSparseMatrix<int>(_n, _n);
 }