subroutine nbterm(m,n,nrs,a,b,norm,maxprm,minprm,tr) c*********************************************************************72 c c nbterm() computes data needed to terminate the solution process. c c Discussion: c c This routine computes three integers MAXPRM, MINPRM c and TR which are used by exsolg to terminate the exact c solution of the system of linear equations ax=b. c c NBTERM uses several inequalities described in the companion paper. c c kprime is a linear array containing 100 distinct prime c (input) integers in ascending order. the primes are chosen c as large as possible subject to the condition that c for all i and j kprime(i)*kprime(j) does not overflow c an integer word. these primes are used by exsolg c as moduli in the exact computation and as radii for c the representation of the integer results in c mixed-radix from. c c m is the number of equations in the system. (i.e., m is c (input) the size of the first dimensions of a and b.) c c n is the number of unknowns in the system. (i.e., n is c (input) the size of the second dimension of a.) c c nrs is the number of right-hand sides in the system. c (input) (i.e., nrs is the size of the second dimension of b.) c c a is an integer matrix of dimension m by n which c (input) contains the matrix of coefficients. c c b is an integer matrix of dimension m by nrs which c (input) contains the matrix of right-hand sides. c c norm is a real array of dimension max(m,n) used to store c (temp) the euclidean norms of the rows (if m>=n) or columns c (if m= (n*log(ap(n)) - log 2) / log b. * c * c ier is an error code which is 1 if the dimension parameters * c n,lmax are incorrect, and 0 otherwise. * c * c ****** warning ****** * c * c this routine assumes that for all i * c * c ap(i)*b * c * c does not overflow a computer word. * c * c**************************************************************** c integer lmax integer n c integer a(lmax) integer ap(100) integer b integer c(n) integer i integer ier integer ip integer j integer l integer l2 integer li1 integer ni1 integer p2 integer pp integer q integer qtemp c common /actpr/pp,ip,p2,ap c ier = 1 if (n.lt.1 .or. lmax.lt.1) return l = 1 a(1) = 0 do 40 i = 1,n c c At this stage a(1)+a(2)*b+...+a(l)*b**(l-1) is the c fixed-radix representation of c(n-i+2)+c(n-i+3)* c ap(n-i+2)+...+c(n)*ap(n-i+2)*...*ap(n-1). c ni1 = n - i + 1 pp = ap(ni1) q = c(ni1) c c Compute the first L coefficients of the c fixed-radix representation of c(n-i+1)+ c ap(n-i+1)*(a(1)+a(2)*b+...+a(l)*b**(l-1)). c do 10 j = 1,l qtemp = a(j)*pp + q q = qtemp/b a(j) = qtemp - q*b 10 continue c c repeat ... convert a(1)+a(2)*b+...+a(l)*b**(l-1) c ... +q*b**l to fixed-radix form. c 20 if (q.ne.0) go to 30 go to 40 c then 30 l = l + 1 if (l.gt.lmax) return qtemp = q/b a(l) = q - qtemp*b q = qtemp go to 20 c continue 40 continue if (l.ge.2) go to 50 go to 70 c then ... reorder the coefficients. 50 l2 = l/2 do 60 i = 1,l2 li1 = l - i + 1 qtemp = a(i) a(i) = a(li1) a(li1) = qtemp 60 continue 70 continue ier = 0 return end subroutine setprm(iprime,kprime) c c*********************************************************************** c integer iprime(100) integer kprime(100) c kprime(1)=45233 kprime(2)=45247 kprime(3)=45259 kprime(4)=45263 kprime(5)=45281 kprime(6)=45289 kprime(7)=45293 kprime(8)=45307 kprime(9)=45317 kprime(10)=45319 kprime(11)=45329 kprime(12)=45337 kprime(13)=45341 kprime(14)=45343 kprime(15)=45361 kprime(16)=45377 kprime(17)=45389 kprime(18)=45403 kprime(19)=45413 kprime(20)=45427 kprime(21)=45433 kprime(22)=45439 kprime(23)=45481 kprime(24)=45491 kprime(25)=45497 kprime(26)=45503 kprime(27)=45523 kprime(28)=45533 kprime(29)=45541 kprime(30)=45553 kprime(31)=45557 kprime(32)=45569 kprime(33)=45587 kprime(34)=45589 kprime(35)=45599 kprime(36)=45613 kprime(37)=45631 kprime(38)=45641 kprime(39)=45659 kprime(40)=45667 kprime(41)=45673 kprime(42)=45677 kprime(43)=45691 kprime(44)=45697 kprime(45)=45707 kprime(46)=45737 kprime(47)=45751 kprime(48)=45757 kprime(49)=45763 kprime(50)=45767 kprime(51)=45779 kprime(52)=45817 kprime(53)=45821 kprime(54)=45823 kprime(55)=45827 kprime(56)=45833 kprime(57)=45841 kprime(58)=45853 kprime(59)=45863 kprime(60)=45869 kprime(61)=45887 kprime(62)=45893 kprime(63)=45943 kprime(64)=45949 kprime(65)=45953 kprime(66)=45959 kprime(67)=45971 kprime(68)=45979 kprime(69)=45989 kprime(70)=46021 kprime(71)=46027 kprime(72)=46049 kprime(73)=46051 kprime(74)=46061 kprime(75)=46073 kprime(76)=46091 kprime(77)=46093 kprime(78)=46099 kprime(79)=46103 kprime(80)=46133 kprime(81)=46141 kprime(82)=46147 kprime(83)=46153 kprime(84)=46171 kprime(85)=46181 kprime(86)=46183 kprime(87)=46187 kprime(88)=46199 kprime(89)=46219 kprime(90)=46229 kprime(91)=46237 kprime(92)=46261 kprime(93)=46271 kprime(94)=46273 kprime(95)=46279 kprime(96)=46301 kprime(97)=46307 kprime(98)=46309 kprime(99)=46327 kprime(100)=46337 iprime(1)=0 iprime(2)=42015 iprime(3)=28577 iprime(4)=01108 iprime(5)=29342 iprime(6)=16641 iprime(7)=10405 iprime(8)=19447 iprime(9)=26685 iprime(10)=39525 iprime(11)=14116 iprime(12)=12753 iprime(13)=32178 iprime(14)=01043 iprime(15)=08857 iprime(16)=27911 iprime(17)=15049 iprime(18)=07079 iprime(19)=33425 iprime(20)=00804 iprime(21)=23175 iprime(22)=23886 iprime(23)=44779 iprime(24)=41942 iprime(25)=10171 iprime(26)=16606 iprime(27)=10638 iprime(28)=17371 iprime(29)=27195 iprime(30)=35827 iprime(31)=42639 iprime(32)=01829 iprime(33)=24658 iprime(34)=09023 iprime(35)=37958 iprime(36)=30638 iprime(37)=06339 iprime(38)=41270 iprime(39)=40538 iprime(40)=10157 iprime(41)=11783 iprime(42)=00457 iprime(43)=32947 iprime(44)=42170 iprime(45)=17910 iprime(46)=33474 iprime(47)=20017 iprime(48)=25086 iprime(49)=36508 iprime(50)=37444 iprime(51)=35543 iprime(52)=06993 iprime(53)=10326 iprime(54)=16328 iprime(55)=26765 iprime(56)=42083 iprime(57)=37223 iprime(58)=30711 iprime(59)=09408 iprime(60)=06635 iprime(61)=38421 iprime(62)=11397 iprime(63)=32683 iprime(64)=17333 iprime(65)=34245 iprime(66)=15748 iprime(67)=35735 iprime(68)=23492 iprime(69)=19302 iprime(70)=20076 iprime(71)=45620 iprime(72)=44978 iprime(73)=09864 iprime(74)=14832 iprime(75)=16092 iprime(76)=19457 iprime(77)=24045 iprime(78)=44950 iprime(79)=32872 iprime(80)=24309 iprime(81)=15726 iprime(82)=43057 iprime(83)=37766 iprime(84)=14046 iprime(85)=41826 iprime(86)=19946 iprime(87)=41363 iprime(88)=23967 iprime(89)=39791 iprime(90)=29237 iprime(91)=18085 iprime(92)=12952 iprime(93)=36850 iprime(94)=02213 iprime(95)=30023 iprime(96)=34871 iprime(97)=42667 iprime(98)=40410 iprime(99)=32615 iprime(100)=46136 return end