6.8 Exercises 205
// inline int Array
/**/
/ IMPLEMENTATION OF FRIEND FUNCTIONS /
/**/
/**/
/ (Arithmetic) Unary operators /
/**/
//! Unary operator +
template
inlineArray
returnv;
}
//! Unary operator -
template
inlineArray
returnArray
}
//! Postmultiplication operator
template
inlineArray
returnArray
}
//! Premultiplication operator.
template
inlineArray
returnv*scalar;// Note the call to postmultiplication operator defined above
}
//! Division of the entries in a array by a scalar
template
inlineArray
if(!scalar) std::cout <<"Division by zero!"<< std::endl;
return(1.0/scalar)*v;
}
#endif
6.8 Exercises.
6.1.The aim of this exercise is to write your own Gaussian elimination code.
- Consider the linear system of equations
a 11 x 1 +a 12 x 2 +a 13 x 3 =w 1
a 21 x 1 +a 22 x 2 +a 23 x 3 =w 2
a 31 x 1 +a 32 x 2 +a 33 x 3 =w 3.