1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
program testmapping
implicit none
include 'AST_PAR'
include 'SAE_PAR'
integer status, pm
double precision coeff(20), fit(6), lbnd(2), ubnd(2)
data coeff / 1.0, 1.0, 0.0, 0.0,
: 2.0, 1.0, 1.0, 0.0,
: 1.0, 2.0, 0.0, 0.0,
: 3.0, 2.0, 0.0, 1.0,
: 3.0, 1.0, 0.0, 2.0 /
status = sai__ok
call err_mark( status )
call ast_begin( status )
pm = ast_polymap( 2, 2, 4, coeff, 0, coeff, ' ', status )
lbnd( 1 ) = -1.0D0
lbnd( 2 ) = -1.0D0
ubnd( 1 ) = 1.0D0
ubnd( 2 ) = 1.0D0
if( ast_linearapprox(pm, lbnd, ubnd, 0.001D0, fit, status) ) then
if( fit(1) .ne. 1.0D0 .or. fit(2) .ne. 1.0D0 .or.
: fit(3) .ne. 2.0D0 .or. fit(4) .ne. 0.0D0 .or.
: fit(5) .ne. 0.0D0 .or. fit(6) .ne. 3.0D0 ) then
call stopit( status, 'Error 0' )
end if
else
call stopit( status, 'Error 1' )
end if
coeff( 13 ) = AST__BAD
pm = ast_polymap( 2, 2, 4, coeff, 0, coeff, ' ', status )
if( ast_linearapprox(pm, lbnd, ubnd, 0.001D0, fit, status) ) then
if( fit(1) .ne. 1.0D0 .or. fit(2) .ne. AST__BAD .or.
: fit(3) .ne. 2.0D0 .or. fit(4) .ne. 0.0D0 .or.
: fit(5) .ne. AST__BAD .or. fit(6) .ne. AST__BAD ) then
call stopit( status, 'Error 2' )
end if
else
call stopit( status, 'Error 3' )
end if
pm = ast_polymap( 2, 2, 5, coeff, 0, coeff, ' ', status )
if( ast_linearapprox(pm, lbnd, ubnd, 0.001D0, fit, status) ) then
write(*,*) fit
call stopit( status, 'Error 4' )
end if
call ast_end( status )
call err_rlse( status )
if( status .eq. sai__ok ) then
write(*,*) 'All Mapping tests passed'
else
write(*,*) 'Mapping tests failed'
end if
end
subroutine stopit( status, text )
implicit none
include 'SAE_PAR'
integer status
character text*(*)
if( status .ne. sai__ok ) return
status = sai__error
write(*,*) text
end
|