~ubuntu-branches/debian/sid/postgresql-9.3/sid

« back to all changes in this revision

Viewing changes to doc/src/sgml/html/cube.html

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-05-08 05:39:52 UTC
  • Revision ID: package-import@ubuntu.com-20130508053952-1j7uilp7mjtrvq8q
Tags: upstream-9.3~beta1
ImportĀ upstreamĀ versionĀ 9.3~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>cube</TITLE
 
6
><META
 
7
NAME="GENERATOR"
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
 
9
REV="MADE"
 
10
HREF="mailto:pgsql-docs@postgresql.org"><LINK
 
11
REL="HOME"
 
12
TITLE="PostgreSQL 9.3beta1 Documentation"
 
13
HREF="index.html"><LINK
 
14
REL="UP"
 
15
TITLE="Additional Supplied Modules"
 
16
HREF="contrib.html"><LINK
 
17
REL="PREVIOUS"
 
18
TITLE="citext"
 
19
HREF="citext.html"><LINK
 
20
REL="NEXT"
 
21
TITLE="dblink"
 
22
HREF="dblink.html"><LINK
 
23
REL="STYLESHEET"
 
24
TYPE="text/css"
 
25
HREF="stylesheet.css"><META
 
26
HTTP-EQUIV="Content-Type"
 
27
CONTENT="text/html; charset=ISO-8859-1"><META
 
28
NAME="creation"
 
29
CONTENT="2013-05-06T21:00:50"></HEAD
 
30
><BODY
 
31
CLASS="SECT1"
 
32
><DIV
 
33
CLASS="NAVHEADER"
 
34
><TABLE
 
35
SUMMARY="Header navigation table"
 
36
WIDTH="100%"
 
37
BORDER="0"
 
38
CELLPADDING="0"
 
39
CELLSPACING="0"
 
40
><TR
 
41
><TH
 
42
COLSPAN="5"
 
43
ALIGN="center"
 
44
VALIGN="bottom"
 
45
><A
 
46
HREF="index.html"
 
47
>PostgreSQL 9.3beta1 Documentation</A
 
48
></TH
 
49
></TR
 
50
><TR
 
51
><TD
 
52
WIDTH="10%"
 
53
ALIGN="left"
 
54
VALIGN="top"
 
55
><A
 
56
TITLE="citext"
 
57
HREF="citext.html"
 
58
ACCESSKEY="P"
 
59
>Prev</A
 
60
></TD
 
61
><TD
 
62
WIDTH="10%"
 
63
ALIGN="left"
 
64
VALIGN="top"
 
65
><A
 
66
HREF="contrib.html"
 
67
ACCESSKEY="U"
 
68
>Up</A
 
69
></TD
 
70
><TD
 
71
WIDTH="60%"
 
72
ALIGN="center"
 
73
VALIGN="bottom"
 
74
>Appendix F. Additional Supplied Modules</TD
 
75
><TD
 
76
WIDTH="20%"
 
77
ALIGN="right"
 
78
VALIGN="top"
 
79
><A
 
80
TITLE="dblink"
 
81
HREF="dblink.html"
 
82
ACCESSKEY="N"
 
83
>Next</A
 
84
></TD
 
85
></TR
 
86
></TABLE
 
87
><HR
 
88
ALIGN="LEFT"
 
89
WIDTH="100%"></DIV
 
90
><DIV
 
91
CLASS="SECT1"
 
92
><H1
 
93
CLASS="SECT1"
 
94
><A
 
95
NAME="CUBE"
 
96
>F.8. cube</A
 
97
></H1
 
98
><P
 
99
>  This module implements a data type <TT
 
100
CLASS="TYPE"
 
101
>cube</TT
 
102
> for
 
103
  representing multidimensional cubes.
 
104
 </P
 
105
><DIV
 
106
CLASS="SECT2"
 
107
><H2
 
108
CLASS="SECT2"
 
109
><A
 
110
NAME="AEN143980"
 
111
>F.8.1. Syntax</A
 
112
></H2
 
113
><P
 
114
>   <A
 
