subset

C++: Strict Weak Ordering

被刻印的时光 ゝ 提交于 2020-05-03 20:52:52
想讲讲C++ STL中各种算法都用到的一个概念,Strict Weak Ordering。 举个例子,来说明为什么写C++要知道这个东西。 假如你定义了一个类型 MyType ,而且这个类型是可比的(comparable,定义了 < 这个operator): struct MyType { int first; int second; MyType(int f,int s):first(f),second(s){} MyType(){ .... } bool operator < ( const MyType & b){ return a.first < b.first; } }; 现在一个 vector 里装着很多这种类型的对象,你想对这个 vector 排序: vector<MyType> vec { obj1,obj2,obj3 }; std::sort(vec.begin(),vec.end()); 之所以能用 std::sort() 来对任意类型排序,而不用给 std::sort() 传递规则,是因为 std::sort() 是默认采用 < 这个operator来排序的。 现在问题来了,只有 < 这个operator怎么知道两个对象是否相等? 简单来说就是,假如 !(a<b) && !(b<a) ,那么 a==b 但是,假如我没有为 MyType 定义 < 这个

WordPress 的 Google 字体问题解决办法

拟墨画扇 提交于 2020-05-03 15:09:57
在国内访问的时候,WordPress 里面引用的 google 字体可能会导致加载速度变得很慢。 要修改的地方有(我使用的版本是 4.0): wp-includes 里面的 script-loader.php 有一行: $open_sans_font_url = "//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets"; 你使用的主题里面的引用,以我用的 twentytwelve 主题为例: 在:wp-content/themes/twentytwelve/functions.php 里面有一行: $font_url = add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ); 把这些里面的 fonts.googleapis.com 替换成 fonts.useso.com。 但是我直接浏览器访问 fonts.useso.com 后发现这个服务是 360 做的。 。。。 如果不想依赖 360 的服务怎么办? Update: 现在只要使用 这个工具 可以直接打包下载字体,生成对应的 css 源码,放到服务器上即可。 我的解决方法是手动下载 .css

6D姿态估计从0单排——看论文的小鸡篇——Hashmod: A Hashing Method for Scalable 3D Object Detection

ε祈祈猫儿з 提交于 2020-04-30 21:12:26
To this end, we rely on an efficient representation of object views and employ hashing techniques to match these views against the input frame in a scalable way. Our approach to 3D object detection is based on 2D view-specific templates which cover the appearance of the objects over multiple viewpoints. Since viewpoints include the whole object, they can generally handle objects with poor visual features, however they have not been shown to scale well with the number of images so far . We apply hash functions to image descriptors computed over bounding boxes centered at each image location of

Proving decidability of subset in Agda

六月ゝ 毕业季﹏ 提交于 2020-04-30 02:37:33
问题 Suppose I have this definition of Subset in Agda Subset : ∀ {α} → Set α → {ℓ : Level} → Set (α ⊔ suc ℓ) Subset A {ℓ} = A → Set ℓ and I have a set data Q : Set where a : Q b : Q Is it possible to prove that all subset of q is decidable and why? Qs? : (qs : Subset Q {zero}) → Decidable qs Decidable is defined here: -- Membership infix 10 _∈_ _∈_ : ∀ {α ℓ}{A : Set α} → A → Subset A → Set ℓ a ∈ p = p a -- Decidable Decidable : ∀ {α ℓ}{A : Set α} → Subset A {ℓ} → Set (α ⊔ ℓ) Decidable as = ∀ a →

Proving decidability of subset in Agda

假如想象 提交于 2020-04-30 02:35:31
问题 Suppose I have this definition of Subset in Agda Subset : ∀ {α} → Set α → {ℓ : Level} → Set (α ⊔ suc ℓ) Subset A {ℓ} = A → Set ℓ and I have a set data Q : Set where a : Q b : Q Is it possible to prove that all subset of q is decidable and why? Qs? : (qs : Subset Q {zero}) → Decidable qs Decidable is defined here: -- Membership infix 10 _∈_ _∈_ : ∀ {α ℓ}{A : Set α} → A → Subset A → Set ℓ a ∈ p = p a -- Decidable Decidable : ∀ {α ℓ}{A : Set α} → Subset A {ℓ} → Set (α ⊔ ℓ) Decidable as = ∀ a →

