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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_05) on Thu Sep 09 20:36:07 PDT 2004 -->
<TITLE>
Partitioning (Colt 1.2.0 - API Specification)
</TITLE>
<META NAME="keywords" CONTENT="cern.colt.Partitioning class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Partitioning (Colt 1.2.0 - API Specification)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Partitioning.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Colt 1.2.0</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../cern/colt/GenericSorting.html" title="class in cern.colt"><B>PREV CLASS</B></A>
<A HREF="../../cern/colt/PersistentObject.html" title="class in cern.colt"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="Partitioning.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
cern.colt</FONT>
<BR>
Class Partitioning</H2>
<PRE>
<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">java.lang.Object</A>
<IMG SRC="../../resources/inherit.gif" ALT="extended by"><B>cern.colt.Partitioning</B>
</PRE>
<HR>
<DL>
<DT>public class <B>Partitioning</B><DT>extends <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></DL>
<P>
Given some interval boundaries, partitions arrays such that all elements falling into an interval are placed next to each other.
<p>
The algorithms partition arrays into two or more intervals.
They distinguish between <i>synchronously</i> partitioning either one, two or three arrays.
They further come in templated versions, either partitioning <tt>int[]</tt> arrays or <tt>double[]</tt> arrays.
<p>
You may want to start out reading about the simplest case: Partitioning one <tt>int[]</tt> array into two intervals.
To do so, read <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int)"><CODE>partition(int[],int,int,int)</CODE></A>.
Next, building upon that foundation comes a method partitioning <tt>int[]</tt> arrays into multiple intervals.
See <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int[], int, int, int[])"><CODE>partition(int[],int,int,int[],int,int,int[])</CODE></A> for related documentation.
<p>
All other methods are no different than the one's you now already understand, except that they operate on slightly different data types.
<p>
<b>Performance</b>
<p>
Partitioning into two intervals is <tt>O( N )</tt>.
Partitioning into k intervals is <tt>O( N * log(k))</tt>.
Constants factors are minimized.
No temporary memory is allocated; Partitioning is in-place.
<P>
<P>
<DL>
<DT><B>Version:</B></DT>
<DD>1.0, 03-Jul-99</DD>
<DT><B>See Also:</B><DD><A HREF="../../cern/colt/matrix/doublealgo/Partitioning.html" title="class in cern.colt.matrix.doublealgo"><CODE>Partitioning</CODE></A></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#swappedElements">swappedElements</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#dualPartition(double[], double[], int, int, double)">dualPartition</A></B>(double[] list,
double[] secondary,
int from,
int to,
double splitter)</CODE>
<BR>
Same as <A HREF="../../cern/colt/Partitioning.html#dualPartition(int[], int[], int, int, int)"><CODE>dualPartition(int[],int[],int,int,int)</CODE></A>
except that it <i>synchronously</i> partitions <tt>double[]</tt> rather than <tt>int[]</tt> arrays.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#dualPartition(double[], double[], int, int, double[], int, int, int[])">dualPartition</A></B>(double[] list,
double[] secondary,
int from,
int to,
double[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes)</CODE>
<BR>
Same as <A HREF="../../cern/colt/Partitioning.html#dualPartition(int[], int[], int, int, int[], int, int, int[])"><CODE>dualPartition(int[],int[],int,int,int[],int,int,int[])</CODE></A>
except that it <i>synchronously</i> partitions <tt>double[]</tt> rather than <tt>int[]</tt> arrays.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#dualPartition(int[], int[], int, int, int)">dualPartition</A></B>(int[] list,
int[] secondary,
int from,
int to,
int splitter)</CODE>
<BR>
Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int)"><CODE>partition(int[],int,int,int)</CODE></A> except that this method <i>synchronously</i> partitions two arrays at the same time;
both arrays are partially sorted according to the elements of the primary array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#dualPartition(int[], int[], int, int, int[], int, int, int[])">dualPartition</A></B>(int[] list,
int[] secondary,
int from,
int to,
int[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes)</CODE>
<BR>
Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int[], int, int, int[])"><CODE>partition(int[],int,int,int[],int,int,int[])</CODE></A> except that this method <i>synchronously</i> partitions two arrays at the same time;
both arrays are partially sorted according to the elements of the primary array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#genericPartition(int, int, int, int, int[], cern.colt.function.IntComparator, cern.colt.function.IntComparator, cern.colt.function.IntComparator, cern.colt.Swapper)">genericPartition</A></B>(int from,
int to,
int splitFrom,
int splitTo,
int[] splitIndexes,
<A HREF="../../cern/colt/function/IntComparator.html" title="interface in cern.colt.function">IntComparator</A> comp,
<A HREF="../../cern/colt/function/IntComparator.html" title="interface in cern.colt.function">IntComparator</A> comp2,
<A HREF="../../cern/colt/function/IntComparator.html" title="interface in cern.colt.function">IntComparator</A> comp3,
<A HREF="../../cern/colt/Swapper.html" title="interface in cern.colt">Swapper</A> swapper)</CODE>
<BR>
Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int[], int, int, int[])"><CODE>partition(int[],int,int,int[],int,int,int[])</CODE></A>
except that it <i>generically</i> partitions arbitrary shaped data (for example matrices or multiple arrays) rather than <tt>int[]</tt> arrays.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#partition(double[], int, int, double)">partition</A></B>(double[] list,
int from,
int to,
double splitter)</CODE>
<BR>
Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int)"><CODE>partition(int[],int,int,int)</CODE></A>
except that it partitions <tt>double[]</tt> rather than <tt>int[]</tt> arrays.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#partition(double[], int, int, double[], int, int, int[])">partition</A></B>(double[] list,
int from,
int to,
double[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes)</CODE>
<BR>
Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int[], int, int, int[])"><CODE>partition(int[],int,int,int[],int,int,int[])</CODE></A>
except that it partitions <tt>double[]</tt> rather than <tt>int[]</tt> arrays.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#partition(cern.colt.list.DoubleArrayList, int, int, cern.colt.list.DoubleArrayList, cern.colt.list.IntArrayList)">partition</A></B>(<A HREF="../../cern/colt/list/DoubleArrayList.html" title="class in cern.colt.list">DoubleArrayList</A> list,
int from,
int to,
<A HREF="../../cern/colt/list/DoubleArrayList.html" title="class in cern.colt.list">DoubleArrayList</A> splitters,
<A HREF="../../cern/colt/list/IntArrayList.html" title="class in cern.colt.list">IntArrayList</A> splitIndexes)</CODE>
<BR>
Equivalent to <tt>partition(list.elements(), from, to, splitters.elements(), 0, splitters.size()-1, splitIndexes.elements())</tt>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int)">partition</A></B>(int[] list,
int from,
int to,
int splitter)</CODE>
<BR>
Partitions (partially sorts) the given list such that all elements falling into the given interval are placed next to each other.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int[], int, int, int[])">partition</A></B>(int[] list,
int from,
int to,
int[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes)</CODE>
<BR>
Partitions (partially sorts) the given list such that all elements falling into some intervals are placed next to each other.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#partition(cern.colt.list.IntArrayList, int, int, cern.colt.list.IntArrayList, cern.colt.list.IntArrayList)">partition</A></B>(<A HREF="../../cern/colt/list/IntArrayList.html" title="class in cern.colt.list">IntArrayList</A> list,
int from,
int to,
<A HREF="../../cern/colt/list/IntArrayList.html" title="class in cern.colt.list">IntArrayList</A> splitters,
<A HREF="../../cern/colt/list/IntArrayList.html" title="class in cern.colt.list">IntArrayList</A> splitIndexes)</CODE>
<BR>
Equivalent to <tt>partition(list.elements(), from, to, splitters.elements(), 0, splitters.size()-1, splitIndexes.elements())</tt>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#partition(java.lang.Object[], int, int, java.lang.Object[], int, int, int[], java.util.Comparator)">partition</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>[] list,
int from,
int to,
<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes,
<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/Comparator.html" title="class or interface in java.util">Comparator</A> comp)</CODE>
<BR>
Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int[], int, int, int[])"><CODE>partition(int[],int,int,int[],int,int,int[])</CODE></A>
except that it partitions <tt>Object[]</tt> rather than <tt>int[]</tt> arrays.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#partition(java.lang.Object[], int, int, java.lang.Object, java.util.Comparator)">partition</A></B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>[] list,
int from,
int to,
<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> splitter,
<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/Comparator.html" title="class or interface in java.util">Comparator</A> comp)</CODE>
<BR>
Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int)"><CODE>partition(int[],int,int,int)</CODE></A>
except that it <i>synchronously</i> partitions the objects of the given list by the order of the given comparator.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#triplePartition(double[], double[], double[], int, int, double)">triplePartition</A></B>(double[] list,
double[] secondary,
double[] tertiary,
int from,
int to,
double splitter)</CODE>
<BR>
Same as <A HREF="../../cern/colt/Partitioning.html#triplePartition(int[], int[], int[], int, int, int)"><CODE>triplePartition(int[],int[],int[],int,int,int)</CODE></A>
except that it <i>synchronously</i> partitions <tt>double[]</tt> rather than <tt>int[]</tt> arrays.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#triplePartition(double[], double[], double[], int, int, double[], int, int, int[])">triplePartition</A></B>(double[] list,
double[] secondary,
double[] tertiary,
int from,
int to,
double[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes)</CODE>
<BR>
Same as <A HREF="../../cern/colt/Partitioning.html#triplePartition(int[], int[], int[], int, int, int[], int, int, int[])"><CODE>triplePartition(int[],int[],int[],int,int,int[],int,int,int[])</CODE></A>
except that it <i>synchronously</i> partitions <tt>double[]</tt> rather than <tt>int[]</tt> arrays.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#triplePartition(int[], int[], int[], int, int, int)">triplePartition</A></B>(int[] list,
int[] secondary,
int[] tertiary,
int from,
int to,
int splitter)</CODE>
<BR>
Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int)"><CODE>partition(int[],int,int,int)</CODE></A> except that this method <i>synchronously</i> partitions three arrays at the same time;
all three arrays are partially sorted according to the elements of the primary array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../cern/colt/Partitioning.html#triplePartition(int[], int[], int[], int, int, int[], int, int, int[])">triplePartition</A></B>(int[] list,
int[] secondary,
int[] tertiary,
int from,
int to,
int[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes)</CODE>
<BR>
Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int[], int, int, int[])"><CODE>partition(int[],int,int,int[],int,int,int[])</CODE></A> except that this method <i>synchronously</i> partitions three arrays at the same time;
all three arrays are partially sorted according to the elements of the primary array.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="swappedElements"><!-- --></A><H3>
swappedElements</H3>
<PRE>
public static int <B>swappedElements</B></PRE>
<DL>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="dualPartition(double[], double[], int, int, double[], int, int, int[])"><!-- --></A><H3>
dualPartition</H3>
<PRE>
public static void <B>dualPartition</B>(double[] list,
double[] secondary,
int from,
int to,
double[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes)</PRE>
<DL>
<DD>Same as <A HREF="../../cern/colt/Partitioning.html#dualPartition(int[], int[], int, int, int[], int, int, int[])"><CODE>dualPartition(int[],int[],int,int,int[],int,int,int[])</CODE></A>
except that it <i>synchronously</i> partitions <tt>double[]</tt> rather than <tt>int[]</tt> arrays.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="dualPartition(double[], double[], int, int, double)"><!-- --></A><H3>
dualPartition</H3>
<PRE>
public static int <B>dualPartition</B>(double[] list,
double[] secondary,
int from,
int to,
double splitter)</PRE>
<DL>
<DD>Same as <A HREF="../../cern/colt/Partitioning.html#dualPartition(int[], int[], int, int, int)"><CODE>dualPartition(int[],int[],int,int,int)</CODE></A>
except that it <i>synchronously</i> partitions <tt>double[]</tt> rather than <tt>int[]</tt> arrays.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="dualPartition(int[], int[], int, int, int[], int, int, int[])"><!-- --></A><H3>
dualPartition</H3>
<PRE>
public static void <B>dualPartition</B>(int[] list,
int[] secondary,
int from,
int to,
int[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes)</PRE>
<DL>
<DD>Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int[], int, int, int[])"><CODE>partition(int[],int,int,int[],int,int,int[])</CODE></A> except that this method <i>synchronously</i> partitions two arrays at the same time;
both arrays are partially sorted according to the elements of the primary array.
In other words, each time an element in the primary array is moved from index A to B, the correspoding element within the secondary array is also moved from index A to B.
<p>
<b>Use cases:</b>
<p>
Image having a large list of 2-dimensional points.
If memory consumption and performance matter, it is a good idea to physically lay them out as two 1-dimensional arrays
(using something like <tt>Point2D</tt> objects would be prohibitively expensive, both in terms of time and space).
Now imagine wanting to histogram the points.
We may want to partially sort the points by x-coordinate into intervals.
This method efficiently does the job.
<p>
<b>Performance:</b>
<p>
Same as for single-partition methods.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="dualPartition(int[], int[], int, int, int)"><!-- --></A><H3>
dualPartition</H3>
<PRE>
public static int <B>dualPartition</B>(int[] list,
int[] secondary,
int from,
int to,
int splitter)</PRE>
<DL>
<DD>Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int)"><CODE>partition(int[],int,int,int)</CODE></A> except that this method <i>synchronously</i> partitions two arrays at the same time;
both arrays are partially sorted according to the elements of the primary array.
In other words, each time an element in the primary array is moved from index A to B, the correspoding element within the secondary array is also moved from index A to B.
<p>
<b>Performance:</b>
<p>
Same as for single-partition methods.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="genericPartition(int, int, int, int, int[], cern.colt.function.IntComparator, cern.colt.function.IntComparator, cern.colt.function.IntComparator, cern.colt.Swapper)"><!-- --></A><H3>
genericPartition</H3>
<PRE>
public static void <B>genericPartition</B>(int from,
int to,
int splitFrom,
int splitTo,
int[] splitIndexes,
<A HREF="../../cern/colt/function/IntComparator.html" title="interface in cern.colt.function">IntComparator</A> comp,
<A HREF="../../cern/colt/function/IntComparator.html" title="interface in cern.colt.function">IntComparator</A> comp2,
<A HREF="../../cern/colt/function/IntComparator.html" title="interface in cern.colt.function">IntComparator</A> comp3,
<A HREF="../../cern/colt/Swapper.html" title="interface in cern.colt">Swapper</A> swapper)</PRE>
<DL>
<DD>Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int[], int, int, int[])"><CODE>partition(int[],int,int,int[],int,int,int[])</CODE></A>
except that it <i>generically</i> partitions arbitrary shaped data (for example matrices or multiple arrays) rather than <tt>int[]</tt> arrays.
<p>
This method operates on arbitrary shaped data and arbitrary shaped splitters.
In fact, it has no idea what kind of data by what kind of splitters it is partitioning. Comparisons and swapping
are delegated to user provided objects which know their data and can do the
job.
<p>
Lets call the generic data <tt>g</tt> (it may be a matrix, one array, three linked lists
or whatever). Lets call the generic splitters <tt>s</tt>.
This class takes a user comparison function operating on two indexes
<tt>(a,b)</tt>, namely an <A HREF="../../cern/colt/function/IntComparator.html" title="interface in cern.colt.function"><CODE>IntComparator</CODE></A>.
The comparison function determines whether <tt>s[a]</tt> is equal, less or greater than <tt>g[b]</tt>.
This method can then decide to swap the data <tt>g[b]</tt>
with the data <tt>g[c]</tt> (yes, <tt>c</tt>, not <tt>a</tt>).
It calls a user provided <A HREF="../../cern/colt/Swapper.html" title="interface in cern.colt"><CODE>Swapper</CODE></A>
object that knows how to swap the data of these two indexes.
<p>
Again, note the details: Comparisons compare <tt>s[a]</tt> with <tt>g[b]</tt>.
Swaps swap <tt>g[b]</tt> with <tt>g[c]</tt>.
Prior to calling this method, the generic splitters <tt>s</tt> must be sorted ascending and must not contain multiple equal values.
These preconditions are not checked; be sure that they are met.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>from</CODE> - the index of the first element within <tt>g</tt> to be considered.<DD><CODE>to</CODE> - the index of the last element within <tt>g</tt> to be considered.
The method considers the elements <tt>g[from] .. g[to]</tt>.<DD><CODE>splitFrom</CODE> - the index of the first splitter element to be considered.<DD><CODE>splitTo</CODE> - the index of the last splitter element to be considered.
The method considers the splitter elements <tt>s[splitFrom] .. s[splitTo]</tt>.<DD><CODE>splitIndexes</CODE> - a list into which this method fills the indexes of elements delimiting intervals.
Upon return <tt>splitIndexes[splitFrom..splitTo]</tt> will be set accordingly.
Therefore, must satisfy <tt>splitIndexes.length > splitTo</tt>.<DD><CODE>comp</CODE> - the comparator comparing a splitter with an element of the generic data.
Takes as first argument the index <tt>a</tt> within the generic splitters <tt>s</tt>.
Takes as second argument the index <tt>b</tt> within the generic data <tt>g</tt>.<DD><CODE>comp2</CODE> - the comparator to determine the order of the generic data.
Takes as first argument the index <tt>a</tt> within the generic data <tt>g</tt>.
Takes as second argument the index <tt>b</tt> within the generic data <tt>g</tt>.<DD><CODE>comp3</CODE> - the comparator comparing a splitter with another splitter.
Takes as first argument the index <tt>a</tt> within the generic splitters <tt>s</tt>.
Takes as second argument the index <tt>b</tt> within the generic splitters <tt>g</tt>.<DD><CODE>swapper</CODE> - an object that knows how to swap the elements at any two indexes (a,b).
Takes as first argument the index <tt>b</tt> within the generic data <tt>g</tt>.
Takes as second argument the index <tt>c</tt> within the generic data <tt>g</tt>.
<p>
Tip: Normally you will have <tt>splitIndexes.length == s.length</tt> as well as <tt>from==0, to==g.length-1</tt> and <tt>splitFrom==0, splitTo==s.length-1</tt>.<DT><B>See Also:</B><DD><CODE>Sort</CODE>,
<CODE>Sort#sort(int,int,IntComparator,Swapper)</CODE>,
<A HREF="../../cern/colt/Sorting.html#binarySearchFromTo(int, int, cern.colt.function.IntComparator)"><CODE>Sorting.binarySearchFromTo(int,int,IntComparator)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="partition(double[], int, int, double[], int, int, int[])"><!-- --></A><H3>
partition</H3>
<PRE>
public static void <B>partition</B>(double[] list,
int from,
int to,
double[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes)</PRE>
<DL>
<DD>Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int[], int, int, int[])"><CODE>partition(int[],int,int,int[],int,int,int[])</CODE></A>
except that it partitions <tt>double[]</tt> rather than <tt>int[]</tt> arrays.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="partition(double[], int, int, double)"><!-- --></A><H3>
partition</H3>
<PRE>
public static int <B>partition</B>(double[] list,
int from,
int to,
double splitter)</PRE>
<DL>
<DD>Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int)"><CODE>partition(int[],int,int,int)</CODE></A>
except that it partitions <tt>double[]</tt> rather than <tt>int[]</tt> arrays.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="partition(int[], int, int, int[], int, int, int[])"><!-- --></A><H3>
partition</H3>
<PRE>
public static void <B>partition</B>(int[] list,
int from,
int to,
int[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes)</PRE>
<DL>
<DD>Partitions (partially sorts) the given list such that all elements falling into some intervals are placed next to each other.
Returns the indexes of elements delimiting intervals.
<p>
<b>Example:</b>
<p>
<tt>list = (7, 4, 5, 50, 6, 4, 3, 6), splitters = (5, 10, 30)</tt>
defines the three intervals <tt>[-infinity,5), [5,10), [10,30)</tt>.
Lets define to sort the entire list (<tt>from=0, to=7</tt>) using all splitters (<tt>splitFrom==0, splitTo=2</tt>).
<p>
The method modifies the list to be <tt>list = (4, 4, 3, 6, 7, 5, 6, 50)</tt>
and returns the <tt>splitIndexes = (2, 6, 6)</tt>.
In other words,
<ul>
<li>All values <tt>list[0..2]</tt> fall into <tt>[-infinity,5)</tt>.
<li>All values <tt>list[3..6]</tt> fall into <tt>[5,10)</tt>.
<li>All values <tt>list[7..6]</tt> fall into <tt>[10,30)</tt>, i.e. no elements, since <tt>7>6</tt>.
<li>All values <tt>list[7 .. 7=list.length-1]</tt> fall into <tt>[30,infinity]</tt>.
<li>In general, all values <tt>list[splitIndexes[j-1]+1 .. splitIndexes[j]]</tt> fall into interval <tt>j</tt>.
</ul>
As can be seen, the list is partially sorted such that values falling into a certain interval are placed next to each other.
Note that <i>within</i> an interval, elements are entirelly unsorted.
They are only sorted across interval boundaries.
In particular, this partitioning algorithm is not <i>stable</i>: the relative order of elements is not preserved
(Producing a stable algorithm would require no more than minor modifications to method partition(int[],int,int,int)).
<p>
More formally, this method guarantees that upon return <tt>for all j = splitFrom .. splitTo</tt> there holds:
<br><tt>for all i = splitIndexes[j-1]+1 .. splitIndexes[j]: splitters[j-1] <= list[i] < splitters[j]</tt>.
<p>
<b>Performance:</b>
<p>
Let <tt>N=to-from+1</tt> be the number of elements to be partitioned.
Let <tt>k=splitTo-splitFrom+1</tt> be the number of splitter elements.
Then we have the following time complexities
<ul>
<li>Worst case: <tt>O( N * log(k) )</tt>.
<li>Average case: <tt>O( N * log(k) )</tt>.
<li>Best case: <tt>O( N )</tt>.
In general, the more uniform (skewed) the data is spread across intervals, the more performance approaches the worst (best) case.
If no elements fall into the given intervals, running time is linear.
</ul>
No temporary memory is allocated; the sort is in-place.
<p>
<b>Implementation:</b>
<p>
The algorithm can be seen as a Bentley/McIlroy quicksort where swapping and insertion sort are omitted.
It is designed to detect and take advantage of skew while maintaining good performance in the uniform case.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>list</CODE> - the list to be partially sorted.<DD><CODE>from</CODE> - the index of the first element within <tt>list</tt> to be considered.<DD><CODE>to</CODE> - the index of the last element within <tt>list</tt> to be considered.
The method considers the elements <tt>list[from] .. list[to]</tt>.<DD><CODE>splitters</CODE> - the values at which the list shall be split into intervals.
Must be sorted ascending and must not contain multiple identical values.
These preconditions are not checked; be sure that they are met.<DD><CODE>splitFrom</CODE> - the index of the first splitter element to be considered.<DD><CODE>splitTo</CODE> - the index of the last splitter element to be considered.
The method considers the splitter elements <tt>splitters[splitFrom] .. splitters[splitTo]</tt>.<DD><CODE>splitIndexes</CODE> - a list into which this method fills the indexes of elements delimiting intervals.
Upon return <tt>splitIndexes[splitFrom..splitTo]</tt> will be set accordingly.
Therefore, must satisfy <tt>splitIndexes.length > splitTo</tt>.
<p>
Tip: Normally you will have <tt>splitIndexes.length == splitters.length</tt> as well as <tt>from==0, to==list.length-1</tt> and <tt>splitFrom==0, splitTo==splitters.length-1</tt>.<DT><B>See Also:</B><DD><A HREF="../../cern/colt/Arrays.html" title="class in cern.colt"><CODE>Arrays</CODE></A>,
<A HREF="../../cern/colt/GenericSorting.html" title="class in cern.colt"><CODE>GenericSorting</CODE></A>,
<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/Arrays.html" title="class or interface in java.util"><CODE>Arrays</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="partition(int[], int, int, int)"><!-- --></A><H3>
partition</H3>
<PRE>
public static int <B>partition</B>(int[] list,
int from,
int to,
int splitter)</PRE>
<DL>
<DD>Partitions (partially sorts) the given list such that all elements falling into the given interval are placed next to each other.
Returns the index of the element delimiting the interval.
<p>
<b>Example:</b>
<p>
<tt>list = (7, 4, 5, 50, 6, 4, 3, 6), splitter = 5</tt>
defines the two intervals <tt>[-infinity,5), [5,+infinity]</tt>.
<p>
The method modifies the list to be <tt>list = (4, 4, 3, 50, 6, 7, 5, 6)</tt>
and returns the split index <tt>2</tt>.
In other words,
<ul>
<li>All values <tt>list[0..2]</tt> fall into <tt>[-infinity,5)</tt>.
<li>All values <tt>list[3=2+1 .. 7=list.length-1]</tt> fall into <tt>[5,+infinity]</tt>.
</ul>
As can be seen, the list is partially sorted such that values falling into a certain interval are placed next to each other.
Note that <i>within</i> an interval, elements are entirelly unsorted.
They are only sorted across interval boundaries.
In particular, this partitioning algorithm is not <i>stable</i>.
<p>
More formally, this method guarantees that upon return there holds:
<ul>
<li>for all <tt>i = from .. returnValue: list[i] < splitter</tt> and
<li>for all <tt>i = returnValue+1 .. list.length-1: !(list[i] < splitter)</tt>.
</ul>
<p>
<b>Performance:</b>
<p>
Let <tt>N=to-from+1</tt> be the number of elements to be partially sorted.
Then the time complexity is <tt>O( N )</tt>.
No temporary memory is allocated; the sort is in-place.
<p>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>list</CODE> - the list to be partially sorted.<DD><CODE>from</CODE> - the index of the first element within <tt>list</tt> to be considered.<DD><CODE>to</CODE> - the index of the last element within <tt>list</tt> to be considered.
The method considers the elements <tt>list[from] .. list[to]</tt>.<DD><CODE>splitter</CODE> - the value at which the list shall be split.
<DT><B>Returns:</B><DD>the index of the largest element falling into the interval <tt>[-infinity,splitter)</tt>, as seen after partitioning.</DL>
</DD>
</DL>
<HR>
<A NAME="partition(java.lang.Object[], int, int, java.lang.Object[], int, int, int[], java.util.Comparator)"><!-- --></A><H3>
partition</H3>
<PRE>
public static void <B>partition</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>[] list,
int from,
int to,
<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes,
<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/Comparator.html" title="class or interface in java.util">Comparator</A> comp)</PRE>
<DL>
<DD>Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int[], int, int, int[])"><CODE>partition(int[],int,int,int[],int,int,int[])</CODE></A>
except that it partitions <tt>Object[]</tt> rather than <tt>int[]</tt> arrays.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="partition(java.lang.Object[], int, int, java.lang.Object, java.util.Comparator)"><!-- --></A><H3>
partition</H3>
<PRE>
public static int <B>partition</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>[] list,
int from,
int to,
<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> splitter,
<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/util/Comparator.html" title="class or interface in java.util">Comparator</A> comp)</PRE>
<DL>
<DD>Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int)"><CODE>partition(int[],int,int,int)</CODE></A>
except that it <i>synchronously</i> partitions the objects of the given list by the order of the given comparator.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="partition(cern.colt.list.DoubleArrayList, int, int, cern.colt.list.DoubleArrayList, cern.colt.list.IntArrayList)"><!-- --></A><H3>
partition</H3>
<PRE>
public static void <B>partition</B>(<A HREF="../../cern/colt/list/DoubleArrayList.html" title="class in cern.colt.list">DoubleArrayList</A> list,
int from,
int to,
<A HREF="../../cern/colt/list/DoubleArrayList.html" title="class in cern.colt.list">DoubleArrayList</A> splitters,
<A HREF="../../cern/colt/list/IntArrayList.html" title="class in cern.colt.list">IntArrayList</A> splitIndexes)</PRE>
<DL>
<DD>Equivalent to <tt>partition(list.elements(), from, to, splitters.elements(), 0, splitters.size()-1, splitIndexes.elements())</tt>.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="partition(cern.colt.list.IntArrayList, int, int, cern.colt.list.IntArrayList, cern.colt.list.IntArrayList)"><!-- --></A><H3>
partition</H3>
<PRE>
public static void <B>partition</B>(<A HREF="../../cern/colt/list/IntArrayList.html" title="class in cern.colt.list">IntArrayList</A> list,
int from,
int to,
<A HREF="../../cern/colt/list/IntArrayList.html" title="class in cern.colt.list">IntArrayList</A> splitters,
<A HREF="../../cern/colt/list/IntArrayList.html" title="class in cern.colt.list">IntArrayList</A> splitIndexes)</PRE>
<DL>
<DD>Equivalent to <tt>partition(list.elements(), from, to, splitters.elements(), 0, splitters.size()-1, splitIndexes.elements())</tt>.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="triplePartition(double[], double[], double[], int, int, double[], int, int, int[])"><!-- --></A><H3>
triplePartition</H3>
<PRE>
public static void <B>triplePartition</B>(double[] list,
double[] secondary,
double[] tertiary,
int from,
int to,
double[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes)</PRE>
<DL>
<DD>Same as <A HREF="../../cern/colt/Partitioning.html#triplePartition(int[], int[], int[], int, int, int[], int, int, int[])"><CODE>triplePartition(int[],int[],int[],int,int,int[],int,int,int[])</CODE></A>
except that it <i>synchronously</i> partitions <tt>double[]</tt> rather than <tt>int[]</tt> arrays.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="triplePartition(double[], double[], double[], int, int, double)"><!-- --></A><H3>
triplePartition</H3>
<PRE>
public static int <B>triplePartition</B>(double[] list,
double[] secondary,
double[] tertiary,
int from,
int to,
double splitter)</PRE>
<DL>
<DD>Same as <A HREF="../../cern/colt/Partitioning.html#triplePartition(int[], int[], int[], int, int, int)"><CODE>triplePartition(int[],int[],int[],int,int,int)</CODE></A>
except that it <i>synchronously</i> partitions <tt>double[]</tt> rather than <tt>int[]</tt> arrays.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="triplePartition(int[], int[], int[], int, int, int[], int, int, int[])"><!-- --></A><H3>
triplePartition</H3>
<PRE>
public static void <B>triplePartition</B>(int[] list,
int[] secondary,
int[] tertiary,
int from,
int to,
int[] splitters,
int splitFrom,
int splitTo,
int[] splitIndexes)</PRE>
<DL>
<DD>Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int[], int, int, int[])"><CODE>partition(int[],int,int,int[],int,int,int[])</CODE></A> except that this method <i>synchronously</i> partitions three arrays at the same time;
all three arrays are partially sorted according to the elements of the primary array.
In other words, each time an element in the primary array is moved from index A to B, the correspoding element within the secondary array as well as the corresponding element within the tertiary array are also moved from index A to B.
<p>
<b>Use cases:</b>
<p>
Image having a large list of 3-dimensional points.
If memory consumption and performance matter, it is a good idea to physically lay them out as three 1-dimensional arrays
(using something like <tt>Point3D</tt> objects would be prohibitively expensive, both in terms of time and space).
Now imagine wanting to histogram the points.
We may want to partially sort the points by x-coordinate into intervals.
This method efficiently does the job.
<p>
<b>Performance:</b>
<p>
Same as for single-partition methods.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="triplePartition(int[], int[], int[], int, int, int)"><!-- --></A><H3>
triplePartition</H3>
<PRE>
public static int <B>triplePartition</B>(int[] list,
int[] secondary,
int[] tertiary,
int from,
int to,
int splitter)</PRE>
<DL>
<DD>Same as <A HREF="../../cern/colt/Partitioning.html#partition(int[], int, int, int)"><CODE>partition(int[],int,int,int)</CODE></A> except that this method <i>synchronously</i> partitions three arrays at the same time;
all three arrays are partially sorted according to the elements of the primary array.
In other words, each time an element in the primary array is moved from index A to B, the correspoding element within the secondary array as well as the corresponding element within the tertiary array are also moved from index A to B.
<p>
<b>Performance:</b>
<p>
Same as for single-partition methods.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Partitioning.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<b>Colt 1.2.0</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../cern/colt/GenericSorting.html" title="class in cern.colt"><B>PREV CLASS</B></A>
<A HREF="../../cern/colt/PersistentObject.html" title="class in cern.colt"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="Partitioning.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<font size=-1 >Jump to the <a target=_top href=http://dsd.lbl.gov/~hoschek/colt >Colt Homepage</a>
</BODY>
</HTML>
|