115
HREF="cube.html#CUBE-REPR-TABLE"
 
116
>Table F-1</A
 
117
> shows the valid external
 
118
   representations for the <TT
 
119
CLASS="TYPE"
 
120
>cube</TT
 
121
>
 
122
   type.  <TT
 
123
CLASS="REPLACEABLE"
 
124
><I
 
125
>x</I
 
126
></TT
 
127
>, <TT
 
128
CLASS="REPLACEABLE"
 
129
><I
 
130
>y</I
 
131
></TT
 
132
>, etc. denote
 
133
   floating-point numbers.
 
134
  </P
 
135
><DIV
 
136
CLASS="TABLE"
 
137
><A
 
138
NAME="CUBE-REPR-TABLE"
 
139
></A
 
140
><P
 
141
><B
 
142
>Table F-1. Cube External Representations</B
 
143
></P
 
144
><TABLE
 
145
BORDER="1"
 
146
CLASS="CALSTABLE"
 
147
><COL><COL><TBODY
 
148
><TR
 
149
><TD
 
150
><TT
 
151
CLASS="LITERAL"
 
152
><TT
 
153
CLASS="REPLACEABLE"
 
154
><I
 
155
>x</I
 
156
></TT
 
157
></TT
 
158
></TD
 
159
><TD
 
160
>A one-dimensional point
 
161
       (or, zero-length one-dimensional interval)
 
162
      </TD
 
163
></TR
 
164
><TR
 
165
><TD
 
166
><TT
 
167
CLASS="LITERAL"
 
168
>(<TT
 
169
CLASS="REPLACEABLE"
 
170
><I
 
171
>x</I
 
172
></TT
 
173
>)</TT
 
174
></TD
 
175
><TD
 
176
>Same as above</TD
 
177
></TR
 
178
><TR
 
179
><TD
 
180
><TT
 
181
CLASS="LITERAL"
 
182
><TT
 
183
CLASS="REPLACEABLE"
 
184
><I
 
185
>x1</I
 
186
></TT
 
187
>,<TT
 
188
CLASS="REPLACEABLE"
 
189
><I
 
190
>x2</I
 
191
></TT
 
192
>,...,<TT
 
193
CLASS="REPLACEABLE"
 
194
><I
 
195
>xn</I
 
196
></TT
 
197
></TT
 
198
></TD
 
199
><TD
 
200
>A point in n-dimensional space, represented internally as a
 
201
      zero-volume cube
 
202
      </TD
 
203
></TR
 
204
><TR
 
205
><TD
 
206
><TT
 
207
CLASS="LITERAL"
 
208
>(<TT
 
209
CLASS="REPLACEABLE"
 
210
><I
 
211
>x1</I
 
212
></TT
 
213
>,<TT
 
214
CLASS="REPLACEABLE"
 
215
><I
 
216
>x2</I
 
217
></TT
 
218
>,...,<TT
 
219
CLASS="REPLACEABLE"
 
220
><I
 
221
>xn</I
 
222
></TT
 
223
>)</TT
 
224
></TD
 
225
><TD
 
226
>Same as above</TD
 
227
></TR
 
228
><TR
 
229
><TD
 
230
><TT
 
231
CLASS="LITERAL"
 
232
>(<TT
 
233
CLASS="REPLACEABLE"
 
234
><I
 
235
>x</I
 
236
></TT
 
237
>),(<TT
 
238
CLASS="REPLACEABLE"
 
239
><I
 
240
>y</I
 
241
></TT
 
242
>)</TT
 
243
></TD
 
244
><TD
 
245
>A one-dimensional interval starting at <TT
 
246
CLASS="REPLACEABLE"
 
247
><I
 
248
>x</I
 
249
></TT
 
250
> and ending at <TT
 
251
CLASS="REPLACEABLE"
 
252
><I
 
253
>y</I
 
254
></TT
 
255
> or vice versa; the
 
256
       order does not matter
 
257
      </TD
 
258
></TR
 
259
><TR
 
260
><TD
 
261
><TT
 
262
CLASS="LITERAL"
 
