Thank you very much.<br><br>I am working on the translation of my application from Matlab to Scilab syntax, and there is a fair amount of work still to be done. So, no hurry.<br><br>Sebastien<br><br>PS: ain't that funny that most of the people posting on this forum are French or working in French-speaking institutions but write in English ? :D<br>
<br><div class="gmail_quote">On Wed, Nov 11, 2009 at 12:03 PM, Samuel Gougeon <span dir="ltr"><<a href="mailto:Samuel.Gougeon@univ-lemans.fr">Samuel.Gougeon@univ-lemans.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello Sébastien,<br>
<br>
Sébastien Bihorel <<a href="mailto:pomchip@free.fr" target="_blank">pomchip@free.fr</a>> a écrit :<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks your very much Samuel,<br>
<br>
This works such fine for the application I intend to use this code for.<br>
<br>
I assume that you are the author of this code, but, for some copyright<br>
issues, I would like that you confirm this point to me.<br>
</blockquote>
<br></div>
That's right<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
If indeed you are,<br>
would you authorize me to use (and/or modify) your code as part of an<br>
application distributed under a GNU license? To preserve appropriate<br>
copyrights, I could either add your name and affiliation in a comment<br>
section at the beginning of the .sci file or you could maybe create such an<br>
.sci and sent it to me at your convenience.<br>
</blockquote>
<br></div>
I will do so as soon as possible. I am aiming to propose this function (with<br>
improvements) as a SEP for Scilab ; then, i must get more infos from the<br>
Scilab's consortium about licensing of such contribs. I guess that it will<br>
be either under a GPL or Cecill license.<br>
<br>
If this matter urges for you, please note my Affiliation:<br>
Samuel Gougeon - Université du Maine, France (2009)<br>
<br>
Here is an improved release of ismember(), that now supports<br>
%inf values either in A or S, and with fixed mistakes in the<br>
head_comments:<div class="im"><br>
----<br>
function loc=ismember(A,S, highest)<br>
// loc = ismember(A, S, highest)<br>
//<br>
// A : Matrix of booleans, integers, reals, complexes, polynomes<br></div>
// (or any datatype supporting #*R real multiplication and ==<br>
// inter-comparison).<div class="im"><br>
// S : Matrix of same datatype than S<br>
// highest : Scalar boolean<br>
//<br>
// ismember() returns a matrix loc of A's format. loc(i,j) = linear<br></div>
// index in S of the first (highest ==%F), or the last (highest==%T)<br>
// occurrence of A(i,j). loc(i,j) returns zero if A(i,j) is not found.<br>
//<br>
// COPYRIGHT : Samuel GOUGEON - Université du Maine, France (2009)<br>
// LICENSE : CeCILL<div class="im"><br>
//<br>
LA=length(A);<br>
LS=length(S);<br>
A2=matrix(A,LA,1)*ones(1,LS) ;<br>
S2=(matrix(S,LS,1)*ones(1,LA)).' ;<br>
d01 =double(A2==S2);<br>
S_ind=ones(LA,1)*(1:LS);<br>
tmp=d01.*S_ind;<br>
if highest,<br>
tmp2=max(tmp,'c');<br>
else<br></div>
tmp(tmp==0)=2*LS; // Masks zeros=unfound as min values<br>
tmp2=min(tmp,'c');<br>
tmp2(tmp2==2*LS)=0; // Retrieves zeros=unfound<div class="im"><br>
end<br>
loc=matrix(tmp2,size(A));<br>
endfunction<br>
----<br></div><div class="im">
-->A,S<br>
A =<br>
<br>
7. 3.<br></div>
Inf 0.<div class="im"><br>
8. 1.<br>
S =<br>
<br>
5. 8. 0. 4.<br>
3. 4. 7. 7.<br></div>
3. Inf Inf 2.<div class="im"><br>
7. 5. 5. 8.<br>
<br>
-->ismember(A,S,%f)<br>
ans =<br>
<br>
4. 2.<br></div>
7. 9.<div class="im"><br>
5. 0.<br>
<br>
-->ismember(A,S,%t)<br>
ans =<br>
<br>
14. 3.<br></div>
11. 9.<br>
16. 0.<br>
---------<br>
Regards<br><font color="#888888">
Samuel<br>
<br>
</font></blockquote></div><br>