1
SUBROUTINE ANRS01(R,IR,M,B,X,IND,IO)
3
C***********************************************************************
6
C ORIGEN: Eduardo Casas Renteria *
7
C Cecilia Pola Mendez *
9
C Departamento de Matematicas,Estadistica y Computacion *
10
C ----------------------------------------------------- *
11
C UNIVERSIDAD DE CANTABRIA *
12
C ------------------------ *
15
C***********************************************************************
18
C Esta subrutina resuelve un sistema de ecuaciones lineales en el
19
C que la matriz de coeficientes es triangular.
24
C R Matriz de dimension (IR,M),triangular superior.Contiene
25
C en sus M primeras filas a la matriz de coeficientes del
26
C sistema.La parte subdiagonal de R no es utilizada.
28
C IR Primera dimension de la matriz R. IR >= N.
30
C M Numero de filas y columnas de la matriz de coeficientes.
32
C B Vector M-dimensional.Guarda los terminos independientes
35
C IND Indica el tipo de sistema a resolver,con los valores:
36
C 1 : Se resuelve R'x=b
37
C 2 : Se resuelve Rx=b
39
C IO Numero de canal de salida de resultados.
43
C X Vector m-dimensional en el que se recoge la solucion
46
C Esta subrutina trabaja en doble precision via una sentencia
48
C Implicit double precision (a-h,o-z)
50
C SUBPROGRAMAS AUXILIARES: ddot,dlamch
51
C FUNCIONES FORTRAN INTRINSECAS: abs,mod
54
implicit double precision(a-h,o-z)
55
dimension r(ir,*),b(*),x(*)
57
CXC Se comprueba si los valores de las variables son correctos
59
CX if(m.lt.1 .or. ir.lt.1 .or. m.gt.ir .or. ind.lt.1 .or. ind.gt.2)
61
CX write(io,1000) 'INCORRECT LIST OF CALLING IN ANRS01.'
65
CXC Se calcula un parametro para detectar la posible singularidad de
66
CXC la matriz de coeficientes
68
CX epsmch=dlamch('p')**0.9
70
C Se comienza la resolucion del sistema segun sea el indicador
77
CX if(abs(r(j,j)).lt.epsmch) then
78
CX write(io,1000) 'SINGULAR MATRIX IN ANRS01.'
98
CX if(abs(r(j,j)).lt.epsmch) then
99
CX write(io,1000) 'SINGULAR MATRIX IN ANRS01.'
102
x(j)=(b(j)-ddot(i1,r(j1,j2),k,x(j3),1))/r(j,j)