Skip to content

Commit 5c58f00

Browse files
Merge pull request #11 from jchristopherson/v2.0.0_Update
Remove random initial conditions
2 parents 05d51ee + ec1860a commit 5c58f00

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

tests/nonlin_test_solve.f90

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ function test_quasinewton_1() result(check)
187187
procedure(jacobianfcn), pointer :: jac
188188
type(quasi_newton_solver) :: solver
189189
type(iteration_behavior) :: ib
190-
real(real64) :: x(2), f(2), ic(10, 2)
190+
real(real64) :: x(2), f(2), ic(2, 2)
191191
integer(int32) :: i
192192
logical :: check
193193

@@ -199,7 +199,8 @@ function test_quasinewton_1() result(check)
199199
call obj%set_jacobian(jac)
200200

201201
! Generate a set of initial conditions
202-
call random_number(ic)
202+
ic(1,:) = 0.5d0
203+
ic(2,:) = 1.0d0
203204

204205
! Process - Cycle over each different initial condition set
205206
do i = 1, size(ic, 1)
@@ -235,7 +236,7 @@ function test_quasinewton_2() result(check)
235236
procedure(vecfcn), pointer :: fcn
236237
type(quasi_newton_solver) :: solver
237238
type(iteration_behavior) :: ib
238-
real(real64) :: x(2), f(2), ic(10, 2)
239+
real(real64) :: x(2), f(2), ic(2, 2)
239240
integer(int32) :: i
240241
logical :: check
241242

@@ -245,7 +246,8 @@ function test_quasinewton_2() result(check)
245246
call obj%set_fcn(fcn, 2, 2)
246247

247248
! Generate a set of initial conditions
248-
call random_number(ic)
249+
ic(1,:) = 0.5d0
250+
ic(2,:) = 1.0d0
249251

250252
! Turn off the line search - this set of functions is too poorly scaled
251253
! for the current implementation of the line search algorithm to offer
@@ -288,7 +290,7 @@ function test_quasinewton_3() result(check)
288290
procedure(jacobianfcn), pointer :: jac
289291
type(quasi_newton_solver) :: solver
290292
type(iteration_behavior) :: ib
291-
real(real64) :: x(2), f(2), ic(10, 2), a
293+
real(real64) :: x(2), f(2), ic(2, 2), a
292294
integer(int32) :: i
293295
logical :: check
294296

@@ -300,7 +302,8 @@ function test_quasinewton_3() result(check)
300302
call obj%set_fcn(fcn, 2, 2)
301303

302304
! Generate a set of initial conditions
303-
call random_number(ic)
305+
ic(1,:) = 0.5d0
306+
ic(2,:) = 1.0d0
304307

305308
! Process - Cycle over each different initial condition set
306309
do i = 1, size(ic, 1)
@@ -359,7 +362,7 @@ function test_newton_1() result(check)
359362
procedure(jacobianfcn), pointer :: jac
360363
type(newton_solver) :: solver
361364
type(iteration_behavior) :: ib
362-
real(real64) :: x(2), f(2), ic(10, 2)
365+
real(real64) :: x(2), f(2), ic(2, 2)
363366
integer(int32) :: i
364367
logical :: check
365368

@@ -371,7 +374,8 @@ function test_newton_1() result(check)
371374
call obj%set_jacobian(jac)
372375

373376
! Generate a set of initial conditions
374-
call random_number(ic)
377+
ic(1,:) = 0.5d0
378+
ic(2,:) = 1.0d0
375379

376380
! Process - Cycle over each different initial condition set
377381
do i = 1, size(ic, 1)
@@ -407,7 +411,7 @@ function test_newton_2() result(check)
407411
procedure(vecfcn), pointer :: fcn
408412
type(newton_solver) :: solver
409413
type(iteration_behavior) :: ib
410-
real(real64) :: x(2), f(2), ic(10, 2)
414+
real(real64) :: x(2), f(2), ic(2, 2)
411415
integer(int32) :: i
412416
logical :: check
413417

