<?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 Nonlinear Least Squares Problem without Constraints doesn't wor in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SOLVED-Nonlinear-Least-Squares-Problem-without-Constraints-doesn/m-p/892982#M10561</link>
    <description>&lt;P&gt;Hi Rene,&lt;/P&gt;
&lt;P&gt;Ive looked over your codes. At first sight here is a problem with djacobi calling. The first parameter is pointer to function which should has the following interface:&lt;/P&gt;
&lt;P&gt;fcn (m, n, x, f) with the following parameters:&lt;/P&gt;
&lt;P style="padding-left: 20pt;"&gt;m - INTEGER. Input parameter. Length of f&lt;/P&gt;
&lt;P style="padding-left: 20pt;"&gt;n - INTEGER. Input parameter. Length of x.&lt;/P&gt;
&lt;P style="padding-left: 20pt;"&gt;x - DOUBLE PRECISION. Input parameter. Array of size n. Vector, at which the function is evaluated. The fcn function should not change this parameter.&lt;/P&gt;
&lt;P style="padding-left: 20pt;"&gt;f - DOUBLE PRECISION. Output parameter. Array of size m; contains the function values at x.&lt;/P&gt;
&lt;P&gt;Declare fcn as EXTERNAL in the calling program.&lt;/P&gt;
&lt;P&gt;In your codes:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;If(djacobi(CalcErro,n,m,fjac,X,jac_eps)/=TR_SUCCESS) then&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Where:&lt;STRONG&gt; Subroutine Calcerro(X,Erro,XY,n,m,numneu)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;So, please change the interface or use the RCI version djacobi routine.&lt;/P&gt;
&lt;P&gt;If it doesnt work, please let me know.&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;--Nikita&lt;/P&gt;</description>
    <pubDate>Mon, 15 Feb 2010 09:35:49 GMT</pubDate>
    <dc:creator>Nikita_S_Intel</dc:creator>
    <dc:date>2010-02-15T09:35:49Z</dc:date>
    <item>
      <title>[SOLVED] Nonlinear Least Squares Problem without Constraints doesn't work properly???</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SOLVED-Nonlinear-Least-Squares-Problem-without-Constraints-doesn/m-p/892980#M10559</link>
      <description>&lt;P&gt;Hello, I'm trying to train some FeedForward Neural Networks wthi the dtrnlsp subroutines from MKL, but it seems not to work properly, I've been searching for an error for three days already and I just can't figure it out. So I think I'm not using it right. The files from my program are added here, It is small program and has the files.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Rede.f -&amp;gt; Starts the subroutines&lt;/P&gt;
