Exemple #1
0
 public AssocMatrix()
 {
     mat        = new NumericMatrix <V>(10, 10);
     r          = new AssocArray <AI1, int>();
     c          = new AssocArray <AI2, int>();
     keyRows    = new Set <AI1>();
     keyColumns = new Set <AI2>();
 }
Exemple #2
0
        public AssocMatrix(AssocMatrix <AI1, AI2, V> mat2)
        {
            mat = new NumericMatrix <V>(mat2.mat);
            r   = new AssocArray <AI1, int>(mat2.r);
            c   = new AssocArray <AI2, int>(mat2.c);

            keyRows    = new Set <AI1>(mat2.keyRows);
            keyColumns = new Set <AI2>(mat2.keyColumns);
        }
Exemple #3
0
        // V2

        /*
         * // Construct the map from a list of names and a REPEATED val
         * AssocMatrix(V  rowStart, V columnStart,  NumericMatrix<V> matrix)
         * {
         *
         * // Must build the associative arrays, they have the same values as the
         * // indices in the matrix
         *
         * VectorCollectionGenerator<V> rowGenerator = new VectorCollectionGenerator<V>();
         * rowGenerator.Start = rowStart;
         * rowGenerator.Increment = new V();
         * rowGenerator.Size = matrix.Rows;
         *
         * VectorCollectionGenerator<V> columnGenerator = new VectorCollectionGenerator<V>();
         * columnGenerator.Start = columnStart;
         * columnGenerator.Increment = 1;
         * columnGenerator.Size = matrix.Columns;
         *
         * mat = new NumericMatrix<V>(matrix);
         *
         * //	keyRows = new SetCreator<V, int>.createSet(rowGenerator);
         * //keyColumns = new SetCreator<V, int>.createSet(columnGenerator);
         *
         *
         * // Build rows
         * int start = mat.MinRowIndex;
         * r = new AssocArray<AI1, int> ();
         *
         * foreach (AI1 row in keyRows)
         * {
         *    r[row] = start;
         *    start = start + 1;
         * }
         *
         * // Build columns
         * start = mat.MinColumnIndex;
         * c = new AssocArray<AI2, int>();
         *
         * foreach (AI2 col in keyColumns)
         * {
         *  c[col] = start;
         *  start = start + 1;
         * }
         *
         * // NO EXCEPTION HANDLING AT THE MOMENT
         * //print(c);
         * }
         *
         */
        public AssocMatrix(Set <AI1> Rnames, Set <AI2> Cnames,
                           NumericMatrix <V> matrix)
        {
            keyRows    = new Set <AI1>(Rnames);
            keyColumns = new Set <AI2>(Cnames);

            // Must build the associative arrays, they have the same values as the
            // indices in the matrix

            //mat = new NumericMatrix<V>(matrix);
            mat = matrix;

            // Build rows
            int start = mat.MinRowIndex;

            r = new AssocArray <AI1, int>();

            foreach (AI1 row in keyRows)
            {
                r[row] = start;
                start++;
            }

            // Build columns
            start = mat.MinColumnIndex;
            c     = new AssocArray <AI2, int>();

            foreach (AI2 col in keyColumns)
            {
                c[col] = start;
                start++;
            }

            // NO EXCEPTION HANDLING AT THE MOMENT
            //print(c);
        }
 public AssocArray(AssocArray <Key, Value> arr2)
 { // Copy constructor
     str  = new Dictionary <Key, Value>(arr2.str);
     keys = new Set <Key>(arr2.keys);
 }