Re: [sage-support] Generator of Finite Field

2012-06-03 Thread Jeroen Demeyer
On 2012-06-03 22:37, Martin Albrecht wrote:
> PARI doesn't have a log_repr() to begin with, so I don't see how that's 
> relevant.
Yes, never mind my comment.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: Re: [sage-support] Generator of Finite Field

2012-06-03 Thread Martin Albrecht
PARI doesn't have a log_repr() to begin with, so I don't see how that's 
relevant.

On Sunday 03 Jun 2012, Jeroen Demeyer wrote:
> On 2012-06-03 12:14, Martin Albrecht wrote:
> > 2) K.multiplicative_generator() currently returns a random generator, but
> > for the GivaroGFq implementation we should simply return the generator
> > which has internal representation '1', i.e., the guy we actually use to
> > represent the elements. Once this done log_repr() will also start to
> > make sense again.
> 
> On the other hand, doing this for the Givaro interface but not for the
> PARI interface (where logs are never used) is also confusing.  I would
> say: leave things as they are.  Note that the generator is not "random",
> it is deterministic.

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Generator of Finite Field

2012-06-03 Thread Jeroen Demeyer
On 2012-06-03 12:14, Martin Albrecht wrote:
> 2) K.multiplicative_generator() currently returns a random generator, but for 
> the GivaroGFq implementation we should simply return the generator which has 
> internal representation '1', i.e., the guy we actually use to represent the 
> elements. Once this done log_repr() will also start to make sense again.
On the other hand, doing this for the Givaro interface but not for the
PARI interface (where logs are never used) is also confusing.  I would
say: leave things as they are.  Note that the generator is not "random",
it is deterministic.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: Re: [sage-support] Generator of Finite Field

2012-06-03 Thread Oleksandr Kazymyrov
Hi,

Yes, I hope that 2) will fix it.

Cheers.
Oleksandr

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: Re: [sage-support] Generator of Finite Field

2012-06-03 Thread Martin Albrecht
Hi,

K.gen() returns the thing we represent field elements in, but not necessarily 
the field generator. 


1) However, the documentation is wrong:

"""
Return a generator of self. All elements x of self are expressed as  
log_{self.gen()}(p) internally
"""

This should be fixed and a reference to multiplicative_generator() added.

2) K.multiplicative_generator() currently returns a random generator, but for 
the GivaroGFq implementation we should simply return the generator which has 
internal representation '1', i.e., the guy we actually use to represent the 
elements. Once this done log_repr() will also start to make sense again.

Olexandr, would those fixes solves your confusion/problem?

On Sunday 03 Jun 2012, Oleksandr Kazymyrov wrote:
> I have used log_repr() and expect that it return y of equation x^y = z. I
> also believed  hat k.gen() return generator of the field.
> 
> Now I must use following construction for solving my problem
> sage: R.=ZZ[]
> sage: k=GF(2^8,name='a',modulus=x^8+x^4+x^3+x+1)
> sage: a = k.multiplicative_generator()
> sage: a^ZZ(k(ZZ(3).digits(2)).log(a)) == k(ZZ(3).digits(2))
> 
> By the way, any of next functions don't return the value y of equation
> x^y=z sage: b=K(ZZ(3).digits(2))
> sage: b
> a + 1
> sage: b.log_repr()
> '1'
> sage: b.log_to_int()
> 3
> 
> I think that log_repr() should has the same logic as int_repr() or
> integer_representation(), i.e.
> sage: a=K.multiplicative_generator()
> sage: ZZ(K(ZZ(3).digits(2)).log(a))
> 164
> 
> What do you think?
> 
> Kind regards,
> Oleksandr
> 
> On Tuesday, May 29, 2012 12:52:16 PM UTC+3, AlexGhitza wrote:
> > Hi,
> > 
> > On Mon, May 21, 2012 at 9:29 AM, Oleksandr Kazymyrov
> > 
> >  wrote:
> > > I have encountered the following problem In Sage 5.0:
> > > sage: R.=ZZ[]
> > > sage: k=GF(2^8,name='a',modulus=x^8+x^4+x^3+x+1)
> > > sage: k(ZZ(3).digits(2))
> > > a + 1
> > > sage: k.gen()^ZZ(k(ZZ(3).digits(2)).log_repr())
> > > a
> > > sage:  k.gen()^ZZ(k(ZZ(3).digits(2)).log_repr()) == k(ZZ(3).digits(2))
> > > False
> > > sage: k("a+1")^ZZ(k(ZZ(3).digits(2)).log_repr()) == k(ZZ(3).digits(2))
> > > True
> > > 
> > > It easy see that k.gen() or k.multiplicative_generator() is not a
> > 
> > generator
> > 
> > > of the finite field:
> > > sage: k.multiplicative_generator()
> > > a^4 + a + 1
> > 
> > Why is it clear that a^4+a+1 is not a multiplicative generator?  I think
> > it is:
> > 
> > sage: k. = GF(2^8, names='a', name='a', modulus=x^8+x^4+x^3+x+1)
> > sage: (a^4+a+1).multiplicative_order()
> > 255
> > 
> > Indeed, so is a+1:
> > sage: (a+1).multiplicative_order()
> > 255
> > 
> > The docs for multiplicative_generator() say: "return a generator of
> > the multiplicative group", then add "Warning: This generator might
> > change from one version of Sage to another."

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org



Re: [sage-support] Generator of Finite Field

2012-06-03 Thread Oleksandr Kazymyrov
I have used log_repr() and expect that it return y of equation x^y = z. I 
also believed  hat k.gen() return generator of the field.