@@ -417,7 +421,8 @@ function test_newton_2() result(check)
417421
call obj%set_fcn(fcn, 2, 2)
418422

419423
! Generate a set of initial conditions
420-
call random_number(ic)
424+
ic(1,:) = 0.5d0
425+
ic(2,:) = 1.0d0
421426

422427
! Turn off the line search - this set of functions is too poorly scaled
423428
! for the current implementation of the line search algorithm to offer
@@ -460,7 +465,7 @@ function test_newton_3() result(check)
460465
procedure(jacobianfcn), pointer :: jac
461466
type(newton_solver) :: solver
462467
type(iteration_behavior) :: ib
463-
real(real64) :: x(2), f(2), ic(10, 2), a
468+
real(real64) :: x(2), f(2), ic(2, 2), a
464469
integer(int32) :: i
465470
logical :: check
466471

@@ -472,7 +477,8 @@ function test_newton_3() result(check)
472477
call obj%set_fcn(fcn, 2, 2)
473478

474479
! Generate a set of initial conditions
475-
call random_number(ic)
480+
ic(1,:) = 0.5d0
481+
ic(2,:) = 1.0d0
476482

477483
! Process - Cycle over each different initial condition set
478484
do i = 1, size(ic, 1)
@@ -531,7 +537,7 @@ function test_least_squares_1() result(check)
531537
procedure(jacobianfcn), pointer :: jac
532538
type(least_squares_solver) :: solver
533539
type(iteration_behavior) :: ib
534-
real(real64) :: x(2), f(2), ic(10, 2)
540+
real(real64) :: x(2), f(2), ic(2, 2)
535541
integer(int32) :: i
536542
logical :: check
537543

@@ -543,7 +549,8 @@ function test_least_squares_1() result(check)
543549
call obj%set_jacobian(jac)
544550

545551
! Generate a set of initial conditions
546-
call random_number(ic)
552+
ic(1,:) = 0.5d0
553+
ic(2,:) = 1.0d0
547554

548555
! Process - Cycle over each different initial condition set
549556
do i = 1, size(ic, 1)
@@ -579,7 +586,7 @@ function test_least_squares_2() result(check)
579586
procedure(vecfcn), pointer :: fcn
580587
type(least_squares_solver) :: solver
581588
type(iteration_behavior) :: ib
582-
real(real64) :: x(2), f(2), ic(10, 2)
589+
real(real64) :: x(2), f(2), ic(2, 2)
583590
integer(int32) :: i
584591
logical :: check
585592
type(errors) :: errmgr
@@ -598,8 +605,8 @@ function test_least_squares_2() result(check)
598605
call solver%set_max_fcn_evals(1000)
599606

600607
! Generate a set of initial conditions
601-
ic(:,1) = 1.0d0
602-
ic(:,2) = 5.0d0
608+
ic(1,:) = 0.5d0
609+
ic(2,:) = 1.0d0
603610

604611
! Process - Cycle over each different initial condition set
605612
do i = 1, size(ic, 1)
@@ -656,7 +663,7 @@ function test_least_squares_4() result(check)
656663
procedure(jacobianfcn), pointer :: jac
657664
type(least_squares_solver) :: solver
658665
type(iteration_behavior) :: ib
659-
real(real64) :: x(2), f(2), ic(10, 2), a
666+
real(real64) :: x(2), f(2), ic(2, 2), a
660667
integer(int32) :: i
661668
logical :: check
662669

@@ -668,7 +675,8 @@ function test_least_squares_4() result(check)
668675
call obj%set_fcn(fcn, 2, 2)
669676

670677
! Generate a set of initial conditions
671-
call random_number(ic)
678+
ic(1,:) = 0.5d0
679+
ic(2,:) = 1.0d0
672680

673681
! Process - Cycle over each different initial condition set
674682
do i = 1, size(ic, 1)

0 commit comments

Comments
 (0)