Modulo 2 arithmetics in SymPy

心已入冬 提交于 2020-01-15 03:47:10

问题


I'm working on transformation polynomial systems over GF(2^N) to GF(2). In a process of transformation I need to do lots of modulo 2 computations like summing and multiplying matrices.

So is there way to sum and multiply matrices using modulo 2 arithmetics in Sympy?


回答1:


I've had luck with sympy's trunc() function:

from sympy import *
var('x:z')
y=25*x+12
z=trunc(y,2) # z=x


来源:https://stackoverflow.com/questions/21660852/modulo-2-arithmetics-in-sympy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!