<s>
In	O
mathematical	O
analysis	O
and	O
computer	B-General_Concept
science	I-General_Concept
,	O
functions	O
which	O
are	O
Z-order	B-Algorithm
,	O
Lebesgue	O
curve	O
,	O
Morton	O
space-filling	B-Algorithm
curve	I-Algorithm
,	O
Morton	B-Algorithm
order	I-Algorithm
or	O
Morton	B-Algorithm
code	I-Algorithm
map	O
multidimensional	B-Algorithm
data	I-Algorithm
to	I-Algorithm
one	I-Algorithm
dimension	I-Algorithm
while	O
preserving	O
locality	O
of	O
the	O
data	O
points	O
.	O
</s>
<s>
Once	O
the	O
data	O
are	O
sorted	O
into	O
this	O
ordering	O
,	O
any	O
one-dimensional	O
data	O
structure	O
can	O
be	O
used	O
,	O
such	O
as	O
simple	O
one	O
dimensional	O
arrays	B-Data_Structure
,	O
binary	B-Language
search	I-Language
trees	I-Language
,	O
B-trees	B-Architecture
,	O
skip	O
lists	O
or	O
(	O
with	O
low	O
significant	O
bits	O
truncated	O
)	O
hash	B-Algorithm
tables	I-Algorithm
.	O
</s>
<s>
The	O
resulting	O
ordering	O
can	O
equivalently	O
be	O
described	O
as	O
the	O
order	O
one	O
would	O
get	O
from	O
a	O
depth-first	B-Algorithm
traversal	I-Algorithm
of	O
a	O
quadtree	B-Data_Structure
or	O
octree	B-Data_Structure
.	O
</s>
<s>
The	O
Z-ordering	O
can	O
be	O
used	O
to	O
efficiently	O
build	O
a	O
quadtree	B-Data_Structure
(	O
2D	O
)	O
or	O
octree	B-Data_Structure
(	O
3D	O
)	O
for	O
a	O
set	O
of	O
points	O
.	O
</s>
<s>
The	O
basic	O
idea	O
is	O
to	O
sort	O
the	O
input	O
set	O
according	O
to	O
Z-order	B-Algorithm
.	O
</s>
<s>
Once	O
sorted	O
,	O
the	O
points	O
can	O
either	O
be	O
stored	O
in	O
a	O
binary	B-Language
search	I-Language
tree	I-Language
and	O
used	O
directly	O
,	O
which	O
is	O
called	O
a	O
linear	O
quadtree	B-Data_Structure
,	O
or	O
they	O
can	O
be	O
used	O
to	O
build	O
a	O
pointer	O
based	O
quadtree	B-Data_Structure
.	O
</s>
<s>
Each	O
square	O
in	O
the	O
quadtree	B-Data_Structure
has	O
a	O
side	O
length	O
which	O
is	O
a	O
power	O
of	O
two	O
,	O
and	O
corner	O
coordinates	O
which	O
are	O
multiples	O
of	O
the	O
side	O
length	O
.	O
</s>
<s>
Once	O
the	O
points	O
are	O
in	O
sorted	O
order	O
,	O
two	O
properties	O
make	O
it	O
easy	O
to	O
build	O
a	O
quadtree	B-Data_Structure
:	O
The	O
first	O
is	O
that	O
the	O
points	O
contained	O
in	O
a	O
square	O
of	O
the	O
quadtree	B-Data_Structure
form	O
a	O
contiguous	O
interval	O
in	O
the	O
sorted	O
order	O
.	O
</s>
<s>
Each	O
such	O
interval	O
corresponds	O
to	O
a	O
square	O
in	O
the	O
quadtree	B-Data_Structure
.	O
</s>
<s>
The	O
result	O
of	O
this	O
is	O
a	O
compressed	O
quadtree	B-Data_Structure
,	O
where	O
only	O
nodes	O
containing	O
input	O
points	O
or	O
two	O
or	O
more	O
children	O
are	O
present	O
.	O
</s>
<s>
A	O
non-compressed	O
quadtree	B-Data_Structure
can	O
be	O
built	O
by	O
restoring	O
the	O
missing	O
nodes	O
,	O
if	O
desired	O
.	O
</s>
<s>
Rather	O
than	O
building	O
a	O
pointer	O
based	O
quadtree	B-Data_Structure
,	O
the	O
points	O
can	O
be	O
maintained	O
in	O
sorted	O
order	O
in	O
a	O
data	O
structure	O
such	O
as	O
a	O
binary	B-Language
search	I-Language
tree	I-Language
.	O
</s>
<s>
Two	O
quadtrees	B-Data_Structure
can	O
be	O
merged	O
by	O
merging	O
the	O
two	O
sorted	O
sets	O
of	O
points	O
,	O
and	O
removing	O
duplicates	O
.	O
</s>
<s>
If	O
the	O
quadtree	B-Data_Structure
is	O
compressed	O
,	O
the	O
predecessor	O
node	O
found	O
may	O
be	O
an	O
arbitrary	O
leaf	O
inside	O
the	O
compressed	O
node	O
of	O
interest	O
.	O
</s>
<s>
Although	O
Z-order	B-Algorithm
is	O
preserving	O
locality	O
well	O
,	O
for	O
efficient	O
range	O
searches	O
an	O
algorithm	O
is	O
necessary	O
for	O
calculating	O
,	O
from	O
a	O
point	O
encountered	O
in	O
the	O
data	O
structure	O
,	O
the	O
next	O
possible	O
Z-value	O
which	O
is	O
in	O
the	O
multidimensional	O
search	O
range	O
:	O
</s>
<s>
The	O
method	O
is	O
also	O
used	O
in	O
UB-trees	B-Data_Structure
(	O
balanced	O
)	O
,	O
with	O
the	O
name	O
"	O
GetNextZ-address	O
"	O
for	O
BIGMIN	O
.	O
</s>
<s>
This	O
is	O
in	O
contrast	O
for	O
example	O
to	O
R-trees	B-Library
where	O
special	O
considerations	O
are	O
necessary	O
.	O
</s>
<s>
Z-order	B-Algorithm
is	O
one	O
of	O
the	O
few	O
multidimensional	O
access	O
methods	O
that	O
has	O
found	O
its	O
way	O
into	O
commercial	O
database	O
systems	O
.	O
</s>
<s>
As	O
long	O
ago	O
as	O
1966	O
,	O
G.M.Morton	O
proposed	O
Z-order	B-Algorithm
for	O
file	O
sequencing	O
of	O
a	O
static	O
two	O
dimensional	O
geographical	O
database	O
.	O
</s>
<s>
Areal	O
data	O
units	O
are	O
contained	O
in	O
one	O
or	O
a	O
few	O
quadratic	O
frames	O
represented	O
by	O
their	O
sizes	O
and	O
lower	O
right	O
corner	O
Z-values	O
,	O
the	O
sizes	O
complying	O
with	O
the	O
Z-order	B-Algorithm
hierarchy	O
at	O
the	O
corner	O
position	O
.	O
</s>
<s>
As	O
an	O
alternative	O
,	O
the	O
Hilbert	B-Algorithm
curve	I-Algorithm
has	O
been	O
suggested	O
as	O
it	O
has	O
a	O
better	O
order-preserving	O
behaviour	O
,	O
and	O
,	O
in	O
fact	O
,	O
was	O
used	O
in	O
an	O
optimized	O
index	O
,	O
the	O
S2-geometry	O
.	O
</s>
<s>
The	O
Strassen	B-Algorithm
algorithm	I-Algorithm
for	O
matrix	O
multiplication	O
is	O
based	O
on	O
splitting	O
the	O
matrices	O
in	O
four	O
blocks	O
,	O
and	O
then	O
recursively	O
splitting	O
each	O
of	O
these	O
blocks	O
in	O
four	O
smaller	O
blocks	O
,	O
until	O
the	O
blocks	O
are	O
single	O
elements	O
(	O
or	O
more	O
practically	O
:	O
until	O
reaching	O
matrices	O
so	O
small	O
that	O
the	O
Moser	O
–	O
de	O
Bruijn	O
sequence	O
trivial	O
algorithm	O
is	O
faster	O
)	O
.	O
</s>
<s>
Arranging	O
the	O
matrix	O
elements	O
in	O
Z-order	B-Algorithm
then	O
improves	O
locality	O
,	O
and	O
has	O
the	O
additional	O
advantage	O
(	O
compared	O
to	O
row	O
-	O
or	O
column-major	O
ordering	O
)	O
that	O
the	O
subroutine	O
for	O
multiplying	O
two	O
blocks	O
does	O
not	O
need	O
to	O
know	O
the	O
total	O
size	O
of	O
the	O
matrix	O
,	O
but	O
only	O
the	O
size	O
of	O
the	O
blocks	O
and	O
their	O
location	O
in	O
memory	O
.	O
</s>
<s>
with	O
Z-order	B-Algorithm
has	O
been	O
demonstrated	O
,	O
see	O
Valsalam	O
and	O
Skjellum	O
's	O
2002	O
paper	O
.	O
</s>
<s>
present	O
a	O
sparse	B-Algorithm
matrix	I-Algorithm
data	O
structure	O
that	O
Z-orders	B-Algorithm
its	O
non-zero	O
elements	O
to	O
enable	O
parallel	B-Operating_System
matrix-vector	O
multiplication	O
.	O
</s>
<s>
Matrices	O
in	O
linear	B-Language
algebra	I-Language
can	O
also	O
be	O
traversed	O
using	O
a	O
space-filling	B-Algorithm
curve	I-Algorithm
.	O
</s>
<s>
Traversing	O
with	O
the	O
Z-curve	O
allows	O
efficient	O
access	O
to	O
the	O
memory	B-General_Concept
hierarchy	I-General_Concept
.	O
</s>
<s>
Some	O
GPUs	B-Architecture
store	O
texture	O
maps	O
in	O
Z-order	B-Algorithm
to	O
increase	O
spatial	O
locality	B-General_Concept
of	I-General_Concept
reference	I-General_Concept
during	O
texture	O
mapped	O
rasterization	O
.	O
</s>
<s>
This	O
allows	O
cache	B-General_Concept
lines	I-General_Concept
to	O
represent	O
rectangular	O
tiles	O
,	O
increasing	O
the	O
probability	O
that	O
nearby	O
accesses	O
are	O
in	O
the	O
cache	O
.	O
</s>
<s>
The	O
Barnes	O
–	O
Hut	O
algorithm	O
requires	O
construction	O
of	O
an	O
octree	B-Data_Structure
.	O
</s>
<s>
Storing	O
the	O
data	O
as	O
a	O
pointer-based	O
tree	O
requires	O
many	O
sequential	O
pointer	O
dereferences	O
to	O
iterate	O
over	O
the	O
octree	B-Data_Structure
in	O
depth-first	B-Algorithm
order	O
(	O
expensive	O
on	O
a	O
distributed-memory	O
machine	O
)	O
.	O
</s>
<s>
Instead	O
,	O
if	O
one	O
stores	O
the	O
data	O
in	O
a	O
hashtable	B-Algorithm
,	O
using	O
octree	B-Data_Structure
hashing	O
,	O
the	O
Z-order	B-Algorithm
curve	I-Algorithm
naturally	O
iterates	O
the	O
octree	B-Data_Structure
in	O
depth-first	B-Algorithm
order	O
.	O
</s>
