|  | @@ -75,28 +75,76 @@ TEST(IdentityParameterization, EverythingTest) {
 | 
	
		
			
				|  |  |    EXPECT_EQ((local_matrix - global_matrix).norm(), 0.0);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -TEST(SubsetParameterization, DeathTests) {
 | 
	
		
			
				|  |  | -  std::vector<int> constant_parameters;
 | 
	
		
			
				|  |  | -  EXPECT_DEATH_IF_SUPPORTED(
 | 
	
		
			
				|  |  | -      SubsetParameterization parameterization(1, constant_parameters),
 | 
	
		
			
				|  |  | -      "at least");
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  constant_parameters.push_back(0);
 | 
	
		
			
				|  |  | +TEST(SubsetParameterization, NegativeParameterIndexDeathTest) {
 | 
	
		
			
				|  |  | +  std::vector<int> constant_parameters;
 | 
	
		
			
				|  |  | +  constant_parameters.push_back(-1);
 | 
	
		
			
				|  |  |    EXPECT_DEATH_IF_SUPPORTED(
 | 
	
		
			
				|  |  | -      SubsetParameterization parameterization(1, constant_parameters),
 | 
	
		
			
				|  |  | -      "Number of parameters");
 | 
	
		
			
				|  |  | +      SubsetParameterization parameterization(2, constant_parameters),
 | 
	
		
			
				|  |  | +      "greater than zero");
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  constant_parameters.push_back(1);
 | 
	
		
			
				|  |  | +TEST(SubsetParameterization, GreaterThanSizeParameterIndexDeathTest) {
 | 
	
		
			
				|  |  | +  std::vector<int> constant_parameters;
 | 
	
		
			
				|  |  | +  constant_parameters.push_back(2);
 | 
	
		
			
				|  |  |    EXPECT_DEATH_IF_SUPPORTED(
 | 
	
		
			
				|  |  |        SubsetParameterization parameterization(2, constant_parameters),
 | 
	
		
			
				|  |  | -      "Number of parameters");
 | 
	
		
			
				|  |  | +      "less than the size");
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +TEST(SubsetParameterization, DuplicateParametersDeathTest) {
 | 
	
		
			
				|  |  | +  std::vector<int> constant_parameters;
 | 
	
		
			
				|  |  | +  constant_parameters.push_back(1);
 | 
	
		
			
				|  |  |    constant_parameters.push_back(1);
 | 
	
		
			
				|  |  |    EXPECT_DEATH_IF_SUPPORTED(
 | 
	
		
			
				|  |  |        SubsetParameterization parameterization(2, constant_parameters),
 | 
	
		
			
				|  |  |        "duplicates");
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +TEST(SubsetParameterization,
 | 
	
		
			
				|  |  | +     ProductParameterizationWithZeroLocalSizeSubsetParameterization1) {
 | 
	
		
			
				|  |  | +  std::vector<int> constant_parameters;
 | 
	
		
			
				|  |  | +  constant_parameters.push_back(0);
 | 
	
		
			
				|  |  | +  LocalParameterization* subset_param =
 | 
	
		
			
				|  |  | +      new SubsetParameterization(1, constant_parameters);
 | 
	
		
			
				|  |  | +  LocalParameterization* identity_param = new IdentityParameterization(2);
 | 
	
		
			
				|  |  | +  ProductParameterization product_param(subset_param, identity_param);
 | 
	
		
			
				|  |  | +  EXPECT_EQ(product_param.GlobalSize(), 3);
 | 
	
		
			
				|  |  | +  EXPECT_EQ(product_param.LocalSize(), 2);
 | 
	
		
			
				|  |  | +  double x[] = {1.0, 1.0, 1.0};
 | 
	
		
			
				|  |  | +  double delta[] = {2.0, 3.0};
 | 
	
		
			
				|  |  | +  double x_plus_delta[] = {0.0, 0.0, 0.0};
 | 
	
		
			
				|  |  | +  EXPECT_TRUE(product_param.Plus(x, delta, x_plus_delta));
 | 
	
		
			
				|  |  | +  EXPECT_EQ(x_plus_delta[0], x[0]);
 | 
	
		
			
				|  |  | +  EXPECT_EQ(x_plus_delta[1], x[1] + delta[0]);
 | 
	
		
			
				|  |  | +  EXPECT_EQ(x_plus_delta[2], x[2] + delta[1]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  Matrix actual_jacobian(3, 2);
 | 
	
		
			
				|  |  | +  EXPECT_TRUE(product_param.ComputeJacobian(x, actual_jacobian.data()));
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +TEST(SubsetParameterization,
 | 
	
		
			
				|  |  | +     ProductParameterizationWithZeroLocalSizeSubsetParameterization2) {
 | 
	
		
			
				|  |  | +  std::vector<int> constant_parameters;
 | 
	
		
			
				|  |  | +  constant_parameters.push_back(0);
 | 
	
		
			
				|  |  | +  LocalParameterization* subset_param =
 | 
	
		
			
				|  |  | +      new SubsetParameterization(1, constant_parameters);
 | 
	
		
			
				|  |  | +  LocalParameterization* identity_param = new IdentityParameterization(2);
 | 
	
		
			
				|  |  | +  ProductParameterization product_param(identity_param, subset_param);
 | 
	
		
			
				|  |  | +  EXPECT_EQ(product_param.GlobalSize(), 3);
 | 
	
		
			
				|  |  | +  EXPECT_EQ(product_param.LocalSize(), 2);
 | 
	
		
			
				|  |  | +  double x[] = {1.0, 1.0, 1.0};
 | 
	
		
			
				|  |  | +  double delta[] = {2.0, 3.0};
 | 
	
		
			
				|  |  | +  double x_plus_delta[] = {0.0, 0.0, 0.0};
 | 
	
		
			
				|  |  | +  EXPECT_TRUE(product_param.Plus(x, delta, x_plus_delta));
 | 
	
		
			
				|  |  | +  EXPECT_EQ(x_plus_delta[0], x[0] + delta[0]);
 | 
	
		
			
				|  |  | +  EXPECT_EQ(x_plus_delta[1], x[1] + delta[1]);
 | 
	
		
			
				|  |  | +  EXPECT_EQ(x_plus_delta[2], x[2]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  Matrix actual_jacobian(3, 2);
 | 
	
		
			
				|  |  | +  EXPECT_TRUE(product_param.ComputeJacobian(x, actual_jacobian.data()));
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  TEST(SubsetParameterization, NormalFunctionTest) {
 | 
	
		
			
				|  |  |    const int kGlobalSize = 4;
 | 
	
		
			
				|  |  |    const int kLocalSize = 3;
 |