friend pvector operator-(const pvector& in1,const pvector& in2); friend pvector operator*(Complex c,const pvector& in1); friend pvector operator*(const pvector& in1,Complex c);Return value:
- operator-: in1-in2
- operator*: c*in1
Input:
- in1, in2: pvectors
- c: Complex number
Using the code provided for operator+() as a guide, write functions of the above prototype, again placing them within the definition of the pvector class. These are the functions that the compiler actually calls when it sees expressions like ``4.*rho+phi'' involving pvectors rho and phi. Note that you need to write two routines for multiplication, one for c*in1 and the other for in1*c because, from a compiler point of view, these really are distinct operations. Debug by uncommenting the tests for subtraction, scalar-pvector products and the algebra of the inner product.