I'm writing a linear algebra library (long story short, it's a school assignment) that involves matrices, vectors, etc. In the process of creating this library, I'm going to be creating functions that perform mathematical operations on objects. For example, transpose matrix, invert matrix, normalize vector, etc.
I was curious as to what is the "best practice" for this sort of function... That is, should I make the function a member function, or non-member? (For clarity/library use sake)
//Member function way: B = A.transpose(); C = A.inverse(); //Non-member function way: B = linalg::transpose(A); //Non-member transpose function in linear algebra namespace C = linalg::inverse(A);
Is there some standard regarding these sorts of operations? Or, at least, is there a common way people do this? I'm leaning towards the first option, but I'd like to know if this is recommended.