15 integer,
parameter ::
dim = 3
21 integer,
intent(in) :: x
22 integer,
intent(in) :: d
23 integer :: rotate_right
26 rotate_right = shiftr(x, d)
27 tmp = shiftl(x,
dim-d)
28 rotate_right = iand(ior(rotate_right, tmp),
mask)
33 integer,
intent(in) :: x
34 integer,
intent(in) :: d
35 integer :: rotate_left
38 rotate_left = shiftl(x, d)
39 tmp = shiftr(x,
dim-d)
40 rotate_left = iand(ior(rotate_left, tmp),
mask)
45 integer,
intent(in) :: x
47 character(len=dim) :: bin_str
48 integer :: i, j, total_size
50 total_size = bit_size(x)
54 if (ibits(x, i-1, 1).eq.1)
then 64 integer,
intent(in) :: i
67 gc = ieor(i, shiftr(i, 1))
72 integer,
intent(in) :: i
73 integer :: entry_point
78 entry_point =
gc(2*((i-1)/2))
84 integer,
intent(in) :: i
92 integer,
intent(in) :: g
98 do while ( j .lt.
dim )
99 inverse_gc = ieor(inverse_gc, shiftr(g, j))
106 integer,
intent(in) :: i
109 g = trailz(ieor(
gc(i),
gc(i+1)))
114 integer,
intent(in) :: i
119 else if ( modulo(i, 2) .eq. 0 )
then 126 pure function transform(e, d, b)
result(t)
127 integer,
intent(in) :: e, d, b
134 integer,
intent(in) :: e, d, b
141 pure function p_to_h(p, m)
result(h)
142 integer,
intent(in) :: p(
dim), m
145 integer :: e, d, i, j, l, w
153 l = l + 2**(j-1)*ibits(p(j), i, 1)
159 h = ior(shiftl(h,
dim), w)
163 pure function h_to_p(h, m)
result(p)
164 integer,
intent(in) :: h, m
167 integer :: e, d, i, j, l, w
175 w = w + 2**j*ibits(h, i*
dim+j, 1)
180 p(j) = p(j) + shiftl(ibits(l, j-1, 1) , i)
188 pure function gcr(i, mu)
result(r)
189 integer,
intent(in) :: i, mu
195 if (ibits(mu, k, 1) .eq. 1)
then 196 r = ior( shiftl(r, 1), ibits(i, k, 1))
203 integer,
intent(in) :: r, mu, pi
211 j = j + ibits(mu, k, 1)
214 if (ibits(mu, k, 1) .eq. 1)
then 215 i = ior(i, shiftl( ibits(r, j, 1), k))
216 g = ior(g, shiftl( modulo( ibits(i, k, 1)+ibits(i, k+1, 1), 2), k) )
219 g = ior(g, shiftl( ibits(pi, k, 1), k))
220 i = ior(i, shiftl( modulo( ibits(g, k, 1)+ibits(i, k+1, 1), 2), k) )
226 integer,
intent(in) :: i, m(
dim)
234 if ( m(j) .gt. i )
then 245 integer :: e, d, max_m, i, j, l, mu, mu_norm, pi, r, w
255 mu_norm = mu_norm + ibits(mu, j, 1)
261 l = l + 2**(j-1)*ibits(p(j), i, 1)
268 h = ior( shiftl(h, mu_norm), r)
274 integer,
intent(in) :: h, m(
dim)
277 integer :: e, d, i, j, k, max_m, sum_m, mu_norm, mu, pi, r, l, w
289 mu_norm = mu_norm + ibits(mu, j, 1)
295 r = r + 2**j*ibits(h, sum_m - k - mu_norm + j, 1)
302 p(j) = p(j) + shiftl(ibits(l, j-1, 1), i)
pure integer function, dimension(dim), public compact_h_to_p(h, m)
pure integer function, public compact_p_to_h(p, m)
pure integer function, dimension(dim), public h_to_p(h, m)
pure integer function extract_mask(i, m)
pure integer function rotate_left(x, d)
pure integer function inverse_gcr(r, mu, pi)
pure integer function, public p_to_h(p, m)
pure integer function entry_point(i)
pure integer function intercube_g(i)
pure integer function rotate_right(x, d)
pure character(len=dim) function bin_str(x)
pure integer function inverse_transform(e, d, b)
pure integer function inverse_gc(g)
Compute compact Hilbert indices.
pure integer function exit_point(i)
pure integer function intracube_d(i)
pure integer function gc(i)
pure integer function transform(e, d, b)
pure integer function gcr(i, mu)