亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? qsort_double.cc

?? sparselib庫
?? CC
字號:
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*//*             ********   ***                                 SparseLib++    *//*          *******  **  ***       ***      ***                              *//*           *****      ***     ******** ********                            *//*            *****    ***     ******** ********              R. Pozo        *//*       **  *******  ***   **   ***      ***                 K. Remington   *//*        ********   ********                                 A. Lumsdaine   *//*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*//*                                                                           *//*                                                                           *//*                     SparseLib++ : Sparse Matrix Library                   *//*                                                                           *//*               National Institute of Standards and Technology              *//*                        University of Notre Dame                           *//*              Authors: R. Pozo, K. Remington, A. Lumsdaine                 *//*                                                                           *//*                                 NOTICE                                    *//*                                                                           *//* Permission to use, copy, modify, and distribute this software and         *//* its documentation for any purpose and without fee is hereby granted       *//* provided that the above notice appear in all copies and supporting        *//* documentation.                                                            *//*                                                                           *//* Neither the Institutions (National Institute of Standards and Technology, *//* University of Notre Dame) nor the Authors make any representations about  *//* the suitability of this software for any purpose.  This software is       *//* provided ``as is'' without expressed or implied warranty.                 *//*                                                                           *//*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/// An adaptation of Schmidt's new quicksort (taken from GNU emacs)// for MV++// by Andrew Lumsdaine#include "qsort_double.h"#ifdef sparc#include <alloca.h>#endif// Invoke the < comparison function#define CMP(A,B) ((A) < (B))// swap two items//static inline void SWAP_double(double &A, double &B){    double tmp = A; A = B; B = tmp;} static inline void swap_int(int &a, int &b){    int tmp=a; a=b; b=tmp;}// This should be replaced by a standard ANSI macro.#define BYTES_PER_WORD 8/* The next 4 #defines implement a very fast in-line stack abstraction. */#define STACK_SIZE (BYTES_PER_WORD * sizeof (long))#define PUSH(LOW,HIGH) do {top->lo = LOW;top++->hi = HIGH;} while (0)#define POP(LOW,HIGH)  do {LOW = (--top)->lo;HIGH = top->hi;} while (0)#define STACK_NOT_EMPTY (stack < top)                /* Discontinue quicksort algorithm when partition gets below this size.   This particular magic number was chosen to work best on a Sun 4/260. */#define MAX_THRESH 4/* Stack node declarations used to store unfulfilled partition obligations. */typedef struct {  int lo;  int hi;} stack_node;/* Order size using quicksort.  This implementation incorporates   four optimizations discussed in Sedgewick:      1. Non-recursive, using an explicit stack of pointer that store the       next array partition to sort.  To save time, this maximum amount       of space required to store an array of MAX_INT is allocated on the       stack.  Assuming a 32-bit integer, this needs only 32 *       sizeof (stack_node) == 136 bits.  Pretty cheap, actually.   2. Chose the pivot element using a median-of-three decision tree.      This reduces the probability of selecting a bad pivot value and       eliminates certain extraneous comparisons.   3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving      insertion sort to order the MAX_THRESH items within each partition.        This is a big win, since insertion sort is faster for small, mostly      sorted array segments.      4. The larger of the two sub-partitions is always pushed onto the      stack first, with the algorithm then concentrating on the      smaller partition.  This *guarantees* no more than log (n)      stack size is needed (actually O(1) in this case)! */      int QSort(VECTOR_double& v, int base_ptr, int total_elems){  double pivot_buffer;    if (total_elems > MAX_THRESH) {        int lo = base_ptr;    int hi = lo + total_elems - 1;        stack_node stack[STACK_SIZE]; /* Largest size needed for 32-bit int!!! */    stack_node *top = stack + 1;        while (STACK_NOT_EMPTY) {      int left_ptr;      int right_ptr;      {    {      /* Select median value from among LO, MID, and HI. Rearrange         LO and HI so the three values are sorted. This lowers the          probability of picking a pathological pivot value and          skips a comparison for both the LEFT_PTR and RIGHT_PTR. */            int mid = lo + (hi - lo) / 2;            if (CMP (v[mid], v[lo]))        SWAP_double(v[mid], v[lo]);      if (CMP (v[hi], v[mid]))        SWAP_double(v[hi], v[mid]);      else         goto jump_over;            if (CMP (v[mid], v[lo]))        SWAP_double(v[mid], v[lo]);          jump_over:      pivot_buffer = v[mid];    }        left_ptr  = lo + 1;    right_ptr = hi - 1;        /* Here's the famous ``collapse the walls'' section of quicksort.         Gotta like those tight inner loops!  They are the main reason        that this algorithm runs much faster than others. */    do {      while (CMP (v[left_ptr], pivot_buffer))        left_ptr++;            while (CMP (pivot_buffer, v[right_ptr]))        right_ptr--;            if (left_ptr < right_ptr) {        SWAP_double(v[left_ptr], v[right_ptr]);        left_ptr++;        right_ptr--;      } else if (left_ptr == right_ptr) {        left_ptr ++;        right_ptr --;        break;      }    } while (left_ptr <= right_ptr);      }            /* Set up pointers for next iteration.  First determine whether     left and right partitions are below the threshold size. If so,      ignore one or both.  Otherwise, push the larger partition's     bounds on the stack and continue sorting the smaller one. */            if ((right_ptr - lo) <= MAX_THRESH) {    if ((hi - left_ptr) <= MAX_THRESH)      POP (lo, hi);     else      lo = left_ptr;      } else if ((hi - left_ptr) <= MAX_THRESH)    hi = right_ptr;      else if ((right_ptr - lo) > (hi - left_ptr)) {                       PUSH (lo, right_ptr);    lo = left_ptr;      } else {                       PUSH (left_ptr, hi);    hi = right_ptr;      }    }  }    /* Once the BASE_PTR array is partially sorted by quicksort the rest     is completely sorted using insertion sort, since this is efficient      for partitions below MAX_THRESH size. BASE_PTR points to the beginning      of the array to sort, and END_PTR points at the very last element in     the array (*not* one beyond it!). */  #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))  {    int end_ptr = base_ptr + total_elems - 1;    int run_ptr;    int tmp_ptr = base_ptr;    int thresh = MIN (end_ptr, base_ptr + MAX_THRESH);        for (run_ptr = tmp_ptr + 1; run_ptr <= thresh; run_ptr++)      if (CMP (v[run_ptr], v[tmp_ptr]))    tmp_ptr = run_ptr;        if (tmp_ptr != base_ptr)      SWAP_double(v[tmp_ptr], v[base_ptr]);        for (run_ptr = base_ptr + 1; (tmp_ptr = run_ptr += 1) <= end_ptr;) {            while (CMP (v[run_ptr], v[tmp_ptr -= 1]))    ;            if ((tmp_ptr += 1) != run_ptr) {    int trav;        for (trav = run_ptr + 1; --trav >= run_ptr;) {      double c;      c = v[trav];      int hi, lo;            for (hi = lo = trav; (lo -= 1) >= tmp_ptr; hi = lo)        v[hi] = v[lo];      v[hi] = c;    }      }    }  }  return 1;}int QSort(VECTOR_int & v, VECTOR_double& x, int base_ptr, int total_elems){  int pivot_buffer;  double pixot_buffer;    if (total_elems > MAX_THRESH) {        int lo = base_ptr;    int hi = lo + total_elems - 1;        stack_node stack[STACK_SIZE]; /* Largest size needed for 32-bit int!!! */    stack_node *top = stack + 1;        while (STACK_NOT_EMPTY) {      int left_ptr;      int right_ptr;      {    {      /* Select median value from among LO, MID, and HI. Rearrange         LO and HI so the three values are sorted. This lowers the          probability of picking a pathological pivot value and          skips a comparison for both the LEFT_PTR and RIGHT_PTR. */            int mid = lo + (hi - lo) / 2;            if (CMP (v[mid], v[lo])) {        swap_int (v[mid], v[lo]);        SWAP_double (x[mid], x[lo]);      }      if (CMP (v[hi], v[mid])) {        swap_int (v[hi], v[mid]);        SWAP_double (x[hi], x[mid]);      } else         goto jump_over;            if (CMP (v[mid], v[lo])) {        swap_int(v[mid], v[lo]);        SWAP_double (x[mid], x[lo]);      }          jump_over:      pivot_buffer = v[mid];      pixot_buffer = x[mid];    }        left_ptr  = lo + 1;    right_ptr = hi - 1;        /* Here's the famous ``collapse the walls'' section of quicksort.         Gotta like those tight inner loops!  They are the main reason        that this algorithm runs much faster than others. */    do {      while (CMP (v[left_ptr], pivot_buffer))        left_ptr++;            while (CMP (pivot_buffer, v[right_ptr]))        right_ptr--;            if (left_ptr < right_ptr) {        swap_int (v[left_ptr], v[right_ptr]);        SWAP_double (x[left_ptr], x[right_ptr]);        left_ptr++;        right_ptr--;      } else if (left_ptr == right_ptr) {        left_ptr ++;        right_ptr --;        break;      }    } while (left_ptr <= right_ptr);      }            /* Set up pointers for next iteration.  First determine whether     left and right partitions are below the threshold size. If so,      ignore one or both.  Otherwise, push the larger partition's     bounds on the stack and continue sorting the smaller one. */            if ((right_ptr - lo) <= MAX_THRESH) {    if ((hi - left_ptr) <= MAX_THRESH)      POP (lo, hi);     else      lo = left_ptr;      } else if ((hi - left_ptr) <= MAX_THRESH)    hi = right_ptr;      else if ((right_ptr - lo) > (hi - left_ptr)) {                       PUSH (lo, right_ptr);    lo = left_ptr;      } else {                       PUSH (left_ptr, hi);    hi = right_ptr;      }    }  }    /* Once the BASE_PTR array is partially sorted by quicksort the rest     is completely sorted using insertion sort, since this is efficient      for partitions below MAX_THRESH size. BASE_PTR points to the beginning      of the array to sort, and END_PTR points at the very last element in     the array (*not* one beyond it!). */  #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))  {    int end_ptr = base_ptr + total_elems - 1;    int run_ptr;    int tmp_ptr = base_ptr;    int thresh = MIN (end_ptr, base_ptr + MAX_THRESH);        for (run_ptr = tmp_ptr + 1; run_ptr <= thresh; run_ptr++)      if (CMP (v[run_ptr], v[tmp_ptr]))    tmp_ptr = run_ptr;        if (tmp_ptr != base_ptr) {      swap_int(v[tmp_ptr], v[base_ptr]);      SWAP_double (x[tmp_ptr], x[base_ptr]);    }        for (run_ptr = base_ptr + 1; (tmp_ptr = run_ptr += 1) <= end_ptr;) {            while (CMP (v[run_ptr], v[tmp_ptr -= 1]))    ;            if ((tmp_ptr += 1) != run_ptr) {    int trav;        for (trav = run_ptr + 1; --trav >= run_ptr;) {      int  c;      double d;      c = v[trav];      d = x[trav];      int hi, lo;            for (hi = lo = trav; (lo -= 1) >= tmp_ptr; hi = lo) {        v[hi] = v[lo];        x[hi] = x[lo];      }      v[hi] = c;      x[hi] = d;    }      }    }  }  return 1;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品视频第一区| 精品免费国产二区三区 | 国产九九视频一区二区三区| 欧美一个色资源| 蜜桃视频一区二区三区 | 欧美日韩在线电影| 偷窥国产亚洲免费视频| 日韩欧美另类在线| 精品亚洲国内自在自线福利| 国产视频一区不卡| 91色porny蝌蚪| 五月激情丁香一区二区三区| 日韩亚洲欧美一区二区三区| 国产成都精品91一区二区三| 亚洲色图一区二区三区| 欧美日韩精品欧美日韩精品| 美女网站在线免费欧美精品| 国产精品私人影院| 欧美日韩一区二区三区四区五区| 视频在线观看一区二区三区| 精品国产91乱码一区二区三区| 国产91精品久久久久久久网曝门| 亚洲视频在线一区观看| 9191精品国产综合久久久久久| 国产一区中文字幕| 亚洲三级免费观看| 欧美一区二区性放荡片| 国产91在线看| 亚洲mv大片欧洲mv大片精品| 精品精品国产高清一毛片一天堂| 成人av电影在线播放| 天堂一区二区在线免费观看| 亚洲国产精品精华液2区45| 在线免费观看不卡av| 久久99精品一区二区三区| 亚洲视频一区二区在线| 日韩一级片在线播放| 99国产精品久| 免费欧美在线视频| 亚洲女人****多毛耸耸8| 日韩美女视频一区二区在线观看| 99国产精品国产精品久久| 精品一区二区三区不卡 | 国产视频一区二区在线观看| 欧美久久久久久蜜桃| 成人av影视在线观看| 美女视频黄频大全不卡视频在线播放| 中文在线一区二区| 欧美不卡视频一区| 欧美日韩高清一区二区三区| 波多野结衣亚洲| 看国产成人h片视频| 亚洲国产中文字幕在线视频综合| 日本一区二区综合亚洲| 日韩欧美国产综合| 欧美日韩黄视频| 欧美在线视频日韩| 99国产麻豆精品| 成人av在线电影| 国产麻豆9l精品三级站| 久久精品久久精品| 男人操女人的视频在线观看欧美| 一区二区三区日韩在线观看| 中文文精品字幕一区二区| 精品日韩一区二区三区免费视频| 欧美三级电影在线看| 91免费小视频| 成人免费va视频| 成人国产亚洲欧美成人综合网| 国产精品一区二区在线观看网站 | 色天天综合色天天久久| 成人av免费在线播放| 成人h动漫精品| 成人av电影在线观看| 99免费精品在线| 91视频观看视频| 一本色道久久综合亚洲aⅴ蜜桃| 91小视频免费看| 色综合天天综合狠狠| 99久久久国产精品免费蜜臀| 99久久精品免费看国产| 91视频国产资源| 在线日韩一区二区| 欧美日精品一区视频| 欧美日韩三级一区二区| 91精品国产综合久久久久久久久久| 欧美日韩国产高清一区二区三区| 91精品国产免费久久综合| 91精品国产91久久综合桃花| 欧美一区二区久久| 精品福利一二区| 国产亚洲成aⅴ人片在线观看| 久久久不卡网国产精品二区| 国产欧美一区二区三区在线老狼| 国产精品沙发午睡系列990531| 国产精品免费免费| 一区二区三区欧美视频| 午夜激情一区二区三区| 久久国产视频网| 国产精品99久久久久久久女警| 成人av电影在线观看| 色婷婷激情久久| 欧美一区二区视频网站| 久久久不卡网国产精品一区| 亚洲视频在线一区观看| 日韩福利视频导航| 久久99精品一区二区三区三区| 成人午夜私人影院| 欧美在线啊v一区| 欧美一级片在线看| 欧美国产精品中文字幕| 一区二区三区免费看视频| 日本vs亚洲vs韩国一区三区二区| 国产成人免费av在线| 欧美性一二三区| 精品免费日韩av| 一区二区免费视频| 国产一区二区三区四| 91免费视频观看| 欧美va亚洲va香蕉在线| 国产精品国产自产拍在线| 午夜不卡av免费| 成人18视频日本| 日韩一区二区电影在线| 亚洲视频一区在线观看| 久草在线在线精品观看| 欧洲在线/亚洲| 国产欧美日韩麻豆91| 日韩av在线播放中文字幕| 成人av在线资源网站| 欧美大片一区二区| 亚洲综合精品自拍| 国产精品1区二区.| 91精品久久久久久久久99蜜臂| 综合久久给合久久狠狠狠97色| 久久99精品一区二区三区三区| 在线观看日韩国产| 中文字幕二三区不卡| 蜜臀91精品一区二区三区| 欧美性色aⅴ视频一区日韩精品| 国产欧美日韩麻豆91| 久久99久久久久| 欧美一区二区在线免费观看| 一区二区三区资源| 成人免费高清视频在线观看| 精品成人一区二区三区| 亚洲超碰97人人做人人爱| 色综合色狠狠天天综合色| 国产精品视频你懂的| 久久91精品国产91久久小草| 欧美日韩1区2区| 亚洲一区在线看| 91免费视频网| 亚洲你懂的在线视频| av电影一区二区| 国产精品全国免费观看高清 | 美女mm1313爽爽久久久蜜臀| 91国内精品野花午夜精品| 国产精品嫩草久久久久| 国产麻豆精品一区二区| 精品粉嫩超白一线天av| 久久不见久久见中文字幕免费| 制服丝袜亚洲精品中文字幕| 亚洲成在人线免费| 在线日韩一区二区| 亚洲国产精品精华液网站| 在线视频综合导航| 亚洲成在人线免费| 欧美一区中文字幕| 日韩精品亚洲一区二区三区免费| 欧美日韩国产系列| 奇米色一区二区| 欧美mv日韩mv| 麻豆中文一区二区| 久久久久9999亚洲精品| 成人永久免费视频| 亚洲欧美日韩人成在线播放| 色成人在线视频| 性做久久久久久| 欧美一卡二卡在线观看| 精品一区二区三区不卡| 中文字幕乱码亚洲精品一区| www.成人网.com| 夜色激情一区二区| 884aa四虎影成人精品一区| 欧美a级理论片| 国产日韩成人精品| 91亚洲男人天堂| 三级在线观看一区二区| 欧美精品一区二区久久婷婷| 国产成人一区二区精品非洲| 亚洲免费av高清| 制服丝袜av成人在线看| 国内精品伊人久久久久av一坑| 中文字幕av一区二区三区| 色网综合在线观看| 日本特黄久久久高潮| 欧美国产乱子伦 | 激情欧美一区二区三区在线观看| 国产亚洲污的网站|