<div dir="ltr"><div><div>Normally, NCL would use an LAPACK code to compute a mathematical quantity. However, LAPACK contains no such subroutine due to issues with accuracy and stability:  <br></div><br>       <a href="http://www.netlib.org/lapack/faq.html#_are_there_routines_in_lapack_to_compute_determinants">http://www.netlib.org/lapack/faq.html#_are_there_routines_in_lapack_to_compute_determinants</a><br><br></div>Really, 'they' (applied mathematicians) do not want people calculating the determinant.<br><div>===<br><br>NCL uses a computer program from:<br><br>    An Introduction 
to  Computational Physics, Tao Pang (Cambridge University 
Press,1997).<br>===<br><br></div><div>The use of integer or float values as input should have no effect. All non-double input is promoted to double prior to input to the fortran code used to perform the calculations. <br><br></div><div>I have no idea why you are encountering extremely long execution times. My 6.3.0 [MAC] returns a result more or less immediately. What version of gcc do you have installed? Please send the output from the following:<br><br></div><div>%> uname -a<br><br></div><div>%> gcc --version<br></div><div><br>====<br></div><div>That said:  I have tried to calculate the determinant with N=41<br><br></div><div>   N = 41<br></div><div>   x = random_uniform(0,5,(/N,N/))<br></div><div>   d = determinant(x)                          ; VERY fast; instantaneous return value<br></div><div>   print(d)<br></div><div><br></div><div>Variable: d<br>Type: float<br>Total Size: 4 bytes<br>            1 values<br>Number of Dimensions: 1<br>Dimensions and sizes:   [1]<br>Coordinates: <br>(0)     <b>1.767279e+31       <====  ????  I have no idea what the correct answer is<br><br></b></div><div>Ummm, rather large number!!!<br><br>====<br></div><div>I will open a JIRA trouble ticket and ask the core NCL developers if everything looks good.<br><br>====<br></div><div>Again, echoing LAPACK, calculating a determinant has issues.<br><br></div><div>Regards<br></div><div><b></b></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 10, 2018 at 6:34 AM, Lam Hoang <span dir="ltr"><<a href="mailto:lamhpvn@gmail.com" target="_blank">lamhpvn@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear all,<div>I want to calculate determinant of a 41x41 real (float) matrix. I used determinant() function <div><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/determinant.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>determinant.shtml</a></div><div><br></div><div>However it is very slow.</div><div><br></div><div>I try to run the sample in the above page, it's quick. Even if I replace integer values by float values (i.e replace 1 by 1.0, 0 by 0.0 and so on)</div><div>I try to create a 4x4 real matrix, give all members a value of 1.0</div><div>It seems that the determinant() function runs forever and does not return any value</div><div><br></div><div>In the following illustration, a is sample matrix after replacing integer by float values. It takes NCL few seconds to return the value d = 30</div><div><br></div><div>x is new 4x4 matrix created by my new() function, it never gives me any result.</div><div><br></div><div>




<i><span></span>





</i><p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i>Variable: a</i></span></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i>Type: float</i></span></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i>Total Size: 64 bytes</i></span></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i><span class="m_7003381718460655705gmail-Apple-converted-space">            </span>16 values</i></span></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i>Number of Dimensions: 2</i></span></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i>Dimensions and sizes:<span class="m_7003381718460655705gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>[4] x [4]</i></span></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i>Coordinates:<span class="m_7003381718460655705gmail-Apple-converted-space"> </span></i></span></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i>(0)<span class="m_7003381718460655705gmail-Apple-tab-span" style="white-space:pre-wrap">     </span>d = 30</i></span></p>
<p class="m_7003381718460655705gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255);min-height:13px"><i><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"></span><br></i></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i>Variable: x</i></span></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i>Type: float</i></span></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i>Total Size: 64 bytes</i></span></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i><span class="m_7003381718460655705gmail-Apple-converted-space">            </span>16 values</i></span></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i>Number of Dimensions: 2</i></span></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i>Dimensions and sizes:<span class="m_7003381718460655705gmail-Apple-tab-span" style="white-space:pre-wrap">   </span>[4] x [4]</i></span></p>
<p class="m_7003381718460655705gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="m_7003381718460655705gmail-s1" style="font-variant-ligatures:no-common-ligatures"><i>Coordinates:<span class="m_7003381718460655705gmail-Apple-converted-space"> </span></i></span></p>


<br></div><div><br></div><div><br></div><div>Any suggestion or solution for this?</div><div><br></div><div>Regards,</div><div><br></div><div><br></div><div>p/s: I am using NCL v6.3.0 <span class="HOEnZb"><font color="#888888"><div><div><br></div>-- <br><div class="m_7003381718460655705gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Lam Hoang, PhD<br>Chief of Climate Prediction Division,</div><div>Viet Nam National Center of Hydro-Meteorology Forecasting<br>National Hydro-Meteorological Services of Vietnam</div><div>8 Phao Dai Lang street, Lang Thuong, Dong Da, Ha Noi, Vietnam<br><span style="font-size:12.8px">Mob: +84 9 682 34 682 </span><br style="font-size:12.8px"><br></div><div>Associate Researcher,<br>School of Earth, Atmosphere and Environment <br>Monash University, VIC 3800<br>Email: <a href="mailto:lam.hoang@monash.edu" target="_blank">lam.hoang@monash.edu</a></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div></font></span></div></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>