void label()
	  {
	    srand(time(NULL));

	    size_t length;

	    Vector<FloatDouble, DenseSparseCollection, NewAlloc<float> > A;

	    typedef Vector<float, VectFull, NewAlloc<float> > vector_float_dense;
	    vector_float_dense X0, Y0;
	    length = rand() % Nsub_vector_max_ + 1;
	    X0.Reallocate(length);
	    X0.FillRand();
	    A.AddVector(X0, "X0");

	    typedef Vector<float, VectSparse, NewAlloc<float> >
	      vector_float_sparse;
	    vector_float_sparse X1, Y1;
	    length = rand() % Nsub_vector_max_ + 1;
	    X1.Reallocate(length);
	    for (size_t l = 0; l < length; l++)
	      {
		X1.Index(l) = rand() % length;
		X1.Value(l) = rand();
	      }
	    X1.Assemble();
	    A.AddVector(X1, "X1");

	    typedef Vector<double, VectFull, NewAlloc<double> > vector_double_dense;
	    vector_double_dense X2, Y2;
	    length = rand() % Nsub_vector_max_ + 1;
	    X2.Reallocate(length);
	    X2.FillRand();
	    A.AddVector(X2, "X2");

	    typedef Vector<double, VectSparse, NewAlloc<double> >
	      vector_double_sparse;
	    vector_double_sparse X3, Y3;
	    X3.Reallocate(length);
	    for (size_t l = 0; l < length; l++)
	      {
		X3.Index(l) = rand() % length;
		X3.Value(l) = rand();
	      }
	    X3.Assemble();
	    A.AddVector(X3, "X3");

	    A.GetVector("X0", Y0);
	    A.GetVector("X1", Y1);
	    A.GetVector("X2", Y2);
	    A.GetVector("X3", Y3);

	    for (size_t l = 0; l < X0.GetM(); l++)
	      ASSERT_TRUE(X0(l) == Y0(l));

	    for (size_t l = 0; l < X1.GetM(); l++)
	      {
		ASSERT_TRUE(X1.Index(l) == Y1.Index(l));
		ASSERT_TRUE(X1.Value(l) == Y1.Value(l));
	      }

	    for (size_t l = 0; l < X2.GetM(); l++)
	      ASSERT_TRUE(X2(l) == Y2(l));


	    for (size_t l = 0; l < X3.GetM(); l++)
	      {
		ASSERT_TRUE(X3.Index(l) == Y3.Index(l));
		ASSERT_TRUE(X3.Value(l) == Y3.Value(l));
	      }


	    A.Nullify();
	    Y0.Nullify();
	    Y1.Nullify();
	    Y2.Nullify();
	    Y3.Nullify();
	  }
		void mlt()
	  {	
	    srand(time(NULL));

	    size_t length;

	    Vector<FloatDouble, DenseSparseCollection, NewAlloc<float> > mlt;
	    Vector<FloatDouble, DenseSparseCollection, NewAlloc<float> > A;

	    for (int N = 0; N < Nloop_; N++)
	      {
		double alpha;
		alpha = rand();

		typedef Vector<float, VectFull, NewAlloc<float> > vector_float_dense;
		vector_float_dense X0, Y0;
		for (size_t k = 0; k < Nvector_; k++)
		  {
		    length = rand() % Nsub_vector_max_ + 1;

		    X0.Reallocate(length);
		    X0.FillRand();

		    A.AddVector(X0);

		    Y0.Reallocate(length);
		    Y0.Copy(X0);

		    Mlt(alpha, Y0);

		    mlt.AddVector(Y0);

		    X0.Nullify();
		    Y0.Nullify();
		  }

		typedef Vector<float, VectSparse, NewAlloc<float> >
		  vector_float_sparse;
		vector_float_sparse X1, Y1;
		for (size_t k = 0; k < Nvector_; k++)
		  {
		    length = rand() % Nsub_vector_max_ + 1;

		    X1.Reallocate(length);
		    for (size_t l = 0; l < length; l++)
		      {
			X1.Index(l) = rand() % length;
			X1.Value(l) = rand();
		      }
		    X1.Assemble();

		    Y1.Reallocate(length);
		    Y1.Copy(X1);

		    A.AddVector(X1);

		    Mlt(alpha, Y1);

		    mlt.AddVector(Y1);

		    X1.Nullify();
		    Y1.Nullify();
		  }

		typedef Vector<double, VectFull, NewAlloc<double> > vector_double_dense;
		vector_double_dense X2, Y2;
		for (size_t k = 0; k < Nvector_; k++)
		  {
		    length = rand() % Nsub_vector_max_ + 1;

		    X2.Reallocate(length);
		    X2.FillRand();

		    A.AddVector(X2);

		    Y2.Reallocate(length);
		    Y2.Copy(X2);

		    Mlt(alpha, Y2);

		    mlt.AddVector(Y2);

		    X2.Nullify();
		    Y2.Nullify();
		  }

		typedef Vector<double, VectSparse, NewAlloc<double> >
		  vector_double_sparse;
		vector_double_sparse X3, Y3;
		for (size_t k = 0; k < Nvector_; k++)
		  {
		    length = rand() % Nsub_vector_max_ + 1;

		    X3.Reallocate(length);
		    for (size_t l = 0; l < length; l++)
		      {
			X3.Index(l) = rand() % length;
			X3.Value(l) = rand();
		      }
		    X3.Assemble();

		    Y3.Reallocate(length);
		    Y3.Copy(X3);

		    A.AddVector(X3);

		    Mlt(alpha, Y3);

		    mlt.AddVector(Y3);

		    X3.Nullify();
		    Y3.Nullify();
		  }

		Mlt(alpha, A);

		for (size_t j = 0; j < A.GetFloatDense().GetNvector(); j++)
		  for (size_t l = 0; l < A.GetFloatDense().GetVectorLength()(j); l++)
		    ASSERT_TRUE(A.GetFloatDense().GetVector(j)(l) ==
				   mlt.GetFloatDense().GetVector(j)(l));

		for (size_t j = 0; j < A.GetDoubleDense().GetNvector(); j++)
		  for (size_t l = 0; l < A.GetDoubleDense().GetVectorLength()(j); l++)
		    ASSERT_TRUE(A.GetDoubleDense().GetVector(j)(l) ==
				   mlt.GetDoubleDense().GetVector(j)(l));

		for (size_t j = 0; j < A.GetFloatSparse().GetNvector(); j++)
		  for (size_t l = 0; l < A.GetFloatSparse().GetVectorLength()(j); l++)
		      {
			ASSERT_TRUE(A.GetFloatSparse().GetVector(j).Index(l) ==
				       mlt.GetFloatSparse().GetVector(j).Index(l));
			ASSERT_TRUE(A.GetFloatSparse().GetVector(j).Value(l) ==
				       mlt.GetFloatSparse().GetVector(j).Value(l));
		      }

		for (size_t j = 0; j < A.GetDoubleSparse().GetNvector(); j++)
		  for (size_t l = 0; l < A.GetDoubleSparse().GetVectorLength()(j); l++)
		    {
		      ASSERT_TRUE(A.GetDoubleSparse().GetVector(j).Index(l) ==
				     mlt.GetDoubleSparse().GetVector(j).Index(l));
		      ASSERT_TRUE(A.GetDoubleSparse().GetVector(j).Value(l) ==
				     mlt.GetDoubleSparse().GetVector(j).Value(l));
		    }

		A.Deallocate();
		mlt.Deallocate();
	      }
	  }
	  void mlt_add()
	  {
	    srand(time(NULL));

	    size_t length;
	    typedef double real;

	    for (int N = 0; N < Nloop_; N++)
	      {
		{  // Add two dense vector collections.
		  typedef Vector<double, VectFull, NewAlloc<double> > vector_real_dense;
		  typedef Vector<float, VectFull, NewAlloc<float> > vector_float_dense;

		  Matrix<real> M;
		  real alpha, beta;
		  alpha = rand();
		  beta = rand();

		  Vector<FloatDouble, DenseSparseCollection, NewAlloc<float> > A;
		  vector_real_dense A_dense, U, W;
		  for (size_t k = 0; k < Nvector_; k++)
		    {
		      length = rand() % Nsub_vector_max_ + 1;

		      U.Reallocate(length);
		      U.FillRand();
		      A.AddVector(U);

		      W.Reallocate(length);
		      W.Copy(U);
		      A_dense.PushBack(U);

		      U.Nullify();
		    }

		  vector_float_dense u;
		  for (size_t k = 0; k < Nvector_; k++)
		    {
		      length = rand() % Nsub_vector_max_ + 1;

		      u.Reallocate(length);
		      u.FillRand();
		      A.AddVector(u);

		      W.Reallocate(length);
		      for (size_t i = 0; i < length; i++)
			W(i) = static_cast<double>(u(i));
		      A_dense.PushBack(W);

		      u.Nullify();
		    }


		  vector_real_dense Y1(m_), Y2(m_);
		  Y1.FillRand();
		  Copy(Y1, Y2);

		  M.Reallocate(m_, A.GetM());
		  M.FillRand();

		  MltAdd(alpha, M, A, beta, Y1);

		  MltAdd(alpha, M, A_dense, beta, Y2);

		  for (size_t l = 0; l < m_; l++)
		    ASSERT_NEAR(Y1(l), Y2(l),
						 1.e-6 * Y2(l));

		  A.Deallocate();
		}
	      }
	  }
	  void add()
	  {

	    srand(time(NULL));

	    size_t length;

	    Vector<FloatDouble, DenseSparseCollection, NewAlloc<float> > sum;
	    Vector<FloatDouble, DenseSparseCollection, NewAlloc<float> > A, B;
	    Vector<float, VectFull, NewAlloc<float> > C;

	    for (int N = 0; N < Nloop_; N++)
	      {
		// Added two collections.
		{
		  typedef Vector<float, VectFull, NewAlloc<float> > vector_float_dense;
		  vector_float_dense X0, Y0, V0, W0;
		  for (size_t k = 0; k < Nvector_; k++)
		    {
		      length = rand() % Nsub_vector_max_ + 1;

		      X0.Reallocate(length);
		      X0.FillRand();
		      A.AddVector(X0);

		      Y0.Reallocate(length);
		      Y0.Copy(X0);

		      V0.Reallocate(length);
		      V0.FillRand();
		      B.AddVector(V0);

		      W0.Reallocate(length);
		      W0.Copy(V0);

		      Add(1.0f, Y0, W0);

		      sum.AddVector(W0);

		      X0.Nullify();
		      V0.Nullify();
		      W0.Nullify();
		    }

		  typedef Vector<float, VectSparse, NewAlloc<float> > vector_float_sparse;
		  vector_float_sparse X1, Y1, V1, W1;
		  for (size_t k = 0; k < Nvector_; k++)
		    {
		      length = rand() % Nsub_vector_max_ + 1;

		      X1.Reallocate(length);
		      for (size_t l = 0; l < length; l++)
		      {
			X1.Index(l) = rand() % length;
			X1.Value(l) = rand();
		      }
		      X1.Assemble();
		      A.AddVector(X1);

		      Y1.Reallocate(length);
		      Y1.Copy(X1);

		      V1.Reallocate(length);
		      for (size_t l = 0; l < length; l++)
			{
			  V1.Index(l) = rand() % length;
			  V1.Value(l) = rand();
			}
		      V1.Assemble();
		      B.AddVector(V1);

		      W1.Reallocate(length);
		      W1.Copy(V1);

		      Add(1.0f, Y1, W1);

		      sum.AddVector(W1);

		      X1.Nullify();
		      V1.Nullify();
		      W1.Nullify();
		    }

		  typedef Vector<double, VectFull, NewAlloc<double> > vector_double_dense;
		  vector_double_dense X2, Y2, V2, W2;
		  for (size_t k = 0; k < Nvector_; k++)
		    {
		      length = rand() % Nsub_vector_max_ + 1;

		      X2.Reallocate(length);
		      X2.FillRand();
		      A.AddVector(X2);

		      Y2.Reallocate(length);
		      Y2.Copy(X2);

		      V2.Reallocate(length);
		      V2.FillRand();
		      B.AddVector(V2);

		      W2.Reallocate(length);
		      W2.Copy(V2);

		      Add(1.0, Y2, W2);

		      sum.AddVector(W2);

		      X2.Nullify();
		      V2.Nullify();
		      W2.Nullify();
		    }

		  typedef Vector<double, VectSparse, NewAlloc<double> > vector_double_sparse;
		  vector_double_sparse X3, Y3, V3, W3;
		  for (size_t k = 0; k < Nvector_; k++)
		    {
		      length = rand() % Nsub_vector_max_ + 1;

		      X3.Reallocate(length);
		      for (size_t l = 0; l < length; l++)
			{
			  X3.Index(l) = rand() % length;
			  X3.Value(l) = rand();
			}
		      X3.Assemble();
		      A.AddVector(X3);

		      Y3.Reallocate(length);
		      Y3.Copy(X3);

		      V3.Reallocate(length);
		      for (size_t l = 0; l < length; l++)
			{
			  V3.Index(l) = rand() % length;
			  V3.Value(l) = rand();
			}
		      V3.Assemble();
		      B.AddVector(V3);

		      W3.Reallocate(length);
		      W3.Copy(V3);

		      Add(1.0, Y3, W3);

		      sum.AddVector(W3);

		      X3.Nullify();
		      V3.Nullify();
		      W3.Nullify();
		    }

		  Add(1.0f, B, A);

		  for (size_t j = 0; j < A.GetFloatDense().GetNvector(); j++)
		    for (size_t l = 0; l < A.GetFloatDense().GetVectorLength()(j); l++)
		      ASSERT_TRUE(A.GetFloatDense().GetVector(j)(l) ==
				     sum.GetFloatDense().GetVector(j)(l));

		  for (size_t j = 0; j < A.GetDoubleDense().GetNvector(); j++)
		    for (size_t l = 0; l < A.GetDoubleDense().GetVectorLength()(j); l++)
		      ASSERT_TRUE(A.GetDoubleDense().GetVector(j)(l) ==
				     sum.GetDoubleDense().GetVector(j)(l));

		  for (size_t j = 0; j < A.GetFloatSparse().GetNvector(); j++)
		    for (size_t l = 0; l < A.GetFloatSparse().GetVectorLength()(j); l++)
		      {
			ASSERT_TRUE(A.GetFloatSparse().GetVector(j).Index(l) ==
				       sum.GetFloatSparse().GetVector(j).Index(l));
			ASSERT_TRUE(A.GetFloatSparse().GetVector(j).Value(l) ==
				       sum.GetFloatSparse().GetVector(j).Value(l));
		      }

		  for (size_t j = 0; j < A.GetDoubleSparse().GetNvector(); j++)
		    for (size_t l = 0; l < A.GetDoubleSparse().GetVectorLength()(j); l++)
		      {
			ASSERT_TRUE(A.GetDoubleSparse().GetVector(j).Index(l) ==
				       sum.GetDoubleSparse().GetVector(j).Index(l));
			ASSERT_TRUE(A.GetDoubleSparse().GetVector(j).Value(l) ==
				       sum.GetDoubleSparse().GetVector(j).Value(l));
		      }

		  A.Deallocate();
		  B.Deallocate();
		  sum.Deallocate();
		}

		// Added a collection to a dense vector.
		{
		  typedef Vector<float, VectFull, NewAlloc<float> > vector_float_dense;
		  vector_float_dense X0, Y0, V0, W0;
		  for (size_t k = 0; k < Nvector_; k++)
		    {
		      length = rand() % Nsub_vector_max_ + 1;

		      X0.Reallocate(length);
		      X0.FillRand();
		      A.AddVector(X0);

		      Y0.Reallocate(length);
		      Y0.Copy(X0);

		      V0.Reallocate(length);
		      V0.FillRand();

		      W0.Reallocate(length);
		      W0.Copy(V0);

		      C.PushBack(V0);

		      Add(1.0f, Y0, W0);

		      sum.AddVector(W0);

		      X0.Nullify();
		      V0.Nullify();
		      W0.Nullify();
		    }

		  Add(1.0f, A, C);

		  for (size_t j = 0; j < C.GetM(); j++)
		    ASSERT_TRUE(C(j) == sum(j));

		  A.Deallocate();
		  C.Clear();
		  sum.Deallocate();

		}

	      }
	  }