<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic GoldenRetriever, in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917518#M12737</link>
    <description>&lt;P&gt;GoldenRetriever,&lt;/P&gt;

&lt;P&gt;I removed all the libraries and replaced the solver with a real*16 solver.&lt;/P&gt;

&lt;P&gt;I also placed code to check the size of the coefficients against the size of the error terms.&lt;/P&gt;

&lt;P&gt;After cycle 1, the max coefficient term when calculating the error matrix is 6.45052935008452D+9&lt;BR /&gt;
	The max error is 7.666822057217360E-007, which implies an accuracy of about 16 significant figures.&lt;BR /&gt;
	The determinant of the AA matrix is 2.085791801338600E+123.&lt;/P&gt;

&lt;P&gt;This AA matrix&amp;nbsp;appears to be a well conditioned matrix and there is minimal improvement in error after 2 cycles. There is little opportunity to improve or demonstrate improvement of the error.&lt;/P&gt;

&lt;P&gt;I think that the basic problem you have is the error you are looking for an error&amp;nbsp;magnitude of 1.e-10, where you should be looking for an error in terms of significant figures of error. For the changes I made, I am getting 16 significant figures, while I expect your original code provided something similar.&lt;/P&gt;

&lt;P&gt;John&lt;/P&gt;

&lt;P&gt;For some reason the attachment did not work. I will paste the code I changed below. Excuse the expected layout. Will this IDZ ever get fixed !!&lt;/P&gt;

&lt;P&gt;[fortran]!&amp;nbsp;&amp;nbsp;&amp;nbsp; USE MKL95_LAPACK&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp;&amp;nbsp; USE mkl95_blas&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; IMPLICIT&amp;nbsp;&amp;nbsp; NONE&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; INTEGER*4, parameter :: N&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ! size of problem&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; integer*4, parameter :: LIMIT = 11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ! number of itterations&lt;BR /&gt;
	!&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; INTEGER&amp;nbsp;&amp;nbsp;&amp;nbsp; I, J, k, ERROR_CODE&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; real*8 A(N,N), B(N,1),&amp;nbsp; AA(N,N), X(N,1) , XX(N,LIMIT), E(N,1)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; real*8 ErrorMax, s, determinant, v&lt;BR /&gt;
	!&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; real*16 acum&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	!&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; INTERFACE&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUBROUTINE MATRIX_SOLVE (MATRIX_IN, RHS, determinant, ERROR_CODE)&lt;BR /&gt;
	!&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real*8,&amp;nbsp;&amp;nbsp; dimension(:,:), intent (in)&amp;nbsp;&amp;nbsp;&amp;nbsp; :: matrix_in&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real*8,&amp;nbsp;&amp;nbsp; dimension(:,:), intent (inout) :: rhs&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real*8,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; intent (out)&amp;nbsp;&amp;nbsp; :: determinant&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer*4,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; intent (out)&amp;nbsp;&amp;nbsp; :: error_code&lt;BR /&gt;
	!&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END SUBROUTINE MATRIX_SOLVE&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; END INTERFACE&lt;BR /&gt;
	!&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp; BEGIN Read Input File&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; OPEN(111,FILE='TDReview_FEM-K_REDUCE.csv',STATUS='UNKNOWN', ACTION='READ')&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; REWIND(111)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; READ(111,*)&amp;nbsp;((A(i,j), j=1,N), i=1,N)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; CLOSE(111)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; OPEN(112,FILE='TDReview_FEM-LOAD_REDUCE.csv',STATUS='UNKNOWN', ACTION='READ')&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; REWIND(112)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; READ(112,*)&amp;nbsp;((B(i,j), j=1,1), i=1,N)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; CLOSE(112)&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp; END Read Input File&lt;/P&gt;