263
>[(<TT
 
264
CLASS="REPLACEABLE"
 
265
><I
 
266
>x</I
 
267
></TT
 
268
>),(<TT
 
269
CLASS="REPLACEABLE"
 
270
><I
 
271
>y</I
 
272
></TT
 
273
>)]</TT
 
274
></TD
 
275
><TD
 
276
>Same as above</TD
 
277
></TR
 
278
><TR
 
279
><TD
 
280
><TT
 
281
CLASS="LITERAL"
 
282
>(<TT
 
283
CLASS="REPLACEABLE"
 
284
><I
 
285
>x1</I
 
286
></TT
 
287
>,...,<TT
 
288
CLASS="REPLACEABLE"
 
289
><I
 
290
>xn</I
 
291
></TT
 
292
>),(<TT
 
293
CLASS="REPLACEABLE"
 
294
><I
 
295
>y1</I
 
296
></TT
 
297
>,...,<TT
 
298
CLASS="REPLACEABLE"
 
299
><I
 
300
>yn</I
 
301
></TT
 
302
>)</TT
 
303
></TD
 
304
><TD
 
305
>An n-dimensional cube represented by a pair of its diagonally
 
306
       opposite corners
 
307
      </TD
 
308
></TR
 
309
><TR
 
310
><TD
 
311
><TT
 
312
CLASS="LITERAL"
 
313
>[(<TT
 
314
CLASS="REPLACEABLE"
 
315
><I
 
316
>x1</I
 
317
></TT
 
318
>,...,<TT
 
319
CLASS="REPLACEABLE"
 
320
><I
 
321
>xn</I
 
322
></TT
 
323
>),(<TT
 
324
CLASS="REPLACEABLE"
 
325
><I
 
326
>y1</I
 
327
></TT
 
328
>,...,<TT
 
329
CLASS="REPLACEABLE"
 
330
><I
 
331
>yn</I
 
332
></TT
 
333
>)]</TT
 
334
></TD
 
335
><TD
 
336
>Same as above</TD
 
337
></TR
 
338
></TBODY
 
339
></TABLE
 
340
></DIV
 
341
><P
 
342
>   It does not matter which order the opposite corners of a cube are
 
343
   entered in.  The <TT
 
344
CLASS="TYPE"
 
345
>cube</TT
 
346
> functions
 
347
   automatically swap values if needed to create a uniform
 
348
   <SPAN
 
349
CLASS="QUOTE"
 
350
>"lower left &mdash; upper right"</SPAN
 
351
> internal representation.
 
352
  </P
 
353
><P
 
354
>   White space is ignored, so <TT
 
355
CLASS="LITERAL"
 
356
>[(<TT
 
357
CLASS="REPLACEABLE"
 
358
><I
 
359
>x</I
 
360
></TT
 
361
>),(<TT
 
362
CLASS="REPLACEABLE"
 
363
><I
 
364
>y</I
 
365
></TT
 
366
>)]</TT
 
367
> is the same as
 
368
   <TT
 
369
CLASS="LITERAL"
 
370
>[ ( <TT
 
371
CLASS="REPLACEABLE"
 
372
><I
 
373
>x</I
 
374
></TT
 
375
> ), ( <TT
 
376
CLASS="REPLACEABLE"
 
377
><I
 
378
>y</I
 
379
></TT
 
380
> ) ]</TT
 
381
>.
 
382
  </P
 
383
></DIV
 
384
><DIV
 
385
CLASS="SECT2"
 
386
><H2
 
387
CLASS="SECT2"
 
388
><A
 
389
NAME="AEN144055"
 
390
>F.8.2. Precision</A
 
391
></H2
 
392
><P
 
393
>   Values are stored internally as 64-bit floating point numbers. This means
 
394
   that numbers with more than about 16 significant digits will be truncated.
 
395
  </P
 
396
></DIV
 
397
><DIV
 
398
CLASS="SECT2"
 
399
><H2
 
400
CLASS="SECT2"
 
401
><A
 
402
NAME="AEN144058"
 
