Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Segment fail on fortran 90 code

Status
Not open for further replies.

Andrewgaven

Technical User
Feb 16, 2009
6
VE
Hello all, i'm a newbie to fortran 90, i believe that there a mistake with my variable er3 declaration but i can't find it. my code is:
----------------------------------
SUBROUTINE BACKWARD(E,Y,p,L,k,pqr,O5,er5,er4,er3)
IMPLICIT NONE
INTEGER , INTENT(IN) :: p,k,L
INTEGER :: i,j,jo
REAL , INTENT(IN) :: E(p,k),Y(p,1),pqr(L**k,k+1),O5(1,p)
REAL , INTENT(OUT) :: er5(1,p),er4(L**k,p),er3(L**k,p)
REAL :: T(1,p),U(1,k+1),pal(L**k,2),pala(L**k,p)
REAL(kind=4) :: err
T=transpose(Y);
er5=-2*(T-O5);
U(1,k+1)=1.;
do j=1,p
er4:),j)=(/ (er5(1,j), i=1,L**k) /)
do i=1,k
U(1,i)=E(j,i);
enddo
pala:),j)=(/ (matmul(pqr,transpose(U))) /)
enddo
do i=1,L**k
er3(i,:)=(/ (er4(i,j)*pala(i,j), j=1,p)/)
enddo
do i=1,3
write(*,*) er3(i,:)
enddo
end SUBROUTINE
------------------------------
went executed this code shows the matrix er3 followed by
"fallo de segmentacion" (Spanish for "Segment fail").

Does anyone see anything wrong?
thanks in advance.


 
What sort of value does L**k end up as?

In the call to transpose y, how does it know that Y is of size (p,1)
 
Thank for the reply
these variables are defined in the main program but are related to the others input.
[p,k]=size(E); --> this is scilab code
"E" is the data matrix entry, "k" is the number column, and p the number or rows
"Y" is the data matrix output, it is only a single column and p rows.
"L" is an integer number it indicates the number of membership function because this is intended to be use in a fuzzy inference system.
The dimension of the other variables is always dependent o L,p and k.

this code works as my main program and defines all the variables need it.
----------------------------------------------------
integer k,L,p
real E(p,k),Y(p,1),abc(3*L*k,1),pqr(L,k+1),O5(1,p),O4(L**k,p),O3(L**k,p),O2(L**k,p),O1(L**k,p),er5(1,p),er4(L**k,p)
p=10;L=3;k=1;

E(1,1)=10700;E(2,1)=10700;E(3,1)=10700;E(4,1)=10600;E(5,1)=10600;E(6,1)=10600;E(7,1)=10600;E(8,1)=10600;E(9,1)=10500;E(10,1)=10600;

Y(1,1)=12536;Y(2,1)=12536;Y(3,1)=12532;Y(4,1)=12532;Y(5,1)=12532;Y(6,1)=12532;Y(7,1)=12528;Y(8,1)=12528;Y(9,1)=12528;Y(10,1)=12524;

abc(1,1)=50.;abc(2,1)=2.;abc(3,1)=10500.;abc(4,1)=50.;abc(5,1)=2.;abc(6,1)=10600.;abc(7,1)=50.;abc(8,1)=2.;abc(9,1)=10700.;

pqr(1,1)=1.1938868;pqr(1,2)=0.0001136;pqr(2,1)=1.1819761;pqr(2,2)=0.0001115;pqr(3,1)=1.1707586;pqr(3,2)=0.0001095;

O5(1,1)=12534.667;O5(1,2)=12534.667;O5(1,3)=12534.667;O5(1,4)=12529.333;O5(1,5)=12529.333;O5(1,6)=12529.333;O5(1,7)=12529.333;
O5(1,8)=12529.333;O5(1,9)=12528.;O5(1,10)=12529.333;