&lt;P&gt;! check A for symmetry&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; s = 0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; v = 0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; do i = 1,n&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j = i+1,n&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s = max (s, abs(a(i,j)-a(j,i)) )&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v = max (v, abs(a(i,j)) )&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) 'Max symmetry error =',s&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) 'Max coefficient&amp;nbsp;&amp;nbsp;&amp;nbsp; =',v&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; XX=0D0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; DO i=1,LIMIT&lt;BR /&gt;
	!&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ! Reasign AA which is modified when calling GESV&lt;BR /&gt;
	!&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; X(:,1) = SUM(XX,DIM=2)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j = 1,n&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acum = 0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do k = 1,i&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acum = acum + xx(j,k)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; X(j,1) = acum&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;BR /&gt;
	!&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; E = B - MATMUL(A,X)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v = 0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j = 1,n&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acum = B(j,1)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do k = 1,n&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acum = acum - A(j,k)*X(k,1)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v = max ( v, abs(A(j,k)*X(k,1)) )&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; E(j,1) = acum&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ErrorMax = MAXVAL(ABS(E))&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s = 0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do k = 1,N&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s = s + ABS (E(k,1))&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WRITE (*,*) 'LOOP',I&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) ' Max error term&amp;nbsp; :', ErrorMax&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) ' Avg error term&amp;nbsp; :', s/n&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) ' Max coefficient :', v&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (ErrorMax&amp;lt;1.D-10) EXIT&lt;BR /&gt;
	!&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALL GESV (AA, E)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call MATRIX_SOLVE (AA, E, determinant, ERROR_CODE)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) ' Solve error =',error_code&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) ' determinant =',determinant&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XX(:,i) = E(:,1)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; END DO&lt;/P&gt;

&lt;P&gt;!&amp;nbsp;&amp;nbsp;&amp;nbsp; OPEN(111,FILE='TDReview_FEM-DISP_VEC.csv',STATUS='UNKNOWN', ACTION='WRITE')&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DO i=1,N&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WRITE (*,"(1000(1x,F55.19,','))") X(i,:)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; END DO&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; END[/fortran]&lt;/P&gt;</description>
    <pubDate>Wed, 05 Mar 2014 04:40:00 GMT</pubDate>
    <dc:creator>John_Campbell</dc:creator>
    <dc:date>2014-03-05T04:40:00Z</dc:date>
    <item>
      <title>Subroutine to solve system of equation with the accuracy better than double precision</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917508#M12727</link>
      <description>&lt;P&gt;I'm currently using the&amp;nbsp;GESV subroutine from MKL library &amp;nbsp;to solve the system of equations (A.x=B). The number I used is Double Precision.&lt;/P&gt;

&lt;P&gt;I see the results are accurate up to 11 digits after the decimal point. Now I would like to have the &lt;SPAN style="color: rgb(68, 68, 68); font-family: arial, sans-serif; font-size: small; line-height: 16.1200008392334px;"&gt;accuracy is up to 16 digits but I can't find the solution yet.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Anyone suggests a solution for that would be highly appreciated.&lt;/P&gt;

&lt;P&gt;Thanks a heap!&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Feb 2014 10:22:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917508#M12727</guid>
      <dc:creator>GoldenRetriever</dc:creator>
      <dc:date>2014-02-16T10:22:16Z</dc:date>
    </item>
    <item>
      <title>If you're looking for a</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917509#M12728</link>
      <description>&lt;P&gt;If you're looking for a solution within MKL, the MKL forum would be a more likely choice to get you an answer. &amp;nbsp;Otherwise, you could look into trying the iterative refinement by building the iterative refinement method using a combination of double real(8) and quad real(16) data types.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Feb 2014 11:37:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917509#M12728</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2014-02-16T11:37:16Z</dc:date>
    </item>
    <item>
      <title>Quote:GoldenRetriever wrote:</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917510#M12729</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;GoldenRetriever wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;I'm currently using the&amp;nbsp;GESV subroutine from MKL library &amp;nbsp;to solve the system of equations (A.x=B). The number I used is Double Precision.&lt;/P&gt;

&lt;P&gt;I see the results are accurate up to 11 digits after the decimal point. Now I would like to have the accuracy is up to 16 digits but I can't find the solution yet.&lt;/P&gt;

&lt;P&gt;Anyone suggests a solution for that would be highly appreciated.&lt;/P&gt;

&lt;P&gt;Thanks a heap!&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;It seems to me what you're trying to achieve, "have the accuracy .. up to 16 digits ", would only be possible under a very specific set of conditions for a system of equations, non-linear I assume.&amp;nbsp; You would need to study your A matrix thoroughly, analyze its determinant, its eigenvalues, etc. and look at transformations to minimize any loss of precision during decompostion.&amp;nbsp; And then you can make use of QUAD precision intelligently to improve accuracy.&amp;nbsp; To me, this would be akin to&amp;nbsp;developing a "custom solver" for a given problem set, a departure from&amp;nbsp;using a general-purpose solver from MKL library.&lt;/P&gt;

&lt;P&gt;But should&amp;nbsp;you figure out&amp;nbsp;how to do this with a library solver like in MKL, please post back on this forum if you can do so.&amp;nbsp;&amp;nbsp;I, for one, will be very keen to&amp;nbsp;learn from your experience and would greatly appreciate your contribution!&lt;/P&gt;

