/************************************************* * BEGIN RVL UNIT TEST 2 * * Purpose: exercise RnSpace comparison and * * Vector inner product methods, RVLAssignConst * *************************************************/ 1. construct 5-diml RnSpace 2. construct RVL::Vector x in this space 3. construct RVLAssignConst FO, val = 1.0 4. evaluate, which makes x the const vector, val = 1 5. write out x Vector Object member of space: RnSpace: simple dense vector space dimension = 5 data container: RnArray Local Data Container object length = 5 samples: data[0] = 1 data[1] = 1 data[2] = 1 data[3] = 1 data[4] = 1 6. compute norm squared of x = 5 7. construct a second vector y in space 8. construct RVLAssignConst FO, val = 2.0 9. evaluate, which makes y the const.vector, val = 2 10. write out y Vector Object member of space: RnSpace: simple dense vector space dimension = 5 data container: RnArray Local Data Container object length = 5 samples: data[0] = 2 data[1] = 2 data[2] = 2 data[3] = 2 data[4] = 2 11. compute inner product of x, y = 10 should = 10 12. overwrite x with 1*x + 2*y, which should be const vector, val = 5 13. write out altered x Vector Object member of space: RnSpace: simple dense vector space dimension = 5 data container: RnArray Local Data Container object length = 5 samples: data[0] = 5 data[1] = 5 data[2] = 5 data[3] = 5 data[4] = 5 14. Create another Rn, dim = 4. 15. Create a vector z in the second Rn 16. evaluate RVLAssignConst, val = 2.0, on z 17. Attempt to evaluate inner product of x and z This should FAIL (throw an exception) because the spaces have different dimensions. Error: RVLL2innerProd::operator() operands do not have same dimension operand 1: RnArray Local Data Container object length = 5 samples: data[0] = 5 data[1] = 5 data[2] = 5 data[3] = 5 data[4] = 5 operand 2: RnArray Local Data Container object length = 4 samples: data[0] = 2 data[1] = 2 data[2] = 2 data[3] = 2 called from RVLL2innerProduct::operator() called from BinaryLocalConstEval::operator() (generic) called from LocalDataContainer::eval(...) const called from Space::inner *** called from Vector::inner(Vector &) /************************************************* * END RVL UNIT TEST 2 * *************************************************/