403
>F.8.3. Usage</A
 
404
></H2
 
405
><P
 
406
>   The <TT
 
407
CLASS="FILENAME"
 
408
>cube</TT
 
409
> module includes a GiST index operator class for
 
410
   <TT
 
411
CLASS="TYPE"
 
412
>cube</TT
 
413
> values.
 
414
   The operators supported by the GiST operator class are shown in <A
 
415
HREF="cube.html#CUBE-GIST-OPERATORS"
 
416
>Table F-2</A
 
417
>.
 
418
  </P
 
419
><DIV
 
420
CLASS="TABLE"
 
421
><A
 
422
NAME="CUBE-GIST-OPERATORS"
 
423
></A
 
424
><P
 
425
><B
 
426
>Table F-2. Cube GiST Operators</B
 
427
></P
 
428
><TABLE
 
429
BORDER="1"
 
430
CLASS="CALSTABLE"
 
431
><COL><COL><THEAD
 
432
><TR
 
433
><TH
 
434
>Operator</TH
 
435
><TH
 
436
>Description</TH
 
437
></TR
 
438
></THEAD
 
439
><TBODY
 
440
><TR
 
441
><TD
 
442
><TT
 
443
CLASS="LITERAL"
 
444
>a = b</TT
 
445
></TD
 
446
><TD
 
447
>The cubes a and b are identical.</TD
 
448
></TR
 
449
><TR
 
450
><TD
 
451
><TT
 
452
CLASS="LITERAL"
 
453
>a &amp;&amp; b</TT
 
454
></TD
 
455
><TD
 
456
>The cubes a and b overlap.</TD
 
457
></TR
 
458
><TR
 
459
><TD
 
460
><TT
 
461
CLASS="LITERAL"
 
462
>a @&gt; b</TT
 
463
></TD
 
464
><TD
 
465
>The cube a contains the cube b.</TD
 
466
></TR
 
467
><TR
 
468
><TD
 
469
><TT
 
470
CLASS="LITERAL"
 
471
>a &lt;@ b</TT
 
472
></TD
 
473
><TD
 
474
>The cube a is contained in the cube b.</TD
 
475
></TR
 
476
></TBODY
 
477
></TABLE
 
478
></DIV
 
479
><P
 
480
>   (Before PostgreSQL 8.2, the containment operators <TT
 
481
CLASS="LITERAL"
 
482
>@&gt;</TT
 
483
> and <TT
 
484
CLASS="LITERAL"
 
485
>&lt;@</TT
 
486
> were
 
487
   respectively called <TT
 
488
CLASS="LITERAL"
 
489
>@</TT
 
490
> and <TT
 
491
CLASS="LITERAL"
 
492
>~</TT
 
493
>.  These names are still available, but are
 
494
   deprecated and will eventually be retired.  Notice that the old names
 
495
   are reversed from the convention formerly followed by the core geometric
 
496
   data types!)
 
497
  </P
 
498
><P
 
499
>   The standard B-tree operators are also provided, for example
 
500
 
 
501
   <DIV
 
502
CLASS="INFORMALTABLE"
 
503
><P
 
504
></P
 
505
><A
 
506
NAME="AEN144094"
 
507
></A
 
508
><TABLE
 
509
BORDER="1"
 
510
CLASS="CALSTABLE"
 
511
><COL><COL><THEAD
 
512
><TR
 
513
><TH
 
514
>Operator</TH
 
515
><TH
 
516
>Description</TH
 
517
></TR
 
518
></THEAD
 
519
><TBODY
 
520
><TR
 
521
><TD
 
522
><TT
 
523
CLASS="LITERAL"
 
524
>[a, b] &lt; [c, d]</TT
 
525
></TD
 
526
><TD
 
527
>Less than</TD
 
528
></TR
 
529
><TR
 
530
><TD
 
531
><TT
 
532
CLASS="LITERAL"
 
533
>[a, b] &gt; [c, d]</TT
 
534
></TD
 
535
><TD
 
536
>Greater than</TD
 
537
></TR
 
538
></TBODY
 