&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2014 22:12:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917510#M12729</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2014-02-17T22:12:00Z</dc:date>
    </item>
    <item>
      <title>Potentially you can itterate</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917511#M12730</link>
      <description>&lt;P&gt;Potentially you can itterate on the error, by:&lt;/P&gt;

&lt;P&gt;calculate x for A.x = B&lt;BR /&gt;
	calculate the error e = B - A.x&lt;BR /&gt;
	calculate x' for A.x' = e&lt;/P&gt;

&lt;P&gt;Potentially then x+x' is a better solution.&lt;/P&gt;

&lt;P&gt;You should investigate why A.x-B is only accurate to 10 significant figures, when up to 16 could be possible with real(8)&lt;/P&gt;

&lt;P&gt;Often due to rounding during the calculation, the above approach does not improve the result.&lt;BR /&gt;
	You can try using real(16) (especially for the calculation of e using a real(16) accumulator), but this will only work if you can calculate the coefficients of A and B to real(16) precision. If you populate A and B as real(16) arrays with values calculated as real(8) you can achieve only limited improvement in the "accuracy" of the result, after consideration of the accuracy of the values used in A and B. This is due to the sensitivity of the error e to the inaccuracy of the coeffcicents of A and B.&lt;/P&gt;

&lt;P&gt;Poor precision is probably due to an "ill-conditioned" A, which can only be corrected by changing the problem definition.&lt;/P&gt;

