int main(int argc, char **argv) {
  MPI_Init(&argc, &argv);

  QUESO::EnvOptionsValues options;
  options.m_numSubEnvironments = 1;
  options.m_subDisplayFileName = "outputData/debug_output";
  options.m_subDisplayAllowAll = 0;
  options.m_subDisplayAllowedSet.insert(0);
  options.m_seed = 1.0;
  options.m_checkingLevel = 1;
  options.m_displayVerbosity = 20;

  QUESO::FullEnvironment *env = new QUESO::FullEnvironment(MPI_COMM_WORLD, "",
      "", &options);

  std::vector<std::string> names(1);
  names[0] = "my_name";
  QUESO::VectorSpace<QUESO::GslVector, QUESO::GslMatrix> vec_space(*env,
      "vec_prefix", 1, &names);

  // 1x1 diagonal matrix containing the value 3.0 on the diagonal
  QUESO::GslMatrix * diag_matrix = vec_space.newDiagMatrix(3.0);

  if ((*diag_matrix)(0,0) != 3.0) {
    std::cerr << "newDiagMatrix test failed" << std::endl;
    return 1;
  }

  if (vec_space.globalIdOfFirstComponent() != 0) {
    std::cerr << "failed globalIdOfFirstComponent test" << std::endl;
    return 1;
  }

  // Create a vector
  QUESO::GslVector v1(vec_space.zeroVector());
  v1.cwSet(2.0);

  // Now create a new vector
  QUESO::GslVector * v2 = vec_space.newVector(v1);

  if ((*v2)[0] != v1[0]) {
    std::cerr << "newVector test failed" << std::endl;
    return 1;
  }

  const QUESO::DistArray<std::string> *names_array = vec_space.componentsNamesArray();

  std::cout << "Test print: componentsNamesArray: "
            << *names_array
            << std::endl;

  std::cout << "Test print: localComponentName: "
            << vec_space.localComponentName(0)
            << std::endl;

  std::cout << "Test print: printComponentsNames horizontally: ";
  vec_space.printComponentsNames(std::cout, true);
  std::cout << std::endl;

  std::cout << "Test print: printComponentsNames vertically: ";
  vec_space.printComponentsNames(std::cout, false);
  std::cout << std::endl;

  std::cout << "Test print: print: ";
  vec_space.print(std::cout);
  std::cout << std::endl;

  delete diag_matrix;
  MPI_Finalize();

  return 0;
}
int main(int argc, char **argv) {
  MPI_Init(&argc, &argv);

  QUESO::EnvOptionsValues options;
  options.m_numSubEnvironments = 1;
  options.m_subDisplayFileName = "outputData/testIntersectionSubsetContains";
  options.m_subDisplayAllowAll = 0;
  options.m_subDisplayAllowedSet.insert(0);
  options.m_seed = 1.0;
  options.m_checkingLevel = 1;
  options.m_displayVerbosity = 55;

  QUESO::FullEnvironment *env = new QUESO::FullEnvironment(MPI_COMM_WORLD, "",
            "", &options);

  std::vector<std::string> names(1);
  names[0] = "my_name";

  // Create a vector space
  QUESO::VectorSpace<QUESO::GslVector, QUESO::GslMatrix> vec_space(*env,
      "vec_prefix", 1, &names);

  // Create two vector sets
  QUESO::GslVector min1(vec_space.zeroVector());
  min1[0] = 0.0;
  QUESO::GslVector max1(vec_space.zeroVector());
  max1[0] = 1.0;
  QUESO::BoxSubset<QUESO::GslVector, QUESO::GslMatrix> set1("set1", vec_space,
      min1, max1);

  // Now for the second one
  QUESO::GslVector min2(vec_space.zeroVector());
  min2[0] = 0.5;
  QUESO::GslVector max2(vec_space.zeroVector());
  max2[0] = 1.5;
  QUESO::BoxSubset<QUESO::GslVector, QUESO::GslMatrix> set2("set1", vec_space,
      min2, max2);

  // Create their intersection
  QUESO::IntersectionSubset<QUESO::GslVector, QUESO::GslMatrix> intersection(
      "intersection", vec_space, 1.0, set1, set2);

  // Test the containment
  bool does_contain;
  QUESO::GslVector test_vec(vec_space.zeroVector());

  // Should be true
  test_vec[0] = 0.75;
  does_contain = intersection.contains(test_vec);
  if (!does_contain) {
    std::cerr << "First IntersectionSubset contains test failed" << std::endl;
    return 1;
  }

  // Should be false
  test_vec[0] = 2.0;
  does_contain = intersection.contains(test_vec);
  if (does_contain) {
    std::cerr << "Second contains test failed" << std::endl;
    return 1;
  }

  // Print out some info
  intersection.print(std::cout);

  MPI_Finalize();

  return 0;
}