/// <summary>
        /// Method to copy the data in this Sparse2DMatrix instance to another instance.
        /// </summary>
        /// <param name="sparse2DMatrix">An instance of the Sparse2DMatrix class.</param>
        public void CopyTo(Sparse2DMatrix <TKey0, TKey1, TValue> sparse2DMatrix)
        {
            sparse2DMatrix.m_dictionary.Clear();

            // Copy each key value pair to the dictionary.
            foreach (KeyValuePair <ComparableTuple2 <TKey0, TKey1>, TValue> pair in m_dictionary)
            {
                ComparableTuple2 <TKey0, TKey1> newCombinedKey = new ComparableTuple2 <TKey0, TKey1>(pair.Key);
                sparse2DMatrix.m_dictionary.Add(newCombinedKey, pair.Value);
            }
        }
        /// <summary>
        /// Method to copy the data in another Sparse2DMatrix instance to this instance.
        /// </summary>
        /// <param name="sparse2DMatrix">An instance of the Sparse2DMatrix class.</param>
        private void Initialize(Sparse2DMatrix <TKey0, TKey1, TValue> sparse2DMatrix)
        {
            m_dictionary.Clear();

            // Copy each key value pair to the dictionary.
            foreach (KeyValuePair <ComparableTuple2 <TKey0, TKey1>, TValue> pair in sparse2DMatrix)
            {
                ComparableTuple2 <TKey0, TKey1> newCombinedKey = new ComparableTuple2 <TKey0, TKey1>(pair.Key);
                m_dictionary.Add(newCombinedKey, pair.Value);
            }
        }
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="sparse2DMatrix">The sparse array instance to be copied</param>
 public Sparse2DMatrix(Sparse2DMatrix <TKey0, TKey1, TValue> sparse2DMatrix)
 {
     InitializeDictionary();
     Initialize(sparse2DMatrix);
     DefaultValue = sparse2DMatrix.DefaultValue;
 }