539
></TABLE
 
540
><P
 
541
></P
 
542
></DIV
 
543
>
 
544
 
 
545
   These operators do not make a lot of sense for any practical
 
546
   purpose but sorting. These operators first compare (a) to (c),
 
547
   and if these are equal, compare (b) to (d). That results in
 
548
   reasonably good sorting in most cases, which is useful if
 
549
   you want to use ORDER BY with this type.
 
550
  </P
 
551
><P
 
552
>   <A
 
553
HREF="cube.html#CUBE-FUNCTIONS-TABLE"
 
554
>Table F-3</A
 
555
> shows the available functions.
 
556
  </P
 
557
><DIV
 
558
CLASS="TABLE"
 
559
><A
 
560
NAME="CUBE-FUNCTIONS-TABLE"
 
561
></A
 
562
><P
 
563
><B
 
564
>Table F-3. Cube Functions</B
 
565
></P
 
566
><TABLE
 
567
BORDER="1"
 
568
CLASS="CALSTABLE"
 
569
><COL><COL><TBODY
 
570
><TR
 
571
><TD
 
572
><TT
 
573
CLASS="LITERAL"
 
574
>cube(float8) returns cube</TT
 
575
></TD
 
576
><TD
 
577
>Makes a one dimensional cube with both coordinates the same.
 
578
       <TT
 
579
CLASS="LITERAL"
 
580
>cube(1) == '(1)'</TT
 
581
>
 
582
      </TD
 
583
></TR
 
584
><TR
 
585
><TD
 
586
><TT
 
587
CLASS="LITERAL"
 
588
>cube(float8, float8) returns cube</TT
 
589
></TD
 
590
><TD
 
591
>Makes a one dimensional cube.
 
592
       <TT
 
593
CLASS="LITERAL"
 
594
>cube(1,2) == '(1),(2)'</TT
 
595
>
 
596
      </TD
 
597
></TR
 
598
><TR
 
599
><TD
 
600
><TT
 
601
CLASS="LITERAL"
 
602
>cube(float8[]) returns cube</TT
 
603
></TD
 
604
><TD
 
605
>Makes a zero-volume cube using the coordinates
 
606
       defined by the array.
 
607
       <TT
 
608
CLASS="LITERAL"
 
609
>cube(ARRAY[1,2]) == '(1,2)'</TT
 
610
>
 
611
      </TD
 
612
></TR
 
613
><TR
 
614
><TD
 
615
><TT
 
616
CLASS="LITERAL"
 
617
>cube(float8[], float8[]) returns cube</TT
 
618
></TD
 
619
><TD
 
620
>Makes a cube with upper right and lower left
 
621
       coordinates as defined by the two arrays, which must be of the
 
622
       same length.
 
623
       <TT
 
624
CLASS="LITERAL"
 
625
>cube('{1,2}'::float[], '{3,4}'::float[]) == '(1,2),(3,4)'
 
626
       </TT
 
627
>
 
628
      </TD
 
629
></TR
 
630
><TR
 
631
><TD
 
632
><TT
 
633
CLASS="LITERAL"
 
634
>cube(cube, float8) returns cube</TT
 
635
></TD
 
636
><TD
 
637
>Makes a new cube by adding a dimension on to an
 
638
       existing cube with the same values for both parts of the new coordinate.
 
639
       This is useful for building cubes piece by piece from calculated values.
 
640
       <TT
 
641
CLASS="LITERAL"
 
642
>cube('(1)',2) == '(1,2),(1,2)'</TT
 
643
>
 
644
      </TD
 
645
></TR
 
646
><TR
 
647
><TD
 
648
><TT
 
649
CLASS="LITERAL"
 
650
>cube(cube, float8, float8) returns cube</TT
 
651
></TD
 
652
><TD
 
653
>Makes a new cube by adding a dimension on to an
 
654
       existing cube. This is useful for building cubes piece by piece from
 
655
       calculated values. <TT
 
656
CLASS="LITERAL"
 
657
>cube('(1,2)',3,4) == '(1,3),(2,4)'</TT
 
