> < ^ Date: Sat, 01 May 1999 22:43:35 +0900 (JST)
> < ^ From: Akihiro Munemasa <munemasa@math.kyushu-u.ac.jp >
^ Subject: weight distribution

Dear Forum,

Raja Sekhar B <bachu@anise.ee.cornell.edu> writes:

Hi,
I wanted to know whether there exists a solution to this problem.
Let S be a subspace of a vector space over binary field F_2 of
dimension k. Let v be an element of s. Let w(v) = weight of v
defined as the number of ones in v. Is there a way
of finding the partition function for w ( i.e., finding
out how many vectors are there in S which have weight say j. This
turns out to be simple for the full space and happens to be
just the binomial expansion (k choose j)).
Thanks,
Raja

The command 'WeightDistribution' in the share package "guava" does
exactly what you want. For example,

```gap> RequirePackage("guava");
gap> basis:=Z(2)*
> [ [ 1, 0, 0, 0, 0, 1, 1 ],
>   [ 0, 1, 0, 0, 1, 0, 1 ],
>   [ 0, 0, 1, 0, 1, 1, 0 ],
>   [ 0, 0, 0, 1, 1, 1, 1 ] ]
> ;;
gap> C:=GeneratorMatCode(basis,GF(2)); # 4-dim subspace spanned by "basis".
a linear [7,4,1..3]1 code defined by generator matrix over GF(2)
gap> WeightDistribution(C);
[ 1, 0, 0, 7, 7, 0, 0, 1 ]
```

This means that there is 1 vector each, of weight 0 and 7, and
that there are 7 vectors each, of weight 3 and 4.

Hope this helps,
Akihiro Munemasa
http://mac-mune.math.kyushu-u.ac.jp

> < [top]