&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2014 23:34:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917511#M12730</guid>
      <dc:creator>John_Campbell</dc:creator>
      <dc:date>2014-02-17T23:34:35Z</dc:date>
    </item>
    <item>
      <title>16 digits would be especially</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917512#M12731</link>
      <description>&lt;P&gt;16 digits would be especially difficult if you're using double precision, since the type itself is good to only about 15 digits. 11 digits for a complex calculation is about right.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2014 02:34:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917512#M12731</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-02-18T02:34:23Z</dc:date>
    </item>
    <item>
      <title>Thank you all for the reply.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917513#M12732</link>
      <description>&lt;P&gt;Thank you all for the reply. Appreciated that.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://software.intel.com/en-us/user/183066" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; line-height: 16.5px; background-color: rgb(238, 238, 238);"&gt;FortranFan&lt;/A&gt;: at this stage I prefer to use any available &lt;SPAN style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"&gt;general-purpose solver such as from MKL library&lt;/SPAN&gt;.&amp;nbsp;&lt;SPAN style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"&gt;&amp;nbsp;To&amp;nbsp;develop a kind of "custom solver" would be a bit out of my ability at the moment. Certainly will let you know if I find a way to get around with this.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://software.intel.com/en-us/user/517548" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; line-height: 16.5px; background-color: rgb(238, 238, 238);"&gt;John Campbell&lt;/A&gt;: what you suggested would be interesting to try out. I will have a go with it.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://software.intel.com/en-us/user/336903" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; line-height: 16.5px; background-color: rgb(238, 238, 238);"&gt;Tim Prince&lt;/A&gt;&amp;nbsp;&amp;amp;&amp;nbsp;&lt;A href="http://software.intel.com/en-us/user/512685" style="font-size: 11px; line-height: 16.5px; font-family: Arial, Helvetica, sans-serif;"&gt;Steve Lionel (Intel)&lt;/A&gt;: Using double precision, my arrays A and B are accurate up to 15 digits; however, the results give out from "&lt;SPAN style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"&gt;GESV" are only 11 digits of &lt;/SPAN&gt;accuracy&lt;FONT face="Arial, Helvetica, sans-serif"&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;. &amp;nbsp;I include a simple example of my case in the attached file for reference. In this example, the results are the displacements of a structure, they are supposed to be&amp;nbsp;symmetric but some values are not accurately symmetric as expected.&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT face="Arial, Helvetica, sans-serif"&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;I notice MKL has an&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;Expert Driver&amp;nbsp;named&amp;nbsp;&lt;SPAN style="color: rgb(51, 51, 51); font-family: 'Courier New', Courier, monospace; line-height: 20px;"&gt;gesvx which&amp;nbsp;&lt;/SPAN&gt;provides error bounds&amp;nbsp;on the solution.&amp;nbsp;I am not sure if it is something can help in this case. Anyone has experience using that please advise.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://www.dropbox.com/s/m9snqr3cddkx1g2/GESV.ZIP" target="_blank"&gt;https://www.dropbox.com/s/m9snqr3cddkx1g2/GESV.ZIP&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2014 10:39:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917513#M12732</guid>
      <dc:creator>GoldenRetriever</dc:creator>
      <dc:date>2014-02-19T10:39:59Z</dc:date>
    </item>
    <item>
      <title>Thank you all for the reply.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917514#M12733</link>
      <description>&lt;P&gt;Thank you all for the reply. Appreciated that.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://software.intel.com/en-us/user/183066" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; line-height: 16.5px; background-color: rgb(238, 238, 238);"&gt;FortranFan&lt;/A&gt;: at this stage I prefer to use any available &lt;SPAN style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"&gt;general-purpose solver such as from MKL library&lt;/SPAN&gt;.&amp;nbsp;&lt;SPAN style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"&gt;&amp;nbsp;To&amp;nbsp;develop a kind of "custom solver" would be a bit out of my ability at the moment. Certainly will let you know if I find a way to get around with this.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://software.intel.com/en-us/user/517548" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; line-height: 16.5px; background-color: rgb(238, 238, 238);"&gt;John Campbell&lt;/A&gt;: what you suggested would be interesting to try out. I will have a go with it.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://software.intel.com/en-us/user/336903" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; line-height: 16.5px; background-color: rgb(238, 238, 238);"&gt;Tim Prince&lt;/A&gt;&amp;nbsp;&amp;amp;&amp;nbsp;&lt;A href="http://software.intel.com/en-us/user/512685" style="font-size: 11px; line-height: 16.5px; font-family: Arial, Helvetica, sans-serif;"&gt;Steve Lionel (Intel)&lt;/A&gt;: Using double precision, my arrays A and B are accurate up to 15 digits; however, the results give out from "&lt;SPAN style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"&gt;GESV" are only 11 digits of &lt;/SPAN&gt;accuracy&lt;FONT face="Arial, Helvetica, sans-serif"&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;. &amp;nbsp;I include a simple example of my case in the attached file for reference. In this example, the results are the displacements of a structure, they are supposed to be&amp;nbsp;symmetric but some values are not accurately symmetric as expected.&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT face="Arial, Helvetica, sans-serif"&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;I notice MKL has an&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;Expert Driver&amp;nbsp;named&amp;nbsp;&lt;SPAN style="color: rgb(51, 51, 51); font-family: 'Courier New', Courier, monospace; line-height: 20px;"&gt;gesvx which&amp;nbsp;&lt;/SPAN&gt;provides error bounds&amp;nbsp;on the solution.&amp;nbsp;I am not sure if it is something can help in this case. Anyone has experience using that please advise.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://www.dropbox.com/s/m9snqr3cddkx1g2/GESV.ZIP" target="_blank"&gt;https://www.dropbox.com/s/m9snqr3cddkx1g2/GESV.ZIP&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2014 10:43:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917514#M12733</guid>
      <dc:creator>GoldenRetriever</dc:creator>
      <dc:date>2014-02-19T10:43:31Z</dc:date>
    </item>
    <item>
      <title>I am moving this thread to</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917515#M12734</link>
      <description>&lt;P&gt;I am moving this thread to the MKL forum.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2014 17:08:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917515#M12734</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-02-19T17:08:01Z</dc:date>
    </item>
    <item>
      <title>Did you try what I suggested</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917516#M12735</link>
      <description>&lt;P&gt;Did you try what I suggested on solving the error ?&lt;BR /&gt;
	Often this does not work, but in some circumstances it can help.&lt;/P&gt;

&lt;P&gt;The basic approach is:&lt;BR /&gt;
	&amp;nbsp; given B = A . x&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;a first solution estimate is x1&lt;BR /&gt;
	&amp;nbsp; this gives e = B - A . x1&lt;BR /&gt;
	&amp;nbsp; solving e = A . xe&lt;BR /&gt;
	&amp;nbsp; an improved solution is B = e + A . x1 = A . ( x1 + xe)&lt;BR /&gt;
	&amp;nbsp; and e2 = B - A . (x1 + xe)&lt;/P&gt;