658
>
 
659
      </TD
 
660
></TR
 
661
><TR
 
662
><TD
 
663
><TT
 
664
CLASS="LITERAL"
 
665
>cube_dim(cube) returns int</TT
 
666
></TD
 
667
><TD
 
668
>Returns the number of dimensions of the cube
 
669
      </TD
 
670
></TR
 
671
><TR
 
672
><TD
 
673
><TT
 
674
CLASS="LITERAL"
 
675
>cube_ll_coord(cube, int) returns double </TT
 
676
></TD
 
677
><TD
 
678
>Returns the n'th coordinate value for the lower left
 
679
       corner of a cube
 
680
      </TD
 
681
></TR
 
682
><TR
 
683
><TD
 
684
><TT
 
685
CLASS="LITERAL"
 
686
>cube_ur_coord(cube, int) returns double
 
687
      </TT
 
688
></TD
 
689
><TD
 
690
>Returns the n'th coordinate value for the
 
691
       upper right corner of a cube
 
692
      </TD
 
693
></TR
 
694
><TR
 
695
><TD
 
696
><TT
 
697
CLASS="LITERAL"
 
698
>cube_is_point(cube) returns bool</TT
 
699
></TD
 
700
><TD
 
701
>Returns true if a cube is a point, that is,
 
702
       the two defining corners are the same.</TD
 
703
></TR
 
704
><TR
 
705
><TD
 
706
><TT
 
707
CLASS="LITERAL"
 
708
>cube_distance(cube, cube) returns double</TT
 
709
></TD
 
710
><TD
 
711
>Returns the distance between two cubes. If both
 
712
       cubes are points, this is the normal distance function.
 
713
      </TD
 
714
></TR
 
715
><TR
 
716
><TD
 
717
><TT
 
718
CLASS="LITERAL"
 
719
>cube_subset(cube, int[]) returns cube
 
720
      </TT
 
721
></TD
 
722
><TD
 
723
>Makes a new cube from an existing cube, using a list of
 
724
       dimension indexes from an array. Can be used to find both the LL and UR
 
725
       coordinates of a single dimension, e.g.
 
726
       <TT
 
727
CLASS="LITERAL"
 
728
>cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[2]) = '(3),(7)'</TT
 
729
>.
 
730
       Or can be used to drop dimensions, or reorder them as desired, e.g.
 
731
       <TT
 
732
CLASS="LITERAL"
 
733
>cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[3,2,1,1]) = '(5, 3,
 
734
       1, 1),(8, 7, 6, 6)'</TT
 
735
>.
 
736
      </TD
 
737
></TR
 
738
><TR
 
739
><TD
 
740
><TT
 
741
CLASS="LITERAL"
 
742
>cube_union(cube, cube) returns cube</TT
 
743
></TD
 
744
><TD
 
745
>Produces the union of two cubes
 
746
      </TD
 
747
></TR
 
748
><TR
 
749
><TD
 
750
><TT
 
751
CLASS="LITERAL"
 
752
>cube_inter(cube, cube) returns cube</TT
 
753
></TD
 
754
><TD
 
755
>Produces the intersection of two cubes
 
756
      </TD
 
757
></TR
 
758
><TR
 
759
><TD
 
760
><TT
 
761
CLASS="LITERAL"
 
762
>cube_enlarge(cube c, double r, int n) returns cube</TT
 
763
></TD
 
764
><TD
 
765
>Increases the size of a cube by a specified radius in at least
 
766
       n dimensions. If the radius is negative the cube is shrunk instead. This
 
767
       is useful for creating bounding boxes around a point for searching for
 
768
       nearby points. All defined dimensions are changed by the radius r.
 
769
       LL coordinates are decreased by r and UR coordinates are increased by r.
 
770
       If a LL coordinate is increased to larger than the corresponding UR
 
771
       coordinate (this can only happen when r &lt; 0) than both coordinates
 
772
       are set to their average.  If n is greater than the number of defined
 
773
       dimensions and the cube is being increased (r &gt;= 0) then 0 is used
 
