Mercurial > octave-libgccjit
comparison scripts/geometry/griddatan.m @ 8153:ec0a13863eb7
Only run tests that depend on HDF5 and QHull if Octave was actually
linked against these libraries.
author | Soren Hauberg <hauberg@gmail.com> |
---|---|
date | Fri, 26 Sep 2008 13:23:02 -0400 |
parents | a1dbe9d80eee |
children | eb63fbe60fab |
comparison
equal
deleted
inserted
replaced
8152:2b48deec1aa2 | 8153:ec0a13863eb7 |
---|---|
83 error ("griddatan: unknown interpolation method"); | 83 error ("griddatan: unknown interpolation method"); |
84 endif | 84 endif |
85 | 85 |
86 endfunction | 86 endfunction |
87 | 87 |
88 %!test | 88 %!testif HAVE_QHULL |
89 %! [xx,yy] = meshgrid(linspace(-1,1,32)); | 89 %! [xx,yy] = meshgrid(linspace(-1,1,32)); |
90 %! xi = [xx(:), yy(:)]; | 90 %! xi = [xx(:), yy(:)]; |
91 %! x = (2 * rand(100,2) - 1); | 91 %! x = (2 * rand(100,2) - 1); |
92 %! x = [x;1,1;1,-1;-1,-1;-1,1]; | 92 %! x = [x;1,1;1,-1;-1,-1;-1,1]; |
93 %! y = sin(2*(sum(x.^2,2))); | 93 %! y = sin(2*(sum(x.^2,2))); |
94 %! zz = griddatan(x,y,xi,'linear'); | 94 %! zz = griddatan(x,y,xi,'linear'); |
95 %! zz2 = griddata(x(:,1),x(:,2),y,xi(:,1),xi(:,2),'linear'); | 95 %! zz2 = griddata(x(:,1),x(:,2),y,xi(:,1),xi(:,2),'linear'); |
96 %! assert (zz, zz2, 1e-10) | 96 %! assert (zz, zz2, 1e-10) |
97 | 97 |
98 %!test | 98 %!testif HAVE_QHULL |
99 %! [xx,yy] = meshgrid(linspace(-1,1,32)); | 99 %! [xx,yy] = meshgrid(linspace(-1,1,32)); |
100 %! xi = [xx(:), yy(:)]; | 100 %! xi = [xx(:), yy(:)]; |
101 %! x = (2 * rand(100,2) - 1); | 101 %! x = (2 * rand(100,2) - 1); |
102 %! x = [x;1,1;1,-1;-1,-1;-1,1]; | 102 %! x = [x;1,1;1,-1;-1,-1;-1,1]; |
103 %! y = sin(2*(sum(x.^2,2))); | 103 %! y = sin(2*(sum(x.^2,2))); |