Null space of matrix over GF(2)

46 views
Skip to first unread message

Chris Dawson

unread,
Dec 14, 2017, 12:30:08 PM12/14/17
to ffpack-devel
Hi all,

I am just starting out with ffpack and as an exercise was trying to call NullSpaceBasis on a a matrix over Z2. I'm getting the following error message

Assertion failed: (_p >= minCardinality()), function ModularBalanced, file /usr/local/include/givaro/modular-balanced-double.h, line 54

The relevant parts of the code that produced this are adapted from the solve example (see below). It looks like I should be using some other givaro field type for the specific case of GF(2), but I was unable to figure out how to get this to work.

Can anyone assist with this.

Many thanks,

Chris

typedef Givaro::Modular<int64_t> Field;

Field F(2);
int h_[] = {1,0,1,0,1,0,1, 0,1,1,0,0,1,1, 0,0,0,1,1,1,1};

Field::Element_ptr G, H;
H = fflas_new(F,3,7);
G = fflas_new(F,4,7);

for (unsigned i=0; i<21; i++)
        F.init(H[i], h_[i]);

size_t dim = NullSpaceBasis (F, FflasLeft, 7, 3, H, 7, G, ldn, NSdim);

Clement Pernet

unread,
Dec 15, 2017, 4:05:25 AM12/15/17
to ffpack...@googlegroups.com, Chris Dawson
Hi,

This is indeed a bug: FFLAS detects that Modular<int64_t> is not efficient for small cardinality and
therefore converts automatically to ModularBalanced<float>.
But then ModularBalanced is a representation of modular finite rings with cardinality p between
-(p-1)/2 and (p-1)/2, hence it requires p>=3.

This is now an open issue: https://github.com/linbox-team/fflas-ffpack/issues/151
I'll add a fix to it.

Meanwhile, you could simply replace Modular<int64_t> by Modular<float> in your code.

Best.

Clément
> --
> You received this message because you are subscribed to the Google Groups "ffpack-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ffpack-devel...@googlegroups.com <mailto:ffpack-devel...@googlegroups.com>.
> To post to this group, send email to ffpack...@googlegroups.com
> <mailto:ffpack...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/ffpack-devel.
> For more options, visit https://groups.google.com/d/optout.

Chris Dawson

unread,
Dec 15, 2017, 12:14:46 PM12/15/17
to ffpack-devel
Aha, I'd tried Modular<double> (which is also converted to ModularBalanced<float>) but not Modular<float>. All works as expected now.

Many thanks,

Chris
Reply all
Reply to author
Forward
0 new messages