FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Interface suggestions

 
Post new topic   Reply to topic     Forum Index -> Lyla
View previous topic :: View next topic  
Author Message
lyro



Joined: 10 Aug 2007
Posts: 3

PostPosted: Tue May 19, 2009 4:10 am    Post subject: Interface suggestions Reply with quote

In the current interface all unary matrix functions have the form
Code:
  sqrt(A);
  A.sqrt();
  sqrt( A, B );
  A.sqrt( B )

All stand-alone 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
Code:
  sqrt(A)

return a new Matrix without modifying A, (same for A.sqrt()). In this case the type of the result-matrix 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
Code:
 sqrt(A)
by
Code:
 sqrt(A, A)
and let
Code:
sqrt(A)
return a new matrix. Another one would be to define two functions with different names.

The same problem occurs with binary functions:
Code:
  add(A, B)
  A.add(B)

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.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Lyla All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group