774
       as the base for the extra coordinates.
 
775
      </TD
 
776
></TR
 
777
></TBODY
 
778
></TABLE
 
779
></DIV
 
780
></DIV
 
781
><DIV
 
782
CLASS="SECT2"
 
783
><H2
 
784
CLASS="SECT2"
 
785
><A
 
786
NAME="AEN144183"
 
787
>F.8.4. Defaults</A
 
788
></H2
 
789
><P
 
790
>   I believe this union:
 
791
  </P
 
792
><PRE
 
793
CLASS="PROGRAMLISTING"
 
794
>select cube_union('(0,5,2),(2,3,1)', '0');
 
795
cube_union
 
796
-------------------
 
797
(0, 0, 0),(2, 5, 2)
 
798
(1 row)</PRE
 
799
><P
 
800
>    does not contradict common sense, neither does the intersection
 
801
   </P
 
802
><PRE
 
803
CLASS="PROGRAMLISTING"
 
804
>select cube_inter('(0,-1),(1,1)', '(-2),(2)');
 
805
cube_inter
 
806
-------------
 
807
(0, 0),(1, 0)
 
808
(1 row)</PRE
 
809
><P
 
810
>    In all binary operations on differently-dimensioned cubes, I assume the
 
811
    lower-dimensional one to be a Cartesian projection, i. e., having zeroes
 
812
    in place of coordinates omitted in the string representation. The above
 
813
    examples are equivalent to:
 
814
   </P
 
815
><PRE
 
816
CLASS="PROGRAMLISTING"
 
817
>cube_union('(0,5,2),(2,3,1)','(0,0,0),(0,0,0)');
 
818
cube_inter('(0,-1),(1,1)','(-2,0),(2,0)');</PRE
 
819
><P
 
820
>    The following containment predicate uses the point syntax,
 
821
    while in fact the second argument is internally represented by a box.
 
822
    This syntax makes it unnecessary to define a separate point type
 
823
    and functions for (box,point) predicates.
 
824
   </P
 
825
><PRE
 
826
CLASS="PROGRAMLISTING"
 
827
>select cube_contains('(0,0),(1,1)', '0.5,0.5');
 
828
cube_contains
 
829
--------------
 
830
t
 
831
(1 row)</PRE
 
832
></DIV
 
833
><DIV
 
834
CLASS="SECT2"
 
835
><H2
 
836
CLASS="SECT2"
 
837
><A
 
838
NAME="AEN144193"
 
839
>F.8.5. Notes</A
 
840
></H2
 
841
><P
 
842
>   For examples of usage, see the regression test <TT
 
843
CLASS="FILENAME"
 
844
>sql/cube.sql</TT
 
845
>.
 
846
  </P
 
847
><P
 
848
>   To make it harder for people to break things, there
 
849
   is a limit of 100 on the number of dimensions of cubes. This is set
 
850
   in <TT
 
851
CLASS="FILENAME"
 
852
>cubedata.h</TT
 
853
> if you need something bigger.
 
854
  </P
 
855
></DIV
 
856
><DIV
 
857
CLASS="SECT2"
 
858
><H2
 
859
CLASS="SECT2"
 
860
><A
 
861
NAME="AEN144199"
 
862
>F.8.6. Credits</A
 
863
></H2
 
864
><P
 
865
>   Original author: Gene Selkov, Jr. <CODE
 
866
CLASS="EMAIL"
 
867
>&#60;<A
 
868
HREF="mailto:selkovjr@mcs.anl.gov"
 
869
>selkovjr@mcs.anl.gov</A
 
870
>&#62;</CODE
 
871
>,
 
872
   Mathematics and Computer Science Division, Argonne National Laboratory.
 
873
  </P
 
874
><P
 
875
>   My thanks are primarily to Prof. Joe Hellerstein
 
876
   (<A
 
877
HREF="http://db.cs.berkeley.edu/jmh/"
 
878
TARGET="_top"
 
879
>http://db.cs.berkeley.edu/jmh/</A
 
880
>) for elucidating the
 
