downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

gmp_init> <gmp_gcdext
Last updated: Fri, 06 Nov 2009

view this page in

gmp_hamdist

(PHP 4 >= 4.0.4, PHP 5)

gmp_hamdistハミング距離

説明

int gmp_hamdist ( resource $a , resource $b )

ab の間のハミング距離を返します。オペランドは共に非負とする必要があります。

パラメータ

a

GMP 数リソース、 あるいは数値に変換可能な数値形式の文字列。

正の数である必要があります。

b

GMP 数リソース、 あるいは数値に変換可能な数値形式の文字列。

正の数である必要があります。

返り値

GMP 数リソースを返します。

例1 gmp_hamdist() の例

<?php
$ham1 
gmp_init("1001010011"2);
$ham2 gmp_init("1011111100"2);
echo 
gmp_hamdist($ham1$ham2) . "\n";

/* ハミング距離は、以下と等しくなります */
echo gmp_popcount(gmp_xor($ham1$ham2)) . "\n";
?>

上の例の出力は以下となります。

6
6

参考



add a note add a note User Contributed Notes
gmp_hamdist
There are no user contributed notes for this page.

gmp_init> <gmp_gcdext
Last updated: Fri, 06 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites