<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi Richard,</p>
<p><br>
</p>
<p>it is a bug only if the permutations do not lead to the same sequence. Otherwise you cannot expect to get&nbsp;the same sorting permutations for collections with redundant data&nbsp;on different platforms or even between different&nbsp;versions of compilers.</p>
<p><br>
</p>
<p>Cheers,</p>
<p>Oleg.</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> cctbxbb-bounces@phenix-online.org &lt;cctbxbb-bounces@phenix-online.org&gt; on behalf of richard.gildea@diamond.ac.uk &lt;richard.gildea@diamond.ac.uk&gt;<br>
<b>Sent:</b> 18 November 2016 14:12:29<br>
<b>To:</b> cctbxbb@phenix-online.org<br>
<b>Subject:</b> [cctbxbb] Unstable platform-dependent sort order for flex.sort_permutation</font>
<div>&nbsp;</div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Hi,<br>
<br>
I've been trying to diagnose why the miller array cc_anom calculations seem to be platform dependent. I've narrowed this down to a variation in the sort order returned by flex.sort_permutation which is called from within miller.array.sort(&quot;packed_indices&quot;).
 The following code demonstrates the problem and the different output I get on mac and Linux:<br>
<br>
Mac:<br>
&gt;&gt;&gt; from scitbx.array_family import flex<br>
&gt;&gt;&gt; a = flex.size_t([7, 1, 1, 5, 1, 3, 3, 7, 1, 7, 3, 3, 5, 7, 5, 5, 5, 1, 1, 1])<br>
&gt;&gt;&gt; print list(flex.sort_permutation(a))<br>
[1, 2, 4, 8, 17, 18, 19, 5, 6, 10, 11, 3, 12, 14, 15, 16, 0, 7, 9, 13]<br>
<br>
Linux:<br>
&gt;&gt;&gt; from scitbx.array_family import flex<br>
&gt;&gt;&gt; a = flex.size_t([7, 1, 1, 5, 1, 3, 3, 7, 1, 7, 3, 3, 5, 7, 5, 5, 5, 1, 1, 1])<br>
&gt;&gt;&gt; print list(flex.sort_permutation(a))<br>
[19, 1, 2, 18, 4, 17, 8, 11, 10, 6, 5, 12, 14, 15, 16, 3, 9, 7, 13, 0]<br>
<br>
Is it known/expected for the sort order to be platform dependent, or is this a bug?<br>
<br>
Here is the relevant code for flex.sort_permutation():<br>
<br>
<a href="https://github.com/cctbx/cctbx_project/blob/master/scitbx/array_family/sort.h">https://github.com/cctbx/cctbx_project/blob/master/scitbx/array_family/sort.h</a><br>
<br>
Cheers,<br>
<br>
Richard<br>
<br>
Dr Richard Gildea<br>
Data Analysis Scientist<br>
Tel: &#43;441235 77 8078<br>
<br>
Diamond Light Source Ltd.<br>
Diamond House<br>
Harwell Science &amp; Innovation Campus<br>
Didcot<br>
Oxfordshire<br>
OX11 0DE<br>
<br>
-- <br>
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt
 by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.<br>
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
<br>
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.<br>
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom<br>
<br>
<br>
_______________________________________________<br>
cctbxbb mailing list<br>
cctbxbb@phenix-online.org<br>
<a href="http://phenix-online.org/mailman/listinfo/cctbxbb">http://phenix-online.org/mailman/listinfo/cctbxbb</a><br>
</div>
</span></font>
</body>
</html>