(Java) LeetCode 416. Partition Equal Subset Sum —— 分割等和子集

為{幸葍}努か 提交于 2020-04-28 07:33:30
Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. Note: Each of the array element will not exceed 100. The array size will not exceed 200. Example 1: Input: [1, 5, 11, 5] Output: true Explanation: The array can be partitioned as [1, 5, 5] and [11]. Example 2: Input: [1, 2, 3, 5] Output: false Explanation: The array cannot be partitioned into equal sum subsets. 解法一: 一上来首先想到的并不是动态规划,而是广度优先搜索。首先观察一下题目,数组能被对半分的前提是数组元素和必须是偶数。那么本题就转化成了之前做过的一个问题,即 LeetCode 40. Combination Sum II ——

重写--全排列--全面理解搜索

六眼飞鱼酱① 提交于 2020-04-24 06:22:05
问题一:题意:输入一个整数n(n <= 9),输出1、2、3、······、n这n个数的全排列(按照字典序输出)。 方法1:暴力写法 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int main(){ 5 int n= 3 , a[ 20 ]; // 以n=3为例,以此类推 6 for ( int i= 0 ; i<n; i++)a[i]=i+ 1 ; // 初始化序列 7 8 for ( int i= 0 ; i<n; i++ ) 9 for ( int j= 0 ; j<n; j++ ) 10 if (i!= j) 11 for ( int k= 0 ; k<n; k++ ) 12 if (k!=i && k!= j) 13 // .... // 当n不等于3时以此类推 14 cout<<a[i]<< " " <<a[j]<< " " <<a[k]<< endl; 15 return 0 ; 16 } 方法2:搜索写法 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n, m; 4 int a[ 100 ]; 5 bool vis[ 100 ]; 6 void dfs( int x) 7 { 8 if (x> n){ 9 for ( int i= 1 ;

idl 批量裁剪代码

老子叫甜甜 提交于 2020-04-22 09:03:16
PRO Subset_via_shp_update COMPILE_OPT idl2 ENVI ,/restore_base_save_files envi_batch_init ,LOG_FILE='batch.log' ;打开要裁剪的图像 image_dir='F:\PDF\' ;根据文件存放的目录进行相应修改 image_files= file_search (image_dir,'*.tif',count=numfiles) ;根据相应的文件格式修改过滤条件 for i= 0 ,numfiles- 1 do begin image_file=image_files[i] print ,image_file if strlen (image_file) eq 0 then return ENVI_OPEN_FILE , image_file, r_fid=fid, /no_interactive_query, /no_realize IF fid EQ - 1 THEN RETURN ENVI_FILE_QUERY , fid, file_type=file_type, nl=nl, ns=ns,dims=dims,nb=nb ;打开shape文件 ;shapefile = DIALOG_PICKFILE(title='choose the SHP file:',filter

subset by at least two out of multiple conditions

隐身守侯 提交于 2020-04-21 05:49:40
问题 I found many questions dealing with subsetting by multiple conditions, but just couldn't find how to subset by at least two out of >2 conditions. This SO question deals with the same problem, but applies the same condition to all columns: Select rows with at least two conditions from all conditions My question is: How can I subset rows by at least two out of three different conditions? id<-c(1,2,3,4,5) V1<-c(2,4,4,9,7) V2<-c(10,20,20,30,20) V3<-c(0.7,0.1,0.5,0.2,0.9) df<-data.frame(cbind(id

subset by at least two out of multiple conditions

淺唱寂寞╮ 提交于 2020-04-21 05:48:57
问题 I found many questions dealing with subsetting by multiple conditions, but just couldn't find how to subset by at least two out of >2 conditions. This SO question deals with the same problem, but applies the same condition to all columns: Select rows with at least two conditions from all conditions My question is: How can I subset rows by at least two out of three different conditions? id<-c(1,2,3,4,5) V1<-c(2,4,4,9,7) V2<-c(10,20,20,30,20) V3<-c(0.7,0.1,0.5,0.2,0.9) df<-data.frame(cbind(id