lyro
Joined: 10 Aug 2007 Posts: 3

Posted: Tue May 19, 2009 4:10 am Post subject: Interface suggestions 


In the current interface all unary matrix functions have the form
Code:  sqrt(A);
A.sqrt();
sqrt( A, B );
A.sqrt( B ) 
All standalone functions store the result in their first argument, all member functions store the result in the receiver.
Although this is quite flexible in the sense, that the type of the resulting matrix can be specified explicitly, it's probably not what the user expects. It may be better to have
return a new Matrix without modifying A, (same for A.sqrt()). In this case the type of the resultmatrix would not be free but depends on the type of A.
The second approach may be what most users expect, the first one is more flexible. One solution would be to replace by and let return a new matrix. Another one would be to define two functions with different names.
The same problem occurs with binary functions:
store their result in A. On the other hand it's possible to return a new matrix without modifying A.
What would be the best solution to get a common, easy and flexible interface?
Please make suggestions. 
