当前位置: 首页 > news >正文

电商网站首页图片切换怎么做的科技型中小企业认定条件

电商网站首页图片切换怎么做的,科技型中小企业认定条件,下载wordpress 5.2.1,wordpress page 单页汉明权重#xff08;Hamming Weight#xff09;#xff08;统计数据中1的个数#xff09;VP-SWAR算法 定义 汉明重量是一串符号中非零符号的个数。它等于同样长度的全零符号串的汉明距离(在信息论中#xff0c;两个等长字符串之间的汉明距离等于两个字符串对应位置的不同…汉明权重Hamming Weight统计数据中1的个数VP-SWAR算法 定义 汉明重量是一串符号中非零符号的个数。它等于同样长度的全零符号串的汉明距离(在信息论中两个等长字符串之间的汉明距离等于两个字符串对应位置的不同字符的个数)。 汉明重量在常见的数据位符号串中它是1的个数。 算法思想 基于分治的算法将n位二进制进行分组通过一系列位移和位运算操作可以在常数时间内计算多个字节的汉明重量并且不需要使用额外的内存。 简化示例 假设一个8bit的2进制串 xabcd,efgh其中a-b 属于{0,1} 求解的输出是 ans abcdefgh step1. 2bits m1 0101 0101 xm1 0b0d 0f0h (x1)m1 0a0c 0e0g 求和得到[ab]_2[cd]_2 [ef]_2[gh]_2这里[x]_2表示2位二进制中1的个数 step2. 4bits m2 0011 0011 xm2 00[cd]_2 00[gh]_2 (x2)m2 00[ab]_2 00[ef]_2 求和得到[abcd]_4 [efgh]_4 step3. 8bits m4 0000 1111 xm4 0000 [efgh]_4 (x4)m4 0000 [abcd]_4 求和得到 [abcdefgh]_8 对应的十进制值就是最终的答案 算法实现 variable-precision SWAR算法 const uint64_t m1 0x5555555555555555; //binary: 0101... const uint64_t m2 0x3333333333333333; //binary: 00110011.. const uint64_t m4 0x0f0f0f0f0f0f0f0f; //binary: 4 zeros, 4 ones ... const uint64_t m8 0x00ff00ff00ff00ff; //binary: 8 zeros, 8 ones ... const uint64_t m16 0x0000ffff0000ffff; //binary: 16 zeros, 16 ones ... const uint64_t m32 0x00000000ffffffff; //binary: 32 zeros, 32 ones const uint64_t h01 0x0101010101010101; //the sum of 256 to the power of 0,1,2,3...//This is a naive implementation, shown for comparison, //and to help in understanding the better functions. //This algorithm uses 24 arithmetic operations (shift, add, and). // 朴素算法 int popcount64a(uint64_t x) {x (x m1 ) ((x 1) m1 ); //put count of each 2 bits into those 2 bits x (x m2 ) ((x 2) m2 ); //put count of each 4 bits into those 4 bits x (x m4 ) ((x 4) m4 ); //put count of each 8 bits into those 8 bits x (x m8 ) ((x 8) m8 ); //put count of each 16 bits into those 16 bits x (x m16) ((x 16) m16); //put count of each 32 bits into those 32 bits x (x m32) ((x 32) m32); //put count of each 64 bits into those 64 bits return x; } 详细步骤 优化算法 //This is better when most bits in x are 0 //This algorithm works the same for all data sizes. //This algorithm uses 3 arithmetic operations and 1 comparison/branch per 1 bit in x. // 适用于0比较多的数 // 数字 n中最低位的 1 总是对应 n - 1 中的 0 // 将 n 和 n - 1 进行与运算总是能把 n 中最低位的 1 变成 0并保持其他位不变 int popcount64d(uint64_t x) {int count;for (count0; x; count)x x - 1;return count; }// 常用写法 int hammingWeight(uint32_t n) {int count 0;while( n ){count ;n n-1;}return count; }// 查表法 用空间换时间 从而得到O(1)的最优算法 // 以4bit的串为例可以构造一个数组int counts[16]{0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4}. // 对于4bit的x, x的hamming weight为counts[x]. static unsigned char wordbits[65536] { bitcounts of ints between 0 and 65535 }; static int popcount(uint32 i) {return (wordbits[i0xFFFF] wordbits[i16]); } 参考 Hamming weight WIKI 汉明权重(hamming weight) ----- 计算数据位中1的个数
http://www.pierceye.com/news/664708/

相关文章:

  • 网站建设中页面设计广告策划书籍
  • 云南省建设工程投标中心网站网页的制作步骤是什么
  • 保定网站设计概述更换动易网站模板的方法
  • 新手如何注册网站域名做 理财网站有哪些
  • 南宁快速建站模板企业网站的开发与应用
  • 网站运营适合什么样的人做企业宣传及介绍ppt
  • 怎么样网站开源小升初在线做试卷的网站
  • 中国建设银行章丘支行网站网站排版设计欣赏
  • 儿童摄影网站建设专业做网站制作自助建站系统
  • 注册做网站的公司有哪些wordpress 4.1 下载
  • 用ps做美食网站一个网站多少钱?
  • 网站建设 试题揭阳专业做网站公司
  • 手机上怎么创建自己的网站河南企业网站优化
  • 定陶区城乡和住房建设局网站新手怎么做网站
  • 工商银行与建设银行网站对比石嘴山网站seo
  • seo快速建站自学程序员的步骤
  • 做旅行网站的依据及意义如何制作自己想要的图片
  • 电子商务网站怎么做网站建设企业建站哪家好?来这里看看
  • 网站备案电话号码购物商城网站建设方案
  • 手机商城系统徐州seo计费管理
  • 西安网站公司哪家好信息推广的方式有哪些
  • 网站开发注意的事项商丘网站制作软件
  • 51zwd一起做网站广州广东省网站备案查询
  • 如何生成一个网站自己弄公司网站
  • 企业信用信息查询网官网孝感网站seo
  • 中淼建设工程有限公司网站分类用wordpress
  • 腾讯建设网站首页做销售网站
  • 推广引流网站聚名网注册
  • 原来做网站后来跑国外了多伦多网站建设多少钱
  • 手机建站平台做母婴网站设计思路