&lt;P&gt;You can check the accuracy by either the maximum absolure error or the sum of the square error terms. ( e'.e )&lt;BR /&gt;
	Calculating e and e2 to higher precision can help.&lt;/P&gt;

&lt;P&gt;I'd be interested if it proved effective or ineffective, if you had a chance to test it out.&lt;/P&gt;

&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Mon, 03 Mar 2014 04:23:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917516#M12735</guid>
      <dc:creator>John_Campbell</dc:creator>
      <dc:date>2014-03-03T04:23:44Z</dc:date>
    </item>
    <item>
      <title>Thanks John for your follow</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917517#M12736</link>
      <description>&lt;P&gt;Thanks John for your follow up.&lt;/P&gt;

&lt;P&gt;I could not get it work even your&amp;nbsp;method&amp;nbsp;does sound make sense to me.&lt;/P&gt;

&lt;P&gt;I include a simple example with array of 16x16 in attached file if you interest to have a try with it. Please let me know if you can spot any problem with what I have done.&lt;/P&gt;

&lt;P&gt;Thanks very much mate.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2014 12:34:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917517#M12736</guid>
      <dc:creator>GoldenRetriever</dc:creator>
      <dc:date>2014-03-04T12:34:54Z</dc:date>
    </item>
    <item>
      <title>GoldenRetriever,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917518#M12737</link>
      <description>&lt;P&gt;GoldenRetriever,&lt;/P&gt;

&lt;P&gt;I removed all the libraries and replaced the solver with a real*16 solver.&lt;/P&gt;

&lt;P&gt;I also placed code to check the size of the coefficients against the size of the error terms.&lt;/P&gt;

&lt;P&gt;After cycle 1, the max coefficient term when calculating the error matrix is 6.45052935008452D+9&lt;BR /&gt;
	The max error is 7.666822057217360E-007, which implies an accuracy of about 16 significant figures.&lt;BR /&gt;
	The determinant of the AA matrix is 2.085791801338600E+123.&lt;/P&gt;

&lt;P&gt;This AA matrix&amp;nbsp;appears to be a well conditioned matrix and there is minimal improvement in error after 2 cycles. There is little opportunity to improve or demonstrate improvement of the error.&lt;/P&gt;

&lt;P&gt;I think that the basic problem you have is the error you are looking for an error&amp;nbsp;magnitude of 1.e-10, where you should be looking for an error in terms of significant figures of error. For the changes I made, I am getting 16 significant figures, while I expect your original code provided something similar.&lt;/P&gt;

&lt;P&gt;John&lt;/P&gt;

&lt;P&gt;For some reason the attachment did not work. I will paste the code I changed below. Excuse the expected layout. Will this IDZ ever get fixed !!&lt;/P&gt;

&lt;P&gt;[fortran]!&amp;nbsp;&amp;nbsp;&amp;nbsp; USE MKL95_LAPACK&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp;&amp;nbsp; USE mkl95_blas&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; IMPLICIT&amp;nbsp;&amp;nbsp; NONE&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; INTEGER*4, parameter :: N&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ! size of problem&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; integer*4, parameter :: LIMIT = 11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ! number of itterations&lt;BR /&gt;
	!&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; INTEGER&amp;nbsp;&amp;nbsp;&amp;nbsp; I, J, k, ERROR_CODE&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; real*8 A(N,N), B(N,1),&amp;nbsp; AA(N,N), X(N,1) , XX(N,LIMIT), E(N,1)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; real*8 ErrorMax, s, determinant, v&lt;BR /&gt;
	!&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; real*16 acum&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	!&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; INTERFACE&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUBROUTINE MATRIX_SOLVE (MATRIX_IN, RHS, determinant, ERROR_CODE)&lt;BR /&gt;
	!&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real*8,&amp;nbsp;&amp;nbsp; dimension(:,:), intent (in)&amp;nbsp;&amp;nbsp;&amp;nbsp; :: matrix_in&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real*8,&amp;nbsp;&amp;nbsp; dimension(:,:), intent (inout) :: rhs&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real*8,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; intent (out)&amp;nbsp;&amp;nbsp; :: determinant&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer*4,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; intent (out)&amp;nbsp;&amp;nbsp; :: error_code&lt;BR /&gt;
	!&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END SUBROUTINE MATRIX_SOLVE&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; END INTERFACE&lt;BR /&gt;
	!&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp; BEGIN Read Input File&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; OPEN(111,FILE='TDReview_FEM-K_REDUCE.csv',STATUS='UNKNOWN', ACTION='READ')&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; REWIND(111)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; READ(111,*)&amp;nbsp;((A(i,j), j=1,N), i=1,N)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; CLOSE(111)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; OPEN(112,FILE='TDReview_FEM-LOAD_REDUCE.csv',STATUS='UNKNOWN', ACTION='READ')&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; REWIND(112)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; READ(112,*)&amp;nbsp;((B(i,j), j=1,1), i=1,N)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; CLOSE(112)&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp; END Read Input File&lt;/P&gt;

&lt;P&gt;! check A for symmetry&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; s = 0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; v = 0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; do i = 1,n&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j = i+1,n&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s = max (s, abs(a(i,j)-a(j,i)) )&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v = max (v, abs(a(i,j)) )&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) 'Max symmetry error =',s&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) 'Max coefficient&amp;nbsp;&amp;nbsp;&amp;nbsp; =',v&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; XX=0D0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; DO i=1,LIMIT&lt;BR /&gt;
	!&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ! Reasign AA which is modified when calling GESV&lt;BR /&gt;
	!&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; X(:,1) = SUM(XX,DIM=2)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j = 1,n&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acum = 0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do k = 1,i&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acum = acum + xx(j,k)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; X(j,1) = acum&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;BR /&gt;
	!&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; E = B - MATMUL(A,X)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v = 0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j = 1,n&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acum = B(j,1)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do k = 1,n&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acum = acum - A(j,k)*X(k,1)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v = max ( v, abs(A(j,k)*X(k,1)) )&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; E(j,1) = acum&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ErrorMax = MAXVAL(ABS(E))&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s = 0&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do k = 1,N&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s = s + ABS (E(k,1))&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WRITE (*,*) 'LOOP',I&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) ' Max error term&amp;nbsp; :', ErrorMax&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) ' Avg error term&amp;nbsp; :', s/n&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) ' Max coefficient :', v&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF (ErrorMax&amp;lt;1.D-10) EXIT&lt;BR /&gt;
	!&lt;BR /&gt;
	!&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALL GESV (AA, E)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call MATRIX_SOLVE (AA, E, determinant, ERROR_CODE)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) ' Solve error =',error_code&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) ' determinant =',determinant&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XX(:,i) = E(:,1)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; END DO&lt;/P&gt;