&lt;P&gt;CalcErro.f -&amp;gt; Calculates the error of the neural network&lt;/P&gt;
&lt;P&gt;FF.f -&amp;gt; The Neural network itself, that write the weights, bias and the output for the function&lt;/P&gt;
&lt;P&gt;Gaussiana.f -&amp;gt; The activation function (Gaussian)&lt;/P&gt;
&lt;P&gt;Entradas.dat -&amp;gt; The input file, in this case a sinus in a half period&lt;/P&gt;
&lt;P&gt;Makefile -&amp;gt; Self explanatory&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Well, the problem is! it returns me Segmentation fault every time. I think is something wrong with the fvec, but I couldn't figure it out! As i'm not really sure that the files are here I will paste the files here too.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Rene&lt;/P&gt;
&lt;P&gt;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;/P&gt;
&lt;P&gt;Program Rede&lt;BR /&gt; &lt;BR /&gt; Implicit none&lt;BR /&gt;&lt;BR /&gt; integer i,j,k,l,m,n,numneu&lt;BR /&gt; parameter (m=200,numneu=8,n=3*numneu+1)&lt;BR /&gt; double precision Ent(m,2),X(n),eps(6),rs&lt;BR /&gt; double precision fvec(m),fjac(m,n),jac_eps,r1,r2&lt;BR /&gt; integer iter1,iter2,RCI_Request,sucesso,st_cr,iter&lt;BR /&gt; parameter (iter1=10000,iter2=100,rs=1d2,jac_eps=1d-8)&lt;BR /&gt; include "/opt/intel/Compiler/11.1/064/mkl/include/mkl_rci.fi"&lt;BR /&gt; integer*8 handle&lt;BR /&gt; external CalcErro&lt;BR /&gt;&lt;BR /&gt; Call Random_Seed()&lt;BR /&gt;&lt;BR /&gt; open (unit=1, file='Entradas.dat', status='unknown')&lt;BR /&gt; &lt;BR /&gt; do i=1,m&lt;BR /&gt; read(1,*)(Ent(i,j),j=1,2)&lt;BR /&gt; enddo&lt;BR /&gt;&lt;BR /&gt; Call Random_Number(X)&lt;BR /&gt; X=(X*2.d0)-1.d0&lt;BR /&gt;&lt;BR /&gt; eps(1)=1d-5&lt;BR /&gt; eps(2)=1d-5&lt;BR /&gt; eps(3)=1d-5&lt;BR /&gt; eps(4)=1d-5&lt;BR /&gt; eps(5)=1d-5&lt;BR /&gt; eps(6)=1d-5&lt;BR /&gt;&lt;BR /&gt; fvec=0.d0&lt;BR /&gt; fjac=0.d0&lt;BR /&gt;&lt;BR /&gt; if (dtrnlsp_init(handle,n,m,x,eps,iter1,iter2,rs)/=TR_SUCCESS)then&lt;BR /&gt; print*, 'Deu pau na hora de iniciar'&lt;BR /&gt; Call MKL_FREEBUFFERS&lt;BR /&gt; stop&lt;BR /&gt; end if &lt;BR /&gt; &lt;BR /&gt; RCI_Request=0&lt;BR /&gt; sucesso=0&lt;BR /&gt;&lt;BR /&gt; do while (sucesso==0)&lt;BR /&gt;&lt;BR /&gt; if (dtrnlsp_solve(handle, fvec, fjac, RCI_Request)/= TR_SUCCESS) then&lt;BR /&gt; print*,'Deu pau na hora de resolver'&lt;BR /&gt; Call MKL_FREEBUFFERS  &lt;BR /&gt; stop&lt;BR /&gt; end if&lt;BR /&gt;&lt;BR /&gt; Select Case (RCI_Request)&lt;BR /&gt;&lt;BR /&gt; Case (-1,-2,-3,-4,-5,-6)&lt;BR /&gt; Sucesso=1&lt;BR /&gt;&lt;BR /&gt; Case(1)&lt;BR /&gt; Call CalcErro(X,fvec,Ent,m,n,numneu)&lt;BR /&gt; &lt;BR /&gt; Case(2)&lt;BR /&gt; If(djacobi(CalcErro,n,m,fjac,X,jac_eps)/=TR_SUCCESS) then&lt;BR /&gt; Print*,'Deu pau na matriz Jacobiana'&lt;BR /&gt; Call MKL_FREEBUFFERS  &lt;BR /&gt; stop&lt;BR /&gt; end if&lt;BR /&gt; EndSelect&lt;BR /&gt; enddo   &lt;BR /&gt;&lt;BR /&gt; if (dtrnlsp_get(handle,iter,st_cr,r1,r2)/= TR_SUCCESS) then&lt;BR /&gt; Print*,'Deu pau no get'&lt;BR /&gt; Call MKL_FREEBUFFERS&lt;BR /&gt; stop&lt;BR /&gt; end if&lt;BR /&gt;&lt;BR /&gt; if (dtrnlsp_delete(handle)/= TR_SUCCESS) then&lt;BR /&gt; Print *, 'Deu pau na hora de apagar'&lt;BR /&gt; Call MKL_FREEBUFFERS&lt;BR /&gt; stop&lt;BR /&gt; end if&lt;BR /&gt;&lt;BR /&gt; Call MKL_FREEBUFFERS&lt;BR /&gt; if (r2&amp;lt;1d-5) then&lt;BR /&gt; Print *,'Deu certo'&lt;BR /&gt; else&lt;BR /&gt; Print*, 'Falhou'&lt;BR /&gt; end if&lt;BR /&gt;&lt;BR /&gt; Print *, st_cr&lt;BR /&gt; &lt;BR /&gt; Call FF(X,Ent,m,n,numneu)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; end Program Rede&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;/P&gt;
&lt;P&gt;c ******************************************************************&lt;BR /&gt;c    Calculo do Erro&lt;BR /&gt;c ******************************************************************&lt;BR /&gt; &lt;BR /&gt;c Subrotina utilizada para calcular o erro da rede&lt;BR /&gt;c O erro  calculado da seguinte forma&lt;BR /&gt;c&lt;BR /&gt;c Erro=(target-(saida da rede))&lt;BR /&gt;&lt;BR /&gt; Subroutine Calcerro(X,Erro,XY,n,m,numneu)&lt;BR /&gt;&lt;BR /&gt; Implicit none&lt;BR /&gt;c  &lt;BR /&gt; type neuronio&lt;BR /&gt; double precision entrada&lt;BR /&gt; double precision ativacao&lt;BR /&gt; end type neuronio&lt;BR /&gt;&lt;BR /&gt; integer i,j,k,l,m,n,numneu&lt;BR /&gt; Double precision Pesos(2*numneu), Erro(n), Bias(numneu+1),X(m)&lt;BR /&gt; Double precision Gauss, XY(n,2), Saida&lt;BR /&gt; type(neuronio) H1(numneu), Or&lt;BR /&gt; &lt;BR /&gt; Erro=0.d0&lt;BR /&gt;&lt;BR /&gt; k=0  &lt;BR /&gt; do i=1,2*numneu&lt;BR /&gt; k=k+1&lt;BR /&gt; Pesos(i)=X(k)&lt;BR /&gt; enddo &lt;BR /&gt;&lt;BR /&gt; do i=1,numneu+1&lt;BR /&gt; k=k+1&lt;BR /&gt; Bias(i)=X(k)&lt;BR /&gt; enddo&lt;BR /&gt; do l=1,n&lt;BR /&gt;&lt;BR /&gt; do i=1,numneu&lt;BR /&gt; H1(i)%entrada=0.d0&lt;BR /&gt; H1(i)%ativacao=0.d0&lt;BR /&gt; enddo&lt;BR /&gt;c   &lt;BR /&gt; Or%entrada=0.d0&lt;BR /&gt; Or%ativacao=0.d0&lt;BR /&gt;&lt;BR /&gt; do i=1,numneu&lt;BR /&gt; H1(i)%entrada=XY(l,1)*Pesos(i)&lt;BR /&gt; H1(i)%entrada=H1(i)%entrada+Bias(i)   &lt;BR /&gt; H1(i)%ativacao=Gauss(H1(i)%entrada)&lt;BR /&gt; enddo&lt;BR /&gt; &lt;BR /&gt; do i=(numneu+1),2*numneu&lt;BR /&gt; Or%entrada=Or%entrada+(H1(i-numneu)%ativacao*Pesos(i))&lt;BR /&gt; enddo&lt;BR /&gt; &lt;BR /&gt; Or%entrada=Or%entrada+Bias(numneu+1)  &lt;BR /&gt; Or%ativacao=Or%entrada&lt;BR /&gt; &lt;BR /&gt; Saida=0.d0  &lt;BR /&gt; Saida=Or%ativacao&lt;BR /&gt; Erro(l)=0.d0  &lt;BR /&gt; Erro(l)=(XY(l,2)-Saida)&lt;BR /&gt; enddo&lt;BR /&gt;&lt;BR /&gt; Print *, 'Passei por aqui'&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;return&lt;BR /&gt;&lt;BR /&gt; end subroutine Calcerro&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Function Gauss(W)&lt;BR /&gt; &lt;BR /&gt; Implicit none &lt;BR /&gt; double precision W, Gauss&lt;BR /&gt;&lt;BR /&gt; Gauss=dexp(-(W**2.d0))&lt;BR /&gt;&lt;BR /&gt; end Function Gauss&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Subroutine FF(X,XY,n,m,numneu)&lt;BR /&gt;&lt;BR /&gt; Implicit none&lt;BR /&gt;c  &lt;BR /&gt; type neuronio&lt;BR /&gt; double precision entrada&lt;BR /&gt; double precision ativacao&lt;BR /&gt; end type neuronio&lt;BR /&gt;&lt;BR /&gt; integer i,j,k,l,m,n,numneu&lt;BR /&gt; Double precision Pesos(2*numneu), Bias(numneu+1),X(3*numneu+1)&lt;BR /&gt; Double precision Gauss, XY(n,2), Saida(n)&lt;BR /&gt; type(neuronio) H1(numneu), Or&lt;BR /&gt; &lt;BR /&gt; Saida=0.d0&lt;BR /&gt;&lt;BR /&gt; k=0  &lt;BR /&gt; do i=1,2*numneu&lt;BR /&gt; k=k+1&lt;BR /&gt; Pesos(i)=X(k)&lt;BR /&gt; enddo &lt;BR /&gt;&lt;BR /&gt; do i=1,numneu+1&lt;BR /&gt; k=k+1&lt;BR /&gt; Bias(i)=X(k)&lt;BR /&gt; enddo&lt;BR /&gt; do l=1,n&lt;BR /&gt;&lt;BR /&gt; do i=1,numneu&lt;BR /&gt; H1(i)%entrada=0.d0&lt;BR /&gt; H1(i)%ativacao=0.d0&lt;BR /&gt; enddo&lt;BR /&gt;c   &lt;BR /&gt; Or%entrada=0.d0&lt;BR /&gt; Or%ativacao=0.d0&lt;BR /&gt;&lt;BR /&gt; do i=1,numneu&lt;BR /&gt; H1(i)%entrada=XY(l,1)*Pesos(i)&lt;BR /&gt; H1(i)%entrada=H1(i)%entrada+Bias(i)   &lt;BR /&gt; H1(i)%ativacao=Gauss(H1(i)%entrada)&lt;BR /&gt; enddo&lt;BR /&gt; &lt;BR /&gt; do i=(numneu+1),2*numneu&lt;BR /&gt; Or%entrada=Or%entrada+(H1(i-numneu)%ativacao*Pesos(i))&lt;BR /&gt; enddo&lt;BR /&gt; &lt;BR /&gt; Or%entrada=Or%entrada+Bias(numneu+1)  &lt;BR /&gt; Or%ativacao=Or%entrada&lt;BR /&gt; &lt;BR /&gt; Saida(l)=0.d0  &lt;BR /&gt; Saida(l)=Gauss(Or%ativacao)&lt;BR /&gt; enddo&lt;BR /&gt;&lt;BR /&gt; open (unit=5, file='Saida.dat', status='Unknown')&lt;BR /&gt;&lt;BR /&gt; do i=1,n&lt;BR /&gt; write(5,*) XY(i,1),Saida(i)&lt;BR /&gt; enddo&lt;BR /&gt;&lt;BR /&gt; open (unit=3, file='Pesos.dat', status='Unknown')&lt;BR /&gt;&lt;BR /&gt; do i=1,2*numneu&lt;BR /&gt; write(3,*) Pesos(i)&lt;BR /&gt; enddo&lt;BR /&gt;&lt;BR /&gt; open (unit=4, file='Bias.dat', status='Unknown')&lt;BR /&gt;&lt;BR /&gt; do i=1,numneu+1&lt;BR /&gt; write(4,*) Bias(i)&lt;BR /&gt; enddo&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; return&lt;BR /&gt;&lt;BR /&gt; end subroutine FF&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;SOURCE = Rede.f CalcErro.f Gaussiana.f FF.f&lt;BR /&gt;&lt;BR /&gt;FFLAGS =&lt;BR /&gt;&lt;BR /&gt;MKLINCLUDE= /opt/intel/Compiler/11.1/064/mkl/include&lt;BR /&gt;&lt;BR /&gt;MKLPATH = /opt/intel/Compiler/11.1/064/mkl/lib/em64t/&lt;BR /&gt;&lt;BR /&gt;LIBS = -L$(MKLPATH) -I$(MKLINCLUDE) -Wl,--start-group $(MKLPATH)libmkl_intel_lp64.a $(MKLPATH)libmkl_sequential.a $(MKLPATH)libmkl_core.a -Wl,--end-group -lpthread&lt;BR /&gt;&lt;BR /&gt;FC = ifort&lt;BR /&gt;all: &lt;BR /&gt; $(FC) $(FFLAGS) $(SOURCE) $(LIBS) -o Rede &lt;BR /&gt;&lt;BR /&gt;clean: &lt;BR /&gt; rm -rf Rede Pesos.dat Bias.dat Saida.dat&lt;/P&gt;</description>
      <pubDate>Sun, 14 Feb 2010 14:51:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SOLVED-Nonlinear-Least-Squares-Problem-without-Constraints-doesn/m-p/892980#M10559</guid>
      <dc:creator>renepreto</dc:creator>
      <dc:date>2010-02-14T14:51:34Z</dc:date>
    </item>
    <item>
      <title>Nonlinear Least Squares Problem without Constraints doesn't wor</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SOLVED-Nonlinear-Least-Squares-Problem-without-Constraints-doesn/m-p/892981#M10560</link>
      <description>&lt;P&gt;Segmentation fault means that you're trying to access a memory location that it is not allowed to access or in not allowed way (e.g. write to a read-only location). Check whether all arrays are correctly allocated and passed etc. Does the calling program "see" the FF function the right way. try to switch on automatic (or code it manually) interfaces for the routines, so compiler will have a chance to check couple of things for you.&lt;/P&gt;