881
   gist of the GiST (<A
 
882
HREF="http://gist.cs.berkeley.edu/"
 
883
TARGET="_top"
 
884
>http://gist.cs.berkeley.edu/</A
 
885
>), and
 
886
   to his former student, Andy Dong (<A
 
887
HREF="http://best.me.berkeley.edu/~adong/"
 
888
TARGET="_top"
 
889
>http://best.me.berkeley.edu/~adong/</A
 
890
>), for his example
 
891
   written for Illustra,
 
892
   <A
 
893
HREF="http://best.berkeley.edu/~adong/rtree/index.html"
 
894
TARGET="_top"
 
895
>http://best.berkeley.edu/~adong/rtree/index.html</A
 
896
>.
 
897
   I am also grateful to all Postgres developers, present and past, for
 
898
   enabling myself to create my own world and live undisturbed in it. And I
 
899
   would like to acknowledge my gratitude to Argonne Lab and to the
 
900
   U.S. Department of Energy for the years of faithful support of my database
 
901
   research.
 
902
  </P
 
903
><P
 
904
>   Minor updates to this package were made by Bruno Wolff III
 
905
   <CODE
 
906
CLASS="EMAIL"
 
907
>&#60;<A
 
908
HREF="mailto:bruno@wolff.to"
 
909
>bruno@wolff.to</A
 
910
>&#62;</CODE
 
911
> in August/September of 2002. These include
 
912
   changing the precision from single precision to double precision and adding
 
913
   some new functions.
 
914
  </P
 
915
><P
 
916
>   Additional updates were made by Joshua Reich <CODE
 
917
CLASS="EMAIL"
 
918
>&#60;<A
 
919
HREF="mailto:josh@root.net"
 
920
>josh@root.net</A
 
921
>&#62;</CODE
 
922
> in
 
923
   July 2006. These include <TT
 
924
CLASS="LITERAL"
 
925
>cube(float8[], float8[])</TT
 
926
> and
 
927
   cleaning up the code to use the V1 call protocol instead of the deprecated
 
928
   V0 protocol.
 
929
  </P
 
930
></DIV
 
931
></DIV
 
932
><DIV
 
933
CLASS="NAVFOOTER"
 
934
><HR
 
935
ALIGN="LEFT"
 
936
WIDTH="100%"><TABLE
 
937
SUMMARY="Footer navigation table"
 
938
WIDTH="100%"
 
939
BORDER="0"
 
940
CELLPADDING="0"
 
941
CELLSPACING="0"
 
942
><TR
 
943
><TD
 
944
WIDTH="33%"
 
945
ALIGN="left"
 
946
VALIGN="top"
 
947
><A
 
948
HREF="citext.html"
 
949
ACCESSKEY="P"
 
950
>Prev</A
 
951
></TD
 
952
><TD
 
953
WIDTH="34%"
 
954
ALIGN="center"
 
955
VALIGN="top"
 
956
><A
 
957
HREF="index.html"
 
958
ACCESSKEY="H"
 
959
>Home</A
 
960
></TD
 
961
><TD
 
962
WIDTH="33%"
 
963
ALIGN="right"
 
964
VALIGN="top"
 
965
><A
 
966
HREF="dblink.html"
 
967
ACCESSKEY="N"
 
968
>Next</A
 
969
></TD
 
970
></TR
 
971
><TR
 
972
><TD
 
973
WIDTH="33%"
 
974
ALIGN="left"
 
975
VALIGN="top"
 
976
>citext</TD
 
977
><TD
 
978
WIDTH="34%"
 
979
ALIGN="center"
 
980
VALIGN="top"
 
981
><A
 
982
HREF="contrib.html"
 
983
ACCESSKEY="U"
 
984
>Up</A
 
985
></TD
 
986
><TD
 
987
WIDTH="33%"
 
988
ALIGN="right"
 
989
VALIGN="top"
 
990
>dblink</TD
 
991
></TR
 
992
></TABLE
 
993
></DIV
 
994
></BODY
 
995
></HTML
 
996
>
 
 
b'\\ No newline at end of file'