Skip to content

Commit 7fcfe44

Browse files
committed
same for lmstr
note: hybrd,hybrj didn't have any failed cases in original minpack, but added the same code just for completeness.
1 parent 299f973 commit 7fcfe44

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

test/test_hybrd.f90

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ program test_hybrd
2323
integer,dimension(ncases),parameter :: ns = [2,4,2,4,3,6,9,5,6,7,8,9,10,30,40,10,1,10,10,10,10,10]
2424
integer,dimension(ncases),parameter :: ntriess = [3,3,2,3,3,2,2,3,3,3,1,1,3,1,1,3,3,3,3,3,3,3]
2525

26+
integer,dimension(55),parameter :: info_original = [1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,&
27+
1,1,1,4,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,1,1,&
28+
1,1,1,1,1,1,1,1,1]
29+
2630
integer :: i, ic, info, k, lwa, n, NFEv, NPRob, ntries, icase
2731
integer :: na(55), nf(55), np(55), nx(55)
2832
real(wp) :: fnm(55)
@@ -82,8 +86,9 @@ program test_hybrd
8286
factor = ten*factor
8387

8488
! compare with previously generated solutions:
85-
if (any(abs( solution(ic) - x)>tol .and. &
86-
abs((solution(ic) - x)/(solution(ic))) > solution_reltol)) then
89+
if (info_original(ic)<5 .and. & ! ignore any where the original minpack failed
90+
any(abs( solution(ic) - x)>tol .and. &
91+
abs((solution(ic) - x)/(solution(ic))) > solution_reltol)) then
8792
write(nwrite,'(A)') 'Failed case'
8893
write(nwrite, '(//5x, a//(5x, 5d15.7))') 'Expected x: ', solution(ic)
8994
write(nwrite, '(/5x, a//(5x, 5d15.7))') 'Computed x: ', x

test/test_hybrj.f90

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ program test_hybrj
2323
integer,dimension(ncases),parameter :: ns = [2,4,2,4,3,6,9,5,6,7,8,9,10,30,40,10,1,10,10,10,10,10]
2424
integer,dimension(ncases),parameter :: ntriess = [3,3,2,3,3,2,2,3,3,3,1,1,3,1,1,3,3,3,3,3,3,3]
2525

26+
integer,dimension(55),parameter :: info_original = [1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,1,1,1,1,1,&
27+
1,1,1,4,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,4,1,1,&
28+
1,1,1,1,1,1,1,1,1]
29+
2630
integer :: i, ic, info, k, n, NFEv, NJEv, NPRob, ntries, icase, lwa, ldfjac
2731
integer :: na(55), nf(55), nj(55), np(55), nx(55)
2832
real(wp) :: fnm(55)
@@ -87,8 +91,9 @@ program test_hybrj
8791
factor = ten*factor
8892

8993
! compare with previously generated solutions:
90-
if (any(abs( solution(ic) - x)>tol .and. &
91-
abs((solution(ic) - x)/(solution(ic))) > solution_reltol)) then
94+
if (info_original(ic)<5 .and. & ! ignore any where the original minpack failed
95+
any(abs( solution(ic) - x)>tol .and. &
96+
abs((solution(ic) - x)/(solution(ic))) > solution_reltol)) then
9297
write(nwrite,'(A)') 'Failed case'
9398
write(nwrite, '(//5x, a//(5x, 5d15.7))') 'Expected x: ', solution(ic)
9499
write(nwrite, '(/5x, a//(5x, 5d15.7))') 'Computed x: ', x

test/test_lmstr.f90

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ program test_lmstr
2424
integer,dimension(ncases),parameter :: ms = [10,50,10,50,10,50,2,3,4,2,15,11,16,31,31,31,10,10,20,8,8,9,10,10,30,40,33,65]
2525
integer,dimension(ncases),parameter :: ntriess = [1,1,1,1,1,1,3,3,3,3,3,3,2,3,3,3,1,1,3,3,1,1,1,3,1,1,1,1]
2626

27+
integer,dimension(53),parameter :: info_original = [2,3,1,1,1,1,4,2,2,2,2,2,4,4,4,1,1,1,1,1,1,1,1,5,3,5,&
28+
1,1,1,3,3,2,3,2,3,2,1,1,1,1,4,1,1,1,2,1,2,2,2,2,2,1,1]
29+
!! original `info` from the original minpack
30+
2731
integer,dimension(:),allocatable :: iwa
2832
real(wp),dimension(:),allocatable :: wa
2933
real(wp),dimension(:,:),allocatable :: fjac
@@ -93,8 +97,9 @@ program test_lmstr
9397
factor = ten*factor
9498

9599
! compare with previously generated solutions:
96-
if (any(abs( solution(ic) - x)>tol .and. &
97-
abs((solution(ic) - x)/(solution(ic))) > solution_reltol)) then
100+
if (info_original(ic)<5 .and. & ! ignore any where the original minpack failed
101+
any(abs( solution(ic) - x)>tol .and. &
102+
abs((solution(ic) - x)/(solution(ic))) > solution_reltol)) then
98103
write(nwrite,'(A)') 'Failed case'
99104
write(nwrite, '(//5x, a//(5x, 5d15.7))') 'Expected x: ', solution(ic)
100105
write(nwrite, '(/5x, a//(5x, 5d15.7))') 'Computed x: ', x

0 commit comments

Comments
 (0)