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

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

?? sba_crsm.c

?? sba, a C/C++ package for generic sparse bundle adjustment is almost invariably used as the last step
?? C
字號:
///////////////////////////////////////////////////////////////////////////////////// ////  CRS sparse matrices manipulation routines////  Copyright (C) 2004-2008 Manolis Lourakis (lourakis at ics forth gr)////  Institute of Computer Science, Foundation for Research & Technology - Hellas////  Heraklion, Crete, Greece.////////  This program is free software; you can redistribute it and/or modify////  it under the terms of the GNU General Public License as published by////  the Free Software Foundation; either version 2 of the License, or////  (at your option) any later version.////////  This program is distributed in the hope that it will be useful,////  but WITHOUT ANY WARRANTY; without even the implied warranty of////  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the////  GNU General Public License for more details.///////////////////////////////////////////////////////////////////////////////////////#include <stdio.h>#include <stdlib.h>#include "sba.h"static void sba_crsm_print(struct sba_crsm *sm, FILE *fp);static void sba_crsm_build(struct sba_crsm *sm, int *m, int nr, int nc);/* allocate a sparse CRS matrix */void sba_crsm_alloc(struct sba_crsm *sm, int nr, int nc, int nnz){int msz;  sm->nr=nr;  sm->nc=nc;  sm->nnz=nnz;  msz=2*nnz+nr+1;  sm->val=(int *)malloc(msz*sizeof(int));  /* required memory is allocated in a single step */  if(!sm->val){    fprintf(stderr, "SBA: memory allocation request failed in sba_crsm_alloc() [nr=%d, nc=%d, nnz=%d]\n", nr, nc, nnz);    exit(1);  }  sm->colidx=sm->val+nnz;  sm->rowptr=sm->colidx+nnz;}/* free a sparse CRS matrix */void sba_crsm_free(struct sba_crsm *sm){  sm->nr=sm->nc=sm->nnz=-1;  free(sm->val);  sm->val=sm->colidx=sm->rowptr=NULL;}static void sba_crsm_print(struct sba_crsm *sm, FILE *fp){register int i;  fprintf(fp, "matrix is %dx%d, %d non-zeros\nval: ", sm->nr, sm->nc, sm->nnz);  for(i=0; i<sm->nnz; ++i)    fprintf(fp, "%d ", sm->val[i]);  fprintf(fp, "\ncolidx: ");  for(i=0; i<sm->nnz; ++i)    fprintf(fp, "%d ", sm->colidx[i]);  fprintf(fp, "\nrowptr: ");  for(i=0; i<=sm->nr; ++i)    fprintf(fp, "%d ", sm->rowptr[i]);  fprintf(fp, "\n");}/* build a sparse CRS matrix from a dense one. intended to serve as an example for sm creation */static void sba_crsm_build(struct sba_crsm *sm, int *m, int nr, int nc){int nnz;register int i, j, k;  /* count nonzeros */  for(i=nnz=0; i<nr; ++i)    for(j=0; j<nc; ++j)      if(m[i*nc+j]!=0) ++nnz;  sba_crsm_alloc(sm, nr, nc, nnz);  /* fill up the sm structure */  for(i=k=0; i<nr; ++i){    sm->rowptr[i]=k;    for(j=0; j<nc; ++j)      if(m[i*nc+j]!=0){        sm->val[k]=m[i*nc+j];        sm->colidx[k++]=j;      }  }  sm->rowptr[nr]=nnz;}/* returns the index of the (i, j) element. No bounds checking! */int sba_crsm_elmidx(struct sba_crsm *sm, int i, int j){register int low, high, mid, diff;  low=sm->rowptr[i];  high=sm->rowptr[i+1]-1;  /* binary search for finding the element at column j */  while(low<=high){    /* following early termination test seems to actually slow down the search */    //if(j<sm->colidx[low] || j>sm->colidx[high]) return -1; /* not found */        /* mid=low+((high-low)>>1) ensures no index overflows */    mid=(low+high)>>1; //(low+high)/2;    diff=j-sm->colidx[mid];    if(diff<0)      high=mid-1;    else if(diff>0)      low=mid+1;    else      return mid;  }  return -1; /* not found */}/* similarly to sba_crsm_elmidx() above, returns the index of the (i, j) element using the * fact that the index of element (i, jp) was previously found to be jpidx. This can be * slightly faster than sba_crsm_elmidx(). No bounds checking! */int sba_crsm_elmidxp(struct sba_crsm *sm, int i, int j, int jp, int jpidx){register int low, high, mid, diff;  diff=j-jp;  if(diff>0){    low=jpidx+1;    high=sm->rowptr[i+1]-1;  }  else if(diff==0)    return jpidx;  else{ /* diff<0 */    low=sm->rowptr[i];    high=jpidx-1;  }  /* binary search for finding the element at column j */  while(low<=high){    /* following early termination test seems to actually slow down the search */    //if(j<sm->colidx[low] || j>sm->colidx[high]) return -1; /* not found */        /* mid=low+((high-low)>>1) ensures no index overflows */    mid=(low+high)>>1; //(low+high)/2;    diff=j-sm->colidx[mid];    if(diff<0)      high=mid-1;    else if(diff>0)      low=mid+1;    else      return mid;  }  return -1; /* not found */}/* returns the number of nonzero elements in row i and * fills up the vidxs and jidxs arrays with the val and column * indexes of the elements found, respectively. * vidxs and jidxs are assumed preallocated and of max. size sm->nc */int sba_crsm_row_elmidxs(struct sba_crsm *sm, int i, int *vidxs, int *jidxs){register int j, k;  for(j=sm->rowptr[i], k=0; j<sm->rowptr[i+1]; ++j, ++k){    vidxs[k]=j;    jidxs[k]=sm->colidx[j];  }  return k;}/* returns the number of nonzero elements in col j and * fills up the vidxs and iidxs arrays with the val and row * indexes of the elements found, respectively. * vidxs and iidxs are assumed preallocated and of max. size sm->nr */int sba_crsm_col_elmidxs(struct sba_crsm *sm, int j, int *vidxs, int *iidxs){register int *nextrowptr=sm->rowptr+1;register int i, l;register int low, high, mid, diff;  for(i=l=0; i<sm->nr; ++i){    low=sm->rowptr[i];    high=nextrowptr[i]-1;    /* binary search attempting to find an element at column j */    while(low<=high){      //if(j<sm->colidx[low] || j>sm->colidx[high]) break; /* not found */      mid=(low+high)>>1; //(low+high)/2;      diff=j-sm->colidx[mid];      if(diff<0)        high=mid-1;      else if(diff>0)        low=mid+1;      else{ /* found */        vidxs[l]=mid;        iidxs[l++]=i;        break;      }    }  }  return l;}/* a more straighforward (but slower) implementation of the above function *//***int sba_crsm_col_elmidxs(struct sba_crsm *sm, int j, int *vidxs, int *iidxs){register int i, k, l;  for(i=l=0; i<sm->nr; ++i)    for(k=sm->rowptr[i]; k<sm->rowptr[i+1]; ++k)      if(sm->colidx[k]==j){        vidxs[l]=k;        iidxs[l++]=i;      }  return l;}***/#if 0/* returns 1 if there exists a row i having columns j and k, * i.e. a row i s.t. elements (i, j) and (i, k) are nonzero; * 0 otherwise */ int sba_crsm_common_row(struct sba_crsm *sm, int j, int k){register int i, low, high, mid, diff;  if(j==k) return 1;  for(i=0; i<sm->nr; ++i){    low=sm->rowptr[i];    high=sm->rowptr[i+1]-1;    if(j<sm->colidx[low] || j>sm->colidx[high] || /* j not found */       k<sm->colidx[low] || k>sm->colidx[high])   /* k not found */      continue;    /* binary search for finding the element at column j */    while(low<=high){      mid=(low+high)>>1; //(low+high)/2;      diff=j-sm->colidx[mid];      if(diff<0)        high=mid-1;      else if(diff>0)        low=mid+1;      else        goto jfound;    }    continue; /* j not found */jfound:    if(j>k){      low=sm->rowptr[i];      high=mid-1;    }    else{      low=mid+1;      high=sm->rowptr[i+1]-1;    }    if(k<sm->colidx[low] || k>sm->colidx[high]) continue; /* k not found */    /* binary search for finding the element at column k */    while(low<=high){      mid=(low+high)>>1; //(low+high)/2;      diff=k-sm->colidx[mid];      if(diff<0)        high=mid-1;      else if(diff>0)        low=mid+1;      else /* found */        return 1;    }  }  return 0;}#endif#if 0/* sample code using the above routines */main(){int mat[7][6]={    {10, 0, 0, 0, -2, 0},    {3,  9, 0, 0,  0, 3},    {0,  7, 8, 7,  0, 0},    {3,  0, 8, 7,  5, 0},    {0,  8, 0, 9,  9, 13},    {0,  4, 0, 0,  2, -1},    {3,  7, 0, 9,  2, 0}};struct sba_crsm sm;int i, j, k, l;int vidxs[7], /* max(6, 7) */    jidxs[6], iidxs[7];  sba_crsm_build(&sm, mat[0], 7, 6);  sba_crsm_print(&sm, stdout);  for(i=0; i<7; ++i){    for(j=0; j<6; ++j)      printf("%3d ", ((k=sba_crsm_elmidx(&sm, i, j))!=-1)? sm.val[k] : 0);    printf("\n");  }  for(i=0; i<7; ++i){    k=sba_crsm_row_elmidxs(&sm, i, vidxs, jidxs);    printf("row %d\n", i);    for(l=0; l<k; ++l){      j=jidxs[l];      printf("%d %d  ", j, sm.val[vidxs[l]]);     }    printf("\n");  }  for(j=0; j<6; ++j){    k=sba_crsm_col_elmidxs(&sm, j, vidxs, iidxs);    printf("col %d\n", j);    for(l=0; l<k; ++l){      i=iidxs[l];      printf("%d %d  ", i, sm.val[vidxs[l]]);     }    printf("\n");  }  sba_crsm_free(&sm);}#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久亚洲欧洲日产国码αv| 激情小说欧美图片| 美女国产一区二区| 99久久精品国产导航| 欧美一区二区三区精品| 中文字幕一区二区在线观看| 日本大胆欧美人术艺术动态| 91看片淫黄大片一级在线观看| 久久综合久久综合亚洲| 亚洲va欧美va国产va天堂影院| 波多野洁衣一区| 亚洲精品在线观看网站| 日本午夜一区二区| 欧美日韩另类一区| 亚洲综合图片区| 91亚洲精品一区二区乱码| 国产日韩精品一区| 韩国欧美一区二区| 日韩一级大片在线观看| 午夜久久久久久久久久一区二区| 色综合咪咪久久| 亚洲免费伊人电影| 99国产精品久久久久久久久久久| 国产午夜亚洲精品不卡| 国产麻豆成人精品| 久久亚区不卡日本| 国产成人av影院| 国产欧美日韩亚州综合| 国产黄人亚洲片| 欧美经典三级视频一区二区三区| 国产乱码字幕精品高清av | a级精品国产片在线观看| 精品国产电影一区二区| 国产真实乱子伦精品视频| 日韩精品自拍偷拍| 韩国成人精品a∨在线观看| 2021久久国产精品不只是精品| 激情图区综合网| 欧美国产欧美综合| 99精品视频在线观看免费| 亚洲色图19p| 欧美性受xxxx黑人xyx| 亚洲123区在线观看| 欧美一区二区在线免费观看| 久久99热99| 欧美国产精品一区二区三区| 99精品久久只有精品| 亚洲综合色自拍一区| 这里只有精品99re| 美女精品一区二区| 国产精品污污网站在线观看| 91在线小视频| 亚洲成人高清在线| 精品日产卡一卡二卡麻豆| 国产一区二三区| 亚洲视频免费看| 欧美肥妇毛茸茸| 国产一区二区三区免费播放| 亚洲国产精品精华液2区45| aaa欧美大片| 日韩黄色小视频| 国产三级久久久| 欧美亚洲一区二区在线| 激情综合五月婷婷| 亚洲精品精品亚洲| 欧美成人福利视频| 色综合久久久久综合| 蜜桃av一区二区| 亚洲视频图片小说| 精品久久久久一区| 色婷婷狠狠综合| 韩国av一区二区三区四区| 亚洲欧美日本韩国| 久久亚区不卡日本| 91精品欧美一区二区三区综合在| 成人久久视频在线观看| 免费在线观看精品| 一区二区三区四区五区视频在线观看| 日韩精品一区二| 在线免费观看日韩欧美| 国产成人午夜视频| 日本美女视频一区二区| 一区二区三区中文字幕精品精品| 日韩免费高清视频| 欧美性生交片4| caoporn国产一区二区| 狠狠色伊人亚洲综合成人| 一区二区欧美国产| 国产精品情趣视频| 久久久无码精品亚洲日韩按摩| 欧美日韩一区国产| 91视频一区二区三区| 国产精品一区二区视频| 日本欧洲一区二区| 香蕉av福利精品导航 | 91精品国产欧美一区二区18| 91同城在线观看| 成人精品视频.| 国内精品不卡在线| 男女男精品网站| 日本vs亚洲vs韩国一区三区二区 | 欧美成人vps| 日韩欧美在线123| 在线电影欧美成精品| 欧美亚洲一区二区在线| av综合在线播放| 96av麻豆蜜桃一区二区| 懂色av中文字幕一区二区三区 | 日韩免费视频一区| 91麻豆精品国产91久久久使用方法 | 亚洲精品视频在线看| 中文字幕 久热精品 视频在线 | 欧美日韩一区不卡| 欧美日韩一区高清| 欧美肥胖老妇做爰| 日韩午夜激情视频| 久久亚洲综合色一区二区三区| 日韩一本二本av| 精品福利一区二区三区| 精品国内片67194| 国产精品美女www爽爽爽| 国产亚洲一区字幕| 国产精品视频免费| 亚洲人成网站精品片在线观看| 亚洲欧洲日产国码二区| 夜夜精品浪潮av一区二区三区| 亚洲精品视频一区二区| 亚洲成人免费观看| 青娱乐精品在线视频| 狠狠狠色丁香婷婷综合久久五月| 国产在线精品一区二区夜色 | 日本美女一区二区三区视频| 蜜桃精品视频在线| 国产成人精品免费在线| 色老头久久综合| 91精品婷婷国产综合久久性色| 亚洲精品在线一区二区| 中文字幕一区二| 亚洲成av人片| 国产精品影音先锋| 色婷婷亚洲婷婷| 精品少妇一区二区三区在线播放| www国产亚洲精品久久麻豆| 1024成人网| 日韩中文字幕麻豆| 国产福利91精品一区二区三区| 91视视频在线直接观看在线看网页在线看 | 欧美三级韩国三级日本三斤| 日韩欧美中文字幕精品| 国产精品九色蝌蚪自拍| 日韩国产欧美在线视频| 风间由美一区二区av101 | 亚洲1区2区3区视频| 国产在线观看免费一区| 欧日韩精品视频| 久久网这里都是精品| 亚洲曰韩产成在线| 国产河南妇女毛片精品久久久| 日韩午夜激情av| 亚洲国产经典视频| 日本伊人午夜精品| 99riav一区二区三区| 精品久久久久久久一区二区蜜臀| |精品福利一区二区三区| 蜜乳av一区二区三区| 91女神在线视频| 国产视频911| 免费观看成人av| 欧亚一区二区三区| 中文字幕一区日韩精品欧美| 蜜臀精品久久久久久蜜臀| 色欧美乱欧美15图片| 精品国产污污免费网站入口 | 国产蜜臀97一区二区三区| 日韩激情一二三区| 欧美在线三级电影| 亚洲色图在线看| 国产91精品精华液一区二区三区| 欧美日本免费一区二区三区| 亚洲色大成网站www久久九九| 国产一区二区三区日韩| 日韩你懂的在线播放| 日韩高清在线一区| 欧美日韩国产片| 亚洲午夜精品在线| 色婷婷一区二区三区四区| 国产精品视频第一区| 福利一区二区在线观看| 精品国产91亚洲一区二区三区婷婷| 天天色天天爱天天射综合| 日本久久电影网| 一区二区三区四区视频精品免费| 99视频在线观看一区三区| 中文字幕免费观看一区| 国产成人精品在线看| 欧美国产日韩亚洲一区| 国产99久久久国产精品| 国产精品视频九色porn| 成人av网址在线观看| 国产精品黄色在线观看|