O4(1,1)=46.77321;O4(1,2)=46.77321;O4(1,3)=46.77321;O4(1,4)=666.06318;O4(1,5)=666.06318;O4(1,6)=666.06318;O4(1,7)=666.06318;
O4(1,8)=666.06318;O4(1,9)=11796.029;O4(1,10)=666.06318;O4(2,1)=700.04653;O4(2,2)=700.04653;O4(2,3)=700.04653;O4(2,4)=11210.11;
O4(2,5)=11210.11;O4(2,6)=11210.11;O4(2,7)=11210.11;O4(2,8)=11210.11;O4(2,9)=686.96155;O4(2,10)=11210.11;O4(3,1)=11787.847;
O4(3,2)=11787.847;O4(3,3)=11787.847;O4(3,4)=653.16005;O4(3,5)=653.16005;O4(3,6)=653.16005;O4(3,7)=653.16005;O4(3,8)=653.16005;
O4(3,9)=45.00978;O4(3,10)=653.16005;

O3(1,1)=0.0036614;O3(1,2)=0.0036614;O3(1,3)=0.0036614;O3(1,4)=0.0526316;O3(1,5)=0.0526316;O3(1,6)=0.0526316;O3(1,7)=0.0526316;
O3(1,8)=0.0526316;O3(1,9)=0.9409864;O3(1,10)=0.0526316;O3(2,1)=0.0553521;O3(2,2)=0.0553521;O3(2,3)=0.0553521;O3(2,4)=0.8947368;
O3(2,5)=0.8947368;O3(2,6)=0.8947368;O3(2,7)=0.8947368;O3(2,8)=0.8947368;O3(2,9)=0.0553521;O3(2,10)=0.8947368;O3(3,1)=0.9409864;
O3(3,2)=0.9409864;O3(3,3)=0.9409864;O3(3,4)=0.0526316;O3(3,5)=0.0526316;O3(3,6)=0.0526316;O3(3,7)=0.0526316;O3(3,8)=0.0526316;
O3(3,9)=0.0036614;O3(3,10)=0.0526316;

O2(1,1)=0.0038911;O2(1,2)=0.0038911;O2(1,3)=0.0038911;O2(1,4)=0.0588235;O2(1,5)=0.0588235;O2(1,6)=0.0588235;O2(1,7)=0.0588235;
O2(1,8)=0.0588235;O2(1,9)=1.;O2(1,10)=0.0588235;O2(2,1)=0.0588235;O2(2,2)=0.0588235;O2(2,3)=0.0588235;O2(2,4)=1.;O2(2,5)=1.;
O2(2,6)=1.;O2(2,7)=1.;O2(2,8)=1.;O2(2,9)=0.0588235;O2(2,10)=1.;O2(3,1)=1.;O2(3,2)=1.;O2(3,3)=1.;O2(3,4)=0.0588235;O2(3,5)=0.0588235;
O2(3,6)=0.0588235;O2(3,7)=0.0588235;O2(3,8)=0.0588235;O2(3,9)=0.0038911;O2(3,10)=0.0588235;

O1(1,1)=0.0038911;O1(1,2)=0.0038911;O1(1,3)=0.0038911;O1(1,4)=0.0588235;O1(1,5)=0.0588235;O1(1,6)=0.0588235;O1(1,7)=0.0588235;
O1(1,8)=0.0588235;O1(1,9)=1.;O1(1,10)=0.0588235;O1(2,1)=0.0588235;O1(2,2)=0.0588235;O1(2,3)=0.0588235;O1(2,4)=1.;O1(2,5)=1.;
O1(2,6)=1.;O1(2,7)=1.;O1(2,8)=1.;O1(2,9)=0.0588235;O1(2,10)=1.;O1(3,1)=1.;O1(3,2)=1.;O1(3,3)=1.;O1(3,4)=0.0588235;O1(3,5)=0.0588235;
O1(3,6)=0.0588235;O1(3,7)=0.0588235;O1(3,8)=0.0588235;O1(3,9)=0.0038911;O1(3,10)=0.0588235;

call BACKWARD(E,Y,p,L,k,pqr,O5,er5,er4,er3)
-------------------------------------------
After coping this i realize that i haven't defined the er3 variable in the main code. I feel so stupid :(
now it works fine. Thank anyway
I'm still a beginner so if you know of a better way to write this code i really appreciate some constructive criticism.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top