The compilation fails, because the field your are using is not supported
by givaro-extension, in order to run Wiedemann algorithm (extensions are
used by the preconditioner).
The way you create a finite field is incorrect:
Unparametric<X> is meant to be a characteristic 0 ring.
And I have the impression that you are trying to use it for the finite
field GF(27).
Can you tell us more about what is you computation domain?
For GF(27), you should use
GivaroExtension F (3,3)
Alternatively, you can also use other base field implementation, eg
Modular<int>, for GF(3)
and create the extension as follows
Modular<int> F(3);
GivaroExtension<Modular<int> > G(F, 3);
Let me know if I am completely wrong about your intensions.
Cheers,
Clément
Jonathan a écrit :
I haven't found too much documentation for Givaro, so I'm just trying to
extrapolate the constructions from the examples. This probably isn't
the best forum to ask, but are the examples the best source?
Thanks for your help.
Jonathan
--
Jonathan F. Hammell
Graduate Student
Dept. of Computer Science
University of Calgary
Simply replacing
void get_vector(int p, vec_long v, long length) {
by
void get_vector(int p, vec_long& v, long length) {
makes it work the way you want.
Now I also sugest that you do not set the zero entries, in order to
keep the matrix sparse.
After these modifications, the execution raises a Solve Failed
exception, which I still did not investigated.
However, I found that we do have a function sampling a vector from the
kernel in WiedemannSolver (algorithms/wiedemann.h).
So doing the following
WiedemannSolver<Field> WS(F, MW);
WS.findNullspaceElement (soln, Mat);
for(long i = 0; i < numcols; i++)
kervec[i] = soln[i];
seems to work for me. It finds very often the 0 vector when p is small,
but this gets better for larger p.
A work around could be to loop while you get the 0 vector, although
there might be a more clever technique, which is probably not yet
implemented.
Sorry for not having driven you directly to this function, since I am
not so familiar with this part of the library.
Attached is my version of your code, summarizing the mods I have just
described.
Clément
Jonathan a écrit :
It took me awhile, but I was finally able to get a reproducible example
of how it is failing in my actual system. When I use the
findNullspaceElement routine, I occasionally will get a incorrect
answer, i.e. it returns (without error) a vector that is *not* in the
kernel. That is, after calling
ws.findNullspaceElement(soln, Mat);
Mat.apply(test, soln);
the check that test is the zero vector fails.
I've attached the code with a matrix that always return an incorrect
answer on my system with version 1.1.5rc0.
I appreciate the help.