&lt;P&gt;If this doesn't help, then post here exact error message and place where it appears.&lt;/P&gt;
&lt;P&gt;A.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2010 02:08:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SOLVED-Nonlinear-Least-Squares-Problem-without-Constraints-doesn/m-p/892981#M10560</guid>
      <dc:creator>ArturGuzik</dc:creator>
      <dc:date>2010-02-15T02:08:33Z</dc:date>
    </item>
    <item>
      <title>Nonlinear Least Squares Problem without Constraints doesn't wor</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SOLVED-Nonlinear-Least-Squares-Problem-without-Constraints-doesn/m-p/892982#M10561</link>
      <description>&lt;P&gt;Hi Rene,&lt;/P&gt;
&lt;P&gt;Ive looked over your codes. At first sight here is a problem with djacobi calling. The first parameter is pointer to function which should has the following interface:&lt;/P&gt;
&lt;P&gt;fcn (m, n, x, f) with the following parameters:&lt;/P&gt;
&lt;P style="padding-left: 20pt;"&gt;m - INTEGER. Input parameter. Length of f&lt;/P&gt;
&lt;P style="padding-left: 20pt;"&gt;n - INTEGER. Input parameter. Length of x.&lt;/P&gt;
&lt;P style="padding-left: 20pt;"&gt;x - DOUBLE PRECISION. Input parameter. Array of size n. Vector, at which the function is evaluated. The fcn function should not change this parameter.&lt;/P&gt;
&lt;P style="padding-left: 20pt;"&gt;f - DOUBLE PRECISION. Output parameter. Array of size m; contains the function values at x.&lt;/P&gt;
&lt;P&gt;Declare fcn as EXTERNAL in the calling program.&lt;/P&gt;
&lt;P&gt;In your codes:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;If(djacobi(CalcErro,n,m,fjac,X,jac_eps)/=TR_SUCCESS) then&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Where:&lt;STRONG&gt; Subroutine Calcerro(X,Erro,XY,n,m,numneu)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;So, please change the interface or use the RCI version djacobi routine.&lt;/P&gt;
&lt;P&gt;If it doesnt work, please let me know.&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;--Nikita&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2010 09:35:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SOLVED-Nonlinear-Least-Squares-Problem-without-Constraints-doesn/m-p/892982#M10561</guid>
      <dc:creator>Nikita_S_Intel</dc:creator>
      <dc:date>2010-02-15T09:35:49Z</dc:date>
    </item>
    <item>
      <title>Nonlinear Least Squares Problem without Constraints doesn't wor</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SOLVED-Nonlinear-Least-Squares-Problem-without-Constraints-doesn/m-p/892983#M10562</link>
      <description>&lt;P&gt;Thank You very much! It's working really fine! I've made the fcn subroutine and followed the example programs too! But your help was really important! I'm really grateful&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Rene&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2010 20:12:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/SOLVED-Nonlinear-Least-Squares-Problem-without-Constraints-doesn/m-p/892983#M10562</guid>
      <dc:creator>renepreto</dc:creator>
      <dc:date>2010-02-16T20:12:25Z</dc:date>
    </item>
  </channel>
</rss>