&lt;P&gt;!&amp;nbsp;&amp;nbsp;&amp;nbsp; OPEN(111,FILE='TDReview_FEM-DISP_VEC.csv',STATUS='UNKNOWN', ACTION='WRITE')&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DO i=1,N&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WRITE (*,"(1000(1x,F55.19,','))") X(i,:)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; END DO&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; END[/fortran]&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2014 04:40:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917518#M12737</guid>
      <dc:creator>John_Campbell</dc:creator>
      <dc:date>2014-03-05T04:40:00Z</dc:date>
    </item>
    <item>
      <title>Thanks John for that,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917519#M12738</link>
      <description>&lt;P&gt;Thanks John for that,&lt;/P&gt;

&lt;P&gt;I could not see the mentioned "&lt;SPAN style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px;"&gt;real*16 solver" in the code. I could not reproduced your code to make it works as well. Did I miss anything?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;PS: the procedure to attach file on this forum is a bit different from the normal way of attaching file as most email webpage does. It&amp;nbsp;is a bit confusing; after choosing to add the file we actually need one more step to upload them to get it TRULY added to the post. 75% of the time I failed to attach the file; sadly that's true. Should it be something Intel Forum to fix? Yes. ;)&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2014 10:51:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917519#M12738</guid>
      <dc:creator>GoldenRetriever</dc:creator>
      <dc:date>2014-03-05T10:51:49Z</dc:date>
    </item>
    <item>
      <title>Attached is the hybrid</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917520#M12739</link>
      <description>&lt;P&gt;Attached is the hybrid version which mixes real*8 and real*16 for the equation solution. If you want a fully real*16 solution, change most real*8 to real*16. For a fully real*8 solution, change real*16 to real*8 in the solver, while keeping acum as real*16.&lt;/P&gt;

&lt;P&gt;You should see that the error does not change significantly and given the maximum value of the coefficients and load case, the errors reported are quite acceptable.&lt;/P&gt;

&lt;P&gt;I adapted this code to inspect the errors during the calculation. MKL does provide better routines for refining the error, but I think they would also find that as the matrix is well conditioned, there is not much scope for improvement.&lt;/P&gt;

&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2014 05:57:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Subroutine-to-solve-system-of-equation-with-the-accuracy-better/m-p/917520#M12739</guid>
      <dc:creator>John_Campbell</dc:creator>
      <dc:date>2014-03-06T05:57:33Z</dc:date>
    </item>
  </channel>
</rss>

