# numpy.int64 vs. sage.rings.integer.Integer [closed]

Hi experts!

I have a list (A) with many list generated by NetworkX. Each list have numpy.int64 numbers A=[A1,....,An], where Aj are lists of numpy.int64 integers numbers.

I want to compare this numpy.int64 numbers with sage.rings.integer.Integer numbers.

How can I do this?

Thanks a lot!

edit retag reopen merge delete

### Closed for the following reason the question is answered, right answer was accepted by mresimulator close date 2014-07-12 18:38:51.442980

Sort by ยป oldest newest most voted

Just use == :

sage: import numpy
sage: a = numpy.int64(123) ; a
123
sage: type(a)
<type 'numpy.int64'>
sage: b = ZZ(123) ; b
123
sage: a == b
True
sage: type(b)
<type 'sage.rings.integer.Integer'>
sage: c = ZZ(1234)
sage: a == c
False
sage: A = [[numpy.int64(1), numpy.int64(2)], [numpy.int64(3), numpy.int64(4)]]
sage: B = [[ZZ(1), ZZ(2)], [ZZ(3), ZZ(4)]]
sage: A
[[1, 2], [3, 4]]
sage: B
[[1, 2], [3, 4]]
sage: A == B
True
sage: C = [[ZZ(1), ZZ(2)], [ZZ(3), ZZ(5)]]
sage: A == C
False

more

## Stats

Asked: 2014-07-11 04:32:49 +0200

Seen: 964 times

Last updated: Jul 11 '14