Now I must use following construction for solving my problem
sage: R.=ZZ[]
sage: k=GF(2^8,name='a',modulus=x^8+x^4+x^3+x+1)
sage: a = k.multiplicative_generator()
sage: a^ZZ(k(ZZ(3).digits(2)).log(a)) == k(ZZ(3).digits(2))

By the way, any of next functions don't return the value y of equation x^y=z
sage: b=K(ZZ(3).digits(2))
sage: b
a + 1
sage: b.log_repr()
'1'
sage: b.log_to_int()
3

I think that log_repr() should has the same logic as int_repr() or 
integer_representation(), 
i.e.
sage: a=K.multiplicative_generator()
sage: ZZ(K(ZZ(3).digits(2)).log(a))
164

What do you think?

Kind regards,
Oleksandr

On Tuesday, May 29, 2012 12:52:16 PM UTC+3, AlexGhitza wrote:
>
> Hi, 
>
> On Mon, May 21, 2012 at 9:29 AM, Oleksandr Kazymyrov 
>  wrote: 
> > I have encountered the following problem In Sage 5.0: 
> > sage: R.=ZZ[] 
> > sage: k=GF(2^8,name='a',modulus=x^8+x^4+x^3+x+1) 
> > sage: k(ZZ(3).digits(2)) 
> > a + 1 
> > sage: k.gen()^ZZ(k(ZZ(3).digits(2)).log_repr()) 
> > a 
> > sage:  k.gen()^ZZ(k(ZZ(3).digits(2)).log_repr()) == k(ZZ(3).digits(2)) 
> > False 
> > sage: k("a+1")^ZZ(k(ZZ(3).digits(2)).log_repr()) == k(ZZ(3).digits(2)) 
> > True 
> > 
> > It easy see that k.gen() or k.multiplicative_generator() is not a 
> generator 
> > of the finite field: 
> > sage: k.multiplicative_generator() 
> > a^4 + a + 1 
>
> Why is it clear that a^4+a+1 is not a multiplicative generator?  I think 
> it is: 
>
> sage: k. = GF(2^8, names='a', name='a', modulus=x^8+x^4+x^3+x+1) 
> sage: (a^4+a+1).multiplicative_order() 
> 255 
>
> Indeed, so is a+1: 
> sage: (a+1).multiplicative_order() 
> 255 
>
> The docs for multiplicative_generator() say: "return a generator of 
> the multiplicative group", then add "Warning: This generator might 
> change from one version of Sage to another." 
>
>
> -- 
> Best, 
> Alex 
>
> -- 
> Alex Ghitza -- Lecturer in Mathematics -- The University of Melbourne 
> http://aghitza.org 
>

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Generator of Finite Field

2012-05-29 Thread Alex Ghitza
Hi,

On Mon, May 21, 2012 at 9:29 AM, Oleksandr Kazymyrov
 wrote:
> I have encountered the following problem In Sage 5.0:
> sage: R.=ZZ[]
> sage: k=GF(2^8,name='a',modulus=x^8+x^4+x^3+x+1)
> sage: k(ZZ(3).digits(2))
> a + 1
> sage: k.gen()^ZZ(k(ZZ(3).digits(2)).log_repr())
> a
> sage:  k.gen()^ZZ(k(ZZ(3).digits(2)).log_repr()) == k(ZZ(3).digits(2))
> False
> sage: k("a+1")^ZZ(k(ZZ(3).digits(2)).log_repr()) == k(ZZ(3).digits(2))
> True
>
> It easy see that k.gen() or k.multiplicative_generator() is not a generator
> of the finite field:
> sage: k.multiplicative_generator()
> a^4 + a + 1

Why is it clear that a^4+a+1 is not a multiplicative generator?  I think it is:

sage: k. = GF(2^8, names='a', name='a', modulus=x^8+x^4+x^3+x+1)
sage: (a^4+a+1).multiplicative_order()
255

Indeed, so is a+1:
sage: (a+1).multiplicative_order()
255

The docs for multiplicative_generator() say: "return a generator of
the multiplicative group", then add "Warning: This generator might
change from one version of Sage to another."


-- 
Best,
Alex

--
Alex Ghitza -- Lecturer in Mathematics -- The University of Melbourne
http://aghitza.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Generator of Finite Field

2012-05-20 Thread Oleksandr Kazymyrov
Hello all.

I have encountered the following problem In Sage 5.0:
sage: R.=ZZ[] 
sage: k=GF(2^8,name='a',modulus=x^8+x^4+x^3+x+1)
sage: k(ZZ(3).digits(2))
a + 1
sage: k.gen()^ZZ(k(ZZ(3).digits(2)).log_repr())
a
sage:  k.gen()^ZZ(k(ZZ(3).digits(2)).log_repr()) == k(ZZ(3).digits(2))
False
sage: *k("a+1")*^ZZ(k(ZZ(3).digits(2)).log_repr()) == k(ZZ(3).digits(2))
True

It easy see that k.gen() or k.multiplicative_generator() is not a generator 
of the finite field:
sage: k.multiplicative_generator()
a^4 + a + 1
sage: k.gen()
a
sage: k.list()
[0, a + 1, a^2 + 1, a^3 + a^2 + a + 1, a^4 + 1, a^5 + a^4 + a + 1, a^6 + 
a^4 + a^2 + 1, ... ]

Generator is "a+1"!

How to get generator of Finite Field? It was fine in Sage 4.8.

Ubuntu 12.04
Linux hamsin 3.2.0-24-generic #37-Ubuntu SMP Wed Apr 25 08:43:52 UTC 2012 
i686 i686 i386 GNU/Linux

Best regards,
Oleksandr

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org