|
| ̤²ò·è |
| ²ò·è |
| Ää»ß |
| ºï½üÍ×ÀÁ |
|
2013/6/13(Thu) 19:51:07|NO.54863
²¼¤Î¤è¤¦¤Ê¥×¥í¥°¥é¥à¤ò¹â®²½¤¹¤ëÊýË¡¤ò¶µ¤¨¤Æ¤¯¤À¤µ¤¤¡£
¡Ê¥×¥í¥°¥é¥à¤Ï°ìÉô¾Êά¤·¤Æ´Êά²½¤·¤Æ¤¤¤Þ¤¹¡£¡Ë db(0) = "010101010101" // ¼ÂºÝ¤Ï12¼¡¸µ¤Ç¤Ï¤Ê¤¯256¼¡¸µ¤Î¥Ù¥¯¥È¥ë
db(1) = "000000101101"
db(2) = "000011011100"
// (¾Êά)
db(15000) = "011110111111"
query = "001101110111"
repeat length(db)
title "" + cnt
target = db(cnt)
dist = 0
repeat 12
if strmid(query, cnt, 1) != strmid(target, cnt, 1) : dist++
loop
if dist <= 3 : mes target + " : " + dist
loop ¤³¤Î¥×¥í¥°¥é¥à¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÃ椫¤é¥¯¥¨¥ê¤È¤Ê¤ë¥Ù¥¯¥È¥ë¤È¤Î¥Ï¥ß¥ó¥°µ÷Î¥¤¬
°ìÄê°Ê²¼¤Î¤â¤Î¤òÎóµó¤¹¤ë¥×¥í¥°¥é¥à¤Ç¤¹¡£
¼ÂºÝ¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë¤Ï15000¥Ù¥¯¥È¥ë¤¬³ÊǼ¤µ¤ì¤Æ¤¤¤Æ¥Ù¥¯¥È¥ë¤Ï256¼¡¸µ¤Ç¤¹¡£
¾å¤Î¥×¥í¥°¥é¥à¤ÏÁíÅö¤ê¤ò¤·¤Æ¤¤¤ë¤Î¤Ç¤È¤Æ¤âÃÙ¤¤¤Ç¤¹¡£
¤³¤ì¤ò²þÁ±¤¹¤ëÊýË¡¡Ê¥Ç¡¼¥¿¹½Â¤¤È¤«¡Ë¤ò¶µ¤¨¤Æ¤¯¤À¤µ¤¤¡£
LSH¤Ï»î¤·¤Þ¤·¤¿¤¬¡¢¼Â¥Ç¡¼¥¿¤Ç¤ÏÊФ꤬¤¢¤ë¤è¤¦¤Ç¤¢¤Þ¤ê®¤¯¤Ê¤ê¤Þ¤»¤ó¡£
kdÌڤϥǡ¼¥¿¿ô¤È¥Ç¡¼¥¿¤Î¼¡¸µ¤«¤é¤¢¤Þ¤ê¸úΨ¤Ï¾å¤¬¤é¤Ê¤¤¤è¤¦¤Ç¤¹¡£
|
|
2013/6/13(Thu) 20:17:48|NO.54865
£²¿Ê¿ô¤ò£±£¶¿Ê¿ô¤ËÊÑ´¹¤·¤Æ£Ø£Ï£Ò¡£
|
|
2013/6/13(Thu) 20:41:04|NO.54866
>£²¿Ê¿ô¤ò£±£¶¿Ê¿ô¤ËÊÑ´¹¤·¤Æ£Ø£Ï£Ò¡£
»ä¤Î¼ÁÌä¤Î¤·¤«¤¿¤¬¤Þ¤º¤«¤Ã¤¿¤è¤¦¤Ç¤¹¡£
ÃΤꤿ¤«¤Ã¤¿¤Î¤Ïµ÷Î¥¤Î·×»»¤Î¹â®²½¤Ç¤Ï¤Ê¤¯¡¢·×»»¤·¤Ê¤±¤ì¤Ð¤¤¤±¤Ê¤¤¥Ú¥¢¿ô¤Îºï¸º¤Î»ÅÊý¤Ç¤¹¡£
LSH¤È¤«kd-tree¤Ïµ÷Î¥¤¬¶á¤¯¤Ê¤ê¤½¤¦¤Ê¤â¤Î¤Î¸¡Æ¤¤ò¤Ä¤±¤ëÌÜŪ¤Ë»È¤¦¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
|
|
2013/6/13(Thu) 20:58:39|NO.54867
¥Ú¥¢¿ô¤Îºï¸º¤Î»ÅÊý¤Ï¡¢HSP¤È¤Ï´Ø·¸¤¬¤Ê¤¤¤Î¤Ç¤Ï¤Ê¤¤¤Ç¤·¤ç¤¦¤«¡£Â¾¤Î¾ì½ê¤Çʹ¤¯¤È¤è¤ê¾Ü¤·¤¤¿Í¤«¤éÅú¤¨¤¬¤â¤é¤¨¤ë¤È»×¤¤¤Þ¤¹¡£
¤³¤Î¤è¤¦¤ÊÂçÎ̤νèÍý¤ò¹Ô¤¦¾ì¹ç¤Ï¡¢HSP¤Ï¥¤¥ó¥¿¥×¥ê¥¿¤Ê¤Î¤ÇC¤Ê¤É¤Çºî¤Ã¤¿¾ì¹ç¤ËÈæ¤Ù¤ÆÃÙ¤µ¤¬ÌÜΩ¤Á¤Þ¤¹¤«¤é¡¢Â¾¤Î¸À¸ì¤ò»È¤¦¤³¤È¤â¸¡Æ¤¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡£
HSP¤Ç¹Ô¤¦¾ì¹ç¤Ï¡¢·×»»¤Î¹â®²½¤ÏKD¤µ¤ó¤ÎÊýË¡¤¬¤è¤¤¤Ç¤·¤ç¤¦¡£1¤Ä¤Î¥Ç¡¼¥¿¤¬256bit¤Ê¤é¤Ðsdim¤ÇÇÛÎó¤ò³ÎÊݤ·¤Æ¡¢32bit¤º¤ÄÀÚ¤ê½Ð¤·¤Æxor¤¹¤ë¤Î¤¬¤¤¤¤¤«¤È»×¤¤¤Þ¤¹¡£
¤Þ¤¿¡¢strmid¤Ê¤Éʸ»úÎó½èÍý¤ÏHSP¤Ç¤ÏÃÙ¤¤¤Ç¤¹¤«¤é¡¢peek¤ò»È¤Ã¤Æ¤ß¤Æ¤â¾¯¤·²þÁ±¤¹¤ë¤È»×¤¤¤Þ¤¹¡£
|
|
2013/6/13(Thu) 21:06:08|NO.54869
>¾å¤Î¥×¥í¥°¥é¥à¤ÏÁíÅö¤ê¤ò¤·¤Æ¤¤¤ë¤Î¤Ç¤È¤Æ¤âÃÙ¤¤¤Ç¤¹¡£
NO.54863¤¬ÃÙ¤¤°ìÈ֤θ¶°ø¤ÏtitleÌ¿Îá
titleÊѹ¹¤Ï1ms¶á¤¯»þ´Ö³Ý¤«¤ë
|
|
2013/6/13(Thu) 21:12:21|NO.54871
¤Þ¤ºÀè¤Ë¡¡¼«Ê¬¤Ï¤³¤¦¤¤¤¦¤Ê¤ó¤Á¤ã¤éË¡¤È¤«¤Î¥¢¥ë¥´¥ê¥º¥à¤ÏÁ´¤¯ÃΤê¤Þ¤»¤ó
HSP¤Ï·×»»Â®Å٤⾤θÀ¸ì¤ËÈæ¤Ù¤ÆÃÙ¤á¤Ê¤Î¤Ç¡û¡ûË¡¤ò»È¤Ã¤¿¤È¤·¤Æ¤½¤³¤Þ¤ÇÁ᤯¤Ê¤ëµ¤¤¬¤·¤Þ¤»¤ó
moe¤µ¤ó¤Î½ñ¤«¤ì¤Æ¤¤¤ëÊýË¡¤Ç¡¢256¼¡¸µ¤Ç5001¥Ù¥¯¥È¥ë¤Î½èÍý»þ´Ö¤Ï626ms¤Ç¤·¤¿
title¤Èmes¤Ï½ü¤¤Þ¤·¤¿
dim query_,256
repeat 256
query_ = peek(query,cnt)
loop
repeat length(db)
target = db(cnt)
dist = 0
repeat 256
if query_.cnt != peek(target,cnt) : dist++
loop
loop
¤À¤È204ms¤Ë¤Ê¤ê¤Þ¤¹
ÁíÅö¤ê¤È¤¤¤¨¤ÐÁíÅö¤ê¤Ç¤¹¤¬¡¢°ì±þ·×»»Î̤ÏȾʬ¤Ç®ÅÙ¤Ï3ÇܤǤ¹
ÁíÅö¤ê¤Ç¤âÁíÅö¤ê¤ÎºÇŬ²½¤È¤¤¤¦¤Î¤â꤫ͤ¤Ê¤È»×¤¤¤Þ¤¹
|
|
2013/6/13(Thu) 21:59:13|NO.54879
ï¤âÌäÂê¤ÎËܼÁ¤¬¸«¤¨¤Æ¤Ê¤¤¤È¤«¡¦¡¦¡¦
¼ÁÌä¼Ô¤µ¤ó¤ÏÀäÂÐŪ¤Ê·×»»»þ´Ö¤¸¤ã¤Ê¤¯¥ª¡¼¥À¡¼¤ÎÏäò¤·¤Æ¤ë¤Î¤ËÁ´¤¯Åª³°¤ì¤Ê²óÅú¤·¤«¤Ê¤¤¤Í¡£
¤Ç¡¢¼ÁÌä¤Ë´Ø¤¹¤ë²óÅú¤À¤±¤ÉSB-LSH¤ò»î¤·¤Æ¤Ê¤¤¤Ê¤é»î¤·¤Æ¤ß¤ë¤Î¤â¤¤¤¤¤ó¤¸¤ã¤Ê¤¤¤«¤Ê¡£
|
|
2013/6/13(Thu) 22:13:24|NO.54880
·«¤êÊÖ¤·¤Ë¤Ê¤ê¤Þ¤¹¤¬¡¢ÀäÂÐŪ¤Ê·×»»»þ´Ö¤Ç¤Ï¤Ê¤¯¥ª¡¼¥À¡¼¤ÎÏäò¤·¤¿¤¤¤Ê¤é¤½¤â¤½¤â¤³¤Î·Ç¼¨ÈĤËÅê¹Æ¤¹¤ë¤Î¤¬Åª³°¤ì¤Ê¤Î¤Ç¡¢¤³¤Î¤è¤¦¤Ê²óÅú¤¬¤Ä¤¯¤Î¤ÏÅöÁ³¤Ç¤Ï¤Ê¤¤¤«¤È»×¤¤¤Þ¤¹¡£
ÍýÏÀŪ¤Ë¤Ï¥ª¡¼¥À¡¼¤òµ¤¤Ë¤¹¤ë¤Î¤¬½ÅÍפʤΤÏʬ¤«¤ê¤Þ¤¹¤¬¡¢¼ÂºÝ¤Ë¥×¥í¥°¥é¥à¤òÆ°¤«¤½¤¦¤È¤·¤¿¤é¡¢ÀäÂÐŪ¤Ê·×»»»þ´Ö¤Î¤Û¤¦¤â½ÅÍפʤΤǤ¹¡£
|
|
2013/6/15(Sat) 01:02:19|NO.54896
¥¯¥¨¥ê¡©¥Ï¥ß¥ó¥°µ÷Î¥¡©¥ª¡¼¥À¡¼¡©¤È¤¤¤Ã¤¿¾õÂ֤Ǥ¹¤Î¤Ç
¸«Åö°ã¤¤¤Ê²óÅú¤Ç¤·¤¿¤é¤´¤á¤ó¤Ê¤µ¤¤¡£
¥½¡¼¥È½ç¤Ë¸¡ºº¤·¤Æ¹Ô¤¡¢Áê°ã²Õ½ê¤¬ïçÃͰʾå¤Ê¤é¤½¤Î¾ì½ê¤ÈÃͤòÊÝ»ý¡£
°Ê¹ß¤½¤ÎÃͤËÊѲ½¤¬¤¢¤ëËø¤É¤ó¤É¤ó¥¹¥¥Ã¥×¤¹¤ë¤È¤¤¤¦¤Î¤Ï¤É¤¦¤Ç¤·¤ç¤¦¤«¡©
¸ú²Ì¤ÏÈù̯¡¢ïçÃͤȥ٥¯¥È¥ë¤ä¼¡¸µ¿ô¤È¤ÎÈæΨ¤¬¤«¤Ê¤ê¹â¤¯¤Ê¤¤¤ÈµÕ¸ú²Ì¡£
»ß¤á¤Ë¥½¡¼¥È½èÍý¼«ÂΤ˶²¤í¤·¤¯»þ´Ö¤¬³Ý¤«¤ê¤Þ¤¹¤±¤É¡Ä
#const dD 24 ;¼¡¸µ¿ô?
#const dL $4000 ;¥Ù¥¯¥È¥ë¿ô?
#const distout 4 ;¥Ï¥ß¥ó¥°µ÷Î¥?ïçÃÍ (¥Ï¥º¥ì¤Ë¤¹¤ëÁê°ã¿ô)
sdim db,dD+1,dL ;¥Ù¥¯¥È¥ëÇÛÎó
sdim query,dD+1 ;¥¯¥¨¥ê?
sdim target,dD+1
dim sa,dL ;¥½¡¼¥ÈÍÑÇÛÎó
dim distI,distout ;ȽÄêÍÑÇÛÎóa (°ÌÃÖ)
dim distV,distout ;ȽÄêÍÑÇÛÎób (ÃÍ)
dim dist :dim cHit :dim cSkp
#module
#uselib "kernel32.dll"
#cfunc global _GetTickCount "GetTickCount"
#define global GetTickCount _GetTickCount()
#defcfunc strcmp var p0, var p1, local a ;ʸ»úÎóÈæ³Ó
a=0,0,0 :*@ :a.1=peek(p0,a),peek(p1,a)
if(a.1)*(a.1==a.2){a.0++ :goto *@b} :return a.1-a.2
#deffunc mSort array p0, array p1, array p2, int p3, int p4, local a ;¥½¡¼¥ÈÇÛÎóºîÀ®
a.0=p3,0,0,p4,p4-p3+1 :a.2=a.4/2+p3 :a.1=a.2-1
if(a.1-a.0){mSort p0,p1,p2,a.0,a.1} :if(a.3-a.2){mSort p0,p1,p2,a.2,a.3}
repeat a.4
If(a.0>a.1){p2(cnt)=p1(a.2) :a.2++ :continue}
If(a.2>a.3){p2(cnt)=p1(a.0) :a.0++ :continue}
If(strcmp(p0(p1(a.0)),p0(p1(a.2)))>0){p2(cnt)=p1(a.2) :a.2++}else{p2(cnt)=p1(a.0) :a.0++}
loop
repeat a.4 :p1(cnt+p3)=p2(cnt) :loop
return
#global
randomize
i=(dD+20)*6 :if(i<320){i=320}
screen 0,i,240 :color :boxf
font msgothic,12 :hsvcolor ,,255 :pos 2,0
mes "¥Ù¥¯¥È¥ëÇÛÎó¤Ä¤¯¤Ã¤Æ¤Þ¤¹.."
repeat dL ;¥Ù¥¯¥È¥ë¤Ç¤Ã¤Á¾å¤²
dup s,db(cnt) :s="" :i.0=rnd($1000),0
*@ :repeat 12
if(i&1){s+="1"}else{s+="0"} :i.0>>=1
i.1++ :if(i.1>=dD){break} :loop
if(i.1<dD){i.0=rnd($1000) :goto *@b}
loop
sdim s :ct=GetTickCount
mes "¥½¡¼¥ÈÇÛÎó¤Ä¤¯¤Ã¤Æ¤Þ¤¹.."
repeat dL :sa(cnt)=cnt :loop ;¥½¡¼¥ÈÇÛÎó¤Î½é´ü²½
dim tmp,dL :mSort db,sa,tmp,0,dL-1
logmes strf("SORT:%dms",GetTickCount-ct) :dim tmp
hsvcolor ,,255 :mes "press any key <check_a> [esc:EXIT]"
*@ :await 5 :stick i :if(i==0){goto *@b} :if(i&128){end}
*check_a
query="" :i.0=rnd($1000),0
*@ :repeat 12 ;¥¯¥¨¥ê¤Ç¤Ã¤Á¾å¤²
if(i&1){query+="1"}else{query+="0"} :i.0>>=1
i.1++ :if(i.1>=dD){break} :loop
if(i.1<dD){i.0=rnd($1000) :goto *@b}
title "check_a" :ct=GetTickCount :cHit=0
repeat dL
target=db(cnt) :dist=0
repeat dD
if(peek(query,cnt)^peek(target,cnt)){dist++ :if(dist>=distout){break}}
loop
if(dist<distout){
if((cHit\20)==0){color :boxf :hsvcolor ,,255 :pos 2,0} :cHit++
s=strf("%s :%2d [%5d]",target,dist,cnt) :mes s ;:logmes s
}
loop
s=strf("a|%2d/%d %dms",cHit,dL,GetTickCount-ct) :title s :LogMes s
if(((cHit+1)\20)<2){color :boxf :hsvcolor ,,255 :pos 2,0}
hsvcolor 48,192,255 :mes strf("%s : query",query)
hsvcolor ,,255 :mes "press any key <check_b> [esc:EXIT]"
*@ :await 5 :stick i :if(i==0){goto *@b} :if(i&128){end}
*check_b
title "check_b" :ct=GetTickCount :cHit=0 :cSkp=0 :distI=-1
repeat dL
target=db(sa(cnt)) :dist=0
if(distI>=0){
repeat distout
if(peek(target,distI(cnt))==distV(cnt)){dist++}else{break}
loop
if(dist==distout){cSkp++ :continue} :dist=0
}
repeat dD
i=peek(target,cnt)
if(peek(query,cnt)^i){
distI(dist)=cnt :distV(dist)=i
dist++ :if(dist>=distout){break}
}
loop
if(dist<distout){distI=-1
if((cHit\20)==0){color :boxf :hsvcolor ,,255 :pos 2,0} :cHit++
s=strf("%s :%2d [%5d]",target,dist,sa(cnt)) :mes s ;:logmes s
}
loop
s=strf("b|%2d/%d %dms [%dskp]",cHit,dL,GetTickCount-ct,cSkp) :title s :LogMes s
if(((cHit+1)\20)<2){color :boxf :hsvcolor ,,255 :pos 2,0}
hsvcolor 48,192,255 :mes strf("%s : query",query)
hsvcolor ,,255 :mes "press any key <check_a> [esc:EXIT]"
*@ :await 5 :stick i :if(i==0){goto *@b} :if(i&128){end}
goto *check_a
| |
|
2013/6/15(Sat) 03:13:00|NO.54898
¡ÖC¤Ç½ñ¤±¤è¡×¤È¤¤¤¦¥Ä¥Ã¥³¥ß¤Ï²£¤ËÃÖ¤¤¤Æ¡¢¼Â¸³¤·¤Æ¤ß¤Þ¤·¤¿¡£
¤Þ¤º¡¢Íð¿ô¤Ç0¡¦1¤òÀ¸À®¤·¤Æ
----------------------
01011101010...1010110
10101110101...1011111
...
10110111111...1110010
----------------------
¤È¡¢15000¹Ô¤Î¥Æ¥¥¹¥È¥Ç¡¼¥¿¤òºîÀ®¡£¤³¤ì¤ò¥¿¥Í¤È¤·¤Æ¡¢
Æɤ߹þ¤ß¢ª(Íð¿ô¤ÇÀ¸À®¤·¤¿)¥¯¥¨¥ê¤ò¸¡º÷¤µ¤»¤ë¢ª10²ó¹Ô¤¤¡¢»þ´Ö¤ÎÊ¿¶ÑÃͤò¼è¤ë
¤È¤¤¤Ã¤¿ÊýË¡¤Ç¸¡¾Ú¤ò¹Ô¤¤¤Þ¤·¤¿¡£
(Core i5-3210M¡¢¥á¥â¥ê4GB¡¢Win764bitµ¡¤Ç¼Â»Ü)
¤Þ¤º¡¢¼ÁÌä¼Ô¤¬½ñ¤¤¤Æ¤¤¤ëÊýË¡¡£¤³¤ì¤ÇÊ¿¶Ñ2503.5[ms/query]¡£
randomize
#uselib "winmm.dll"
#cfunc timer "timeGetTime"
#func timeBeginPeriod "timeBeginPeriod" int
#func timeEndPeriod "timeEndPeriod" int
#define dimention 256
#define size 15000
#define times 10
sdim query, dimention
candist = 3
;¥Ç¡¼¥¿Æɤ߹þ¤ß
sdim db, dimention, size
notesel buf :noteload "db.txt"
repeat size
memcpy db(cnt), buf, dimention, ,cnt * (dimention + 2)
loop
;¥¯¥¨¥ê¤òÅꤲ¤Æ®Åٷ׬
alltime=0
timeBeginPeriod 1
for k,0,times
;¥¯¥¨¥êºîÀ®
repeat dimention
poke query, cnt, '0' + rnd(2)
loop
;¸¡º÷
time_s=timer()
count = 0 ;DBÃæ¥Ò¥Ã¥È¤·¤¿¿ô
repeat size
target = db(cnt)
dist = 0
repeat dimention
if strmid(query, cnt, 1) != strmid(target, cnt, 1): dist++
loop
if dist <= candist :count++
loop
alltime += timer() - time_s
next
timeEndPeriod 1
dialog ""+(1.0 * alltime / times)+"[ms/query]"
stop
¼¡¤Ë¡¢NO.54871¤¬¼¨¤·¤¿ÊýË¡¡£¤³¤ì¤ÇÊ¿¶Ñ819.9[ms/query]¡£Ä̾ï¤Î3ÇܤǤ¹¤Ê¡£
randomize
#uselib "winmm.dll"
#cfunc timer "timeGetTime"
#func timeBeginPeriod "timeBeginPeriod" int
#func timeEndPeriod "timeEndPeriod" int
#define dimention 256
#define size 15000
#define times 10
sdim query, dimention
candist = 3
;¥Ç¡¼¥¿Æɤ߹þ¤ß
sdim db, dimention, size
notesel buf :noteload "db.txt"
repeat size
memcpy db(cnt), buf, dimention, ,cnt * (dimention + 2)
loop
;¥¯¥¨¥ê¤òÅꤲ¤Æ®Åٷ׬
alltime=0
timeBeginPeriod 1
for k,0,times
;¥¯¥¨¥êºîÀ®
repeat dimention
poke query, cnt, '0' + rnd(2)
loop
;¸¡º÷
time_s=timer()
dim query_, dimention
repeat dimention
query_ = peek(query, cnt)
loop
count = 0 ;DBÃæ¥Ò¥Ã¥È¤·¤¿¿ô
repeat size
target = db(cnt)
dist = 0
repeat dimention
if query_(cnt) != peek(target,cnt): dist++
loop
if dist <= candist :count++
loop
alltime += timer() - time_s
next
timeEndPeriod 1
dialog ""+(1.0 * alltime / times)+"[ms/query]"
stop
ºÇ¸å¤Ë¡¢NO.54867¤µ¤ó¤¬¼¨¤·¤¿ÊýË¡¡£¤³¤ì¤Ç141.1[ms/query]¡£Â®ÅÙ¤¬¹¹¤Ë6Çܤˡª
randomize
#uselib "winmm.dll"
#cfunc timer "timeGetTime"
#func timeBeginPeriod "timeBeginPeriod" int
#func timeEndPeriod "timeEndPeriod" int
#const dimention 256
#const dimsize dimention / 32
#const size 15000
#const times 10
candist = 3
;¥Ç¡¼¥¿Æɤ߹þ¤ß
dim db, dimsize, size
notesel buf :noteload "db.txt"
repeat size
i = cnt
repeat dimsize
j = cnt
db(j, i) += peek(buf, i * (dimention + 2) + j * 32) - '0'
repeat 31, 1
db(j, i) <<= 1
db(j, i) += peek(buf, i * (dimention + 2) + j * 32 + cnt) - '0'
loop
loop
loop
;¥¯¥¨¥ê¤òÅꤲ¤Æ®Åٷ׬
alltime=0
timeBeginPeriod 1
for k,0,times
;¥¯¥¨¥êºîÀ®
dim query, dimsize
repeat dimsize
j = cnt
query(j) += rnd(2)
repeat 31, 1
query(j) <<= 1
query(j) += rnd(2)
loop
loop
;¸¡º÷
time_s=timer()
count = 0 ;DBÃæ¥Ò¥Ã¥È¤·¤¿¿ô
repeat size
i = cnt
dist = 0
repeat dimsize
diff = query(cnt) ^ db(cnt, i)
diff = (diff & $55555555) + (diff >> 1 & $55555555)
diff = (diff & $33333333) + (diff >> 2 & $33333333)
diff = (diff & $0f0f0f0f) + (diff >> 4 & $0f0f0f0f)
diff = (diff & $00ff00ff) + (diff >> 8 & $00ff00ff)
dist += (diff & $0000ffff) + (diff >>16 & $0000ffff)
loop
if dist <= candist :count++
loop
alltime += timer() - time_s
next
timeEndPeriod 1
dialog ""+(1.0 * alltime / times)+"[ms/query]"
stop
¡Ä¡ÄNO.54896¤Ï¡¢ÆâÍƤ¬¤è¤¯Ê¬¤«¤é¤Ê¤«¤Ã¤¿¤Î¤Ç¸¡¾Ú¤·¤Æ¤¤¤Þ¤»¤ó¡£¤´¤á¤ó¤Ê¤µ¤¤¡£
| |
|
2013/6/15(Sat) 06:28:59|NO.54899
¤ó¡¼¡£¥×¥í¥°¥é¥à·×»»Î̤òºï¸º¤·¤¿¤¤¤È¤¤¤Ã¤Æ¤â¡¢Á°Äó¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹ÇÛÎó¤Ë³ÊǼ¤¹¤ë½èÍý¤ò·×»»Î̤˴ޤá¤Æ¹Í¤¨¤ë¤Î¤«¡¢
¤½¤ì¤È¤â°ìÅÙÆɤ߹þ¤à¤À¤±¤Ê¤Î¤«¡¢¤É¤Ã¤Á¤«¤ï¤«¤é¤Ê¤¤¤È²þÁ±ÊýË¡¤Ï²óÅú¤Ç¤¤Ê¤¤¤È»×¤¦¤è¡£
//¡
db(0) = "010101010101" // ¼ÂºÝ¤Ï12¼¡¸µ¤Ç¤Ï¤Ê¤¯256¼¡¸µ¤Î¥Ù¥¯¥È¥ë
db(1) = "000000101101"
db(2) = "000011011100"
// (¾Êά)
db(15000) = "011110111111"
//¡End
//¢
query = "001101110111"
repeat length(db)
title "" + cnt
target = db(cnt)
dist = 0
repeat 12
if strmid(query, cnt, 1) != strmid(target, cnt, 1) : dist++
loop
if dist <= 3 : mes target + " : " + dist
loop
//¢End
¡¤È¢¤¬¾ï¤ËÂФǽèÍý¤µ¤ì¤ë¤Î¤Ç¤¢¤ì¤Ð¡¢¤¿¤Ö¤ó¥×¥í¥°¥é¥à·×»»Î̤κ︺¤ÏÆñ¤·¤¤¤È»×¤¦¡£
¡¤È¢¤¬¤Þ¤Ã¤¿¤¯ÊÌ¡¹¤Ç¤Î½èÍý¤Ç¤¢¤ì¤Ð¡¢¡¤Ë½èÍý¤ò¹Ô¤¨¤Ð¡¢¢¤Î½èÍý¤ÏºÇÂç¤Ç¼¡¸µ¿ô x ¼¡¸µ¿ô(256¼¡¸µ x 256¼ïÎà)¤Î½èÍý¤ÇºÑ¤à¡£
|
|
2013/6/15(Sat) 10:04:38|NO.54907
¤Þ¤º¤Ïñ½ã¤Ë½èÍý²ó¿ô¤ò¸º¤é¤»¤Ê¤¤¤«¤ò¹Í¤¨¤ë¤Î¤¬Îɤ¤¤È»×¤¤¤Þ¤¹¡£
ÌÜŪ¤ÈÈæ³Ó¥Ç¡¼¥¿¤Ê¤É¡¢¤â¤¦¾¯¤·ÌÀ³Î¤Ë¤Ê¤Ã¤Æ¤ë¤È²þÁ±¤·¤ä¤¹¤¤¤Î¤Ç¤Ï»×¤¤¤Þ¤¹¡£
Î㤨¤Ð¡¢ÌÜŪ¤¬¡Ödist(°ã¤¤)¤¬3°Ê²¼¡×¤òµá¤á¤ë¤Î¤Ç¤¢¤ì¤Ð£²½Å¥ë¡¼¥×¤Î²ó¿ôºï¸º¤¬´üÂԤǤ¤Þ¤¹¡£
repeat 12
if strmid(query, cnt, 1) != strmid(target, cnt, 1) : dist++
if dist>3: break //¢«Äɲá¢dist>3¤Î¾ì¹çÈæ³Ó½èÍý¤·¤Æ¤â°ÕÌ£¤¬¤Ê¤¤¤Î¤ÇÈ´¤±¤ë
loop
¤Þ¤¿¡¢°Ê²¼¤Î¤è¤¦¤Ëdb(n)Ãͤ¬¾º½ç¤Ë¤Ê¤é¤ó¤Ç¤¤¤ë¥Ç¡¼¥¿¤Ç¤¢¤ì¤Ð£±½Å¥ë¡¼¥×¤Î²ó¿ô¤òȾʬ¤Ë¤Ç¤¤Þ¤¹¡£
Èæ³ÓÂоÝquery¤¬db(0)¡Ádb(7499)¡¢db(7500)¡Ádb(15000)¤Î¤É¤Á¤é¦¤Ë¤¢¤ë¤«¤òÀè¤Ë·è¤á¤Æ¡¢¤¢¤ë¤Û¤¦¤Î¥Ç¡¼¥¿¤Î¤ßÈæ³Ó½èÍý¤·¤Þ¤¹¡£
db(0)="000000000001"
db(1)="000000000010"
db(2)="000000000011"
¡¦¡¦¡¦
db(7499)="111110111111"
db(7500)="111111000000"
db(7501)="111111000001"
¡¦¡¦¡¦
db(15000)="111111111111" // ¼ÂºÝ¤Ë¤Ïdb(32767)¡©
query = "001101110111"
st=0: mx=7499: if strmid(query,1,6)==strmid(db(7500),1,6):st=7500: mx=15000¡¡//¢«Äɲá¡È¾Ê¬¤À¤±Èæ³Ó¤¹¤ë
//¢¤ËÊѹ¹ repeat length(db)
repeat mx, st
|
|
2013/6/15(Sat) 13:31:33|NO.54909
No.54899 ¤Ç½ñ¤¤¤Æ¤¤¤Ê¤«¤Ã¤¿¤±¤É¡¢·×»»ÎÌ = length(db) * 256¼¡¸µÊ¸»ú¿ô ¤ÎÏä͡£
ºÇ½ªÅª¤Ê·×»»Î̤ϡ¢¥ë¡¼¥×²ó¿ô x Èæ³Ó²ó¿ô¤È¤·¤Æ·×»»¤¹¤ë¤È¤ï¤«¤ê¤ä¤¹¤¤¡£
ñ½ã¤Ë¡¢256¼¡¸µ 2¿Ê¿ôʸ»úÎó 256¼ï ¤Î¾ì¹ç¤Ç¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤¬ 15000 ¹àÌܤÀ¤È¤¹¤ë¤È¡¢
ºÇÂç¤Ç¡¢256 * 15000 = 3,840,000 ¤ÎÈæ³Ó¤¬É¬ÍפǤ¢¤ë¡£
¾¤Î²óÅú¼Ô¤µ¤ó¤â²óÅú¤·¤Æ¤¤¤ëÄ̤ꡢ¥Ç¡¼¥¿¥Ù¡¼¥¹¤òÇÛÎó¤Ë³ÊǼ¤·¤Æ¤¤¤ë¾ò·ï¤¬À°¤¨¤Ð¡¢²þÁ±¤¹¤ëÊýË¡¤â¤¢¤ë¤¬¡¢
Á°Äó¤È¤Ê¤ë¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹ÇÛÎó¤Ë³ÊǼ¤¹¤ëºÝ¤Ë²¿¤é¤«¤Î½èÍý¤ò¤¹¤ì¤Ð¡¢¤½¤Î½èÍýʬ¤ò·×»»Î̤Ȥ·¤Æ²Ã»»¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
1.¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ï¥é¥ó¥À¥à¤Ç¤¢¤ë¡£
2.dist ¤Ï 3°Ê¾å¤ÇȽÃǤ¹¤ë¡£
¤·¤«¾ðÊ󤬤ʤ¤¤Î¤Ç²óÅú¤Î¤·¤è¤¦¤¬¤Ê¤¤¡£
¤¹¤Ù¤Æ¤Î¾õ¶·¤ËÅö¤Æ¤Ï¤Þ¤ë»ö¤À¤±¤É¡¢ºÇ½é¤«¤éºï¸º¤ÏÆñ¤·¤¤¤È»×¤¦¡£
¥ª¡¼¥À¡¼ºÇŬ²½¤¬ºÑ¤à¤Î¤Ï¡¢2²óÌܰʹß(¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÅÐÏ¿½èÍý¤¬½ªÎ»¤·ºÆÅÙɬÍפȤ¹¤ë¾ì¹ç)¤Î½èÍý¤Ç¤¢¤ë¡£
|
|
2013/6/15(Sat) 20:11:06|NO.54926
NO.54896 ¤¬ÀâÌÀÉÔ¤À¤Ã¤¿¤è¤¦¤Ê¤Î¤Ç°ì±þÊä¤ò¡Ä
´ðËÜŪ¤Ë¤Ï NO.54907 ¤Î ¤µ¤«ÍͤΤ褦¤Ê
¥Ï¥º¥ì(dist>3)¤À¤È²ò¤Ã¤¿»þÅÀ¤Ç¼¡¤Ø°Ü¹Ô¤È¤¤¤Ã¤¿¤â¤Î¤Ç¤¹¡£
ÉáÄ̤˥ǡ¼¥¿½ç¡¢³Æ¥Ç¡¼¥¿¤òÀèƬ¤«¤é¸¡ºº¤¹¤ë¤â¤Î¤¬ check_a¡£
¥½¡¼¥È½ç¡¢ÀèƬ¤«¤é¤Î¸¡ºº¤ÎÁ°¤ËÄêÅÀ¸¡ºº¤ò²Ã¤¨¤¿¤â¤Î¤¬ check_b¡£
¡Ö¥Ç¡¼¥¿·¹¸þ¤Ë¤è¤Ã¤Æ¤Ï¡¢¤Á¤ç¤Ã¤È¤À¤±Á᤯¤Ê¤ë¥±¡¼¥¹¤â¤¢¤ë¤ß¤¿¤¤¤Ç¤¹¤è¡£¡×
¤È±¾¤¦¤Î¤¬ NO.54896 ¤Î¥¹¥¯¥ê¥×¥È¤ÎÆâÍÆ(¤Î¤Ä¤â¤ê)¤Ç¤¹¡£
¥Ç¡¼¥¿¥Ù¡¼¥¹¤¬¥é¥ó¥À¥à¤À¤È¤¹¤ë¤È¡¢1/2^239¤Ç¤½¤â¤½¤âÅö¤ëµ¤¤¬¤·¤Þ¤»¤ó¤·
¼ÂºÝ¤Ï¤«¤Ê¤ê·¹¸þ¤¬ÊФ俤â¤Î¤Ê¤Î¤Ç¤Ï¡©¤È¤¤¤¦ÁÛÁü¤Î´ð¤Ë»×¤¤ÉÕ¤¤Ç½ñ¤¤¤Æ¤ß¤Þ¤·¤¿¡£
|
|