Can somebody help me get the matlab code for the following c++ code.
int x = px;
int y = py;
//Setup initial variables
//Maintain throughout that ax * px + bx * py = x and that ay * px + by * py = y
int ax = 1;
int ay = 0;
int bx = 0;
int by = 1;
//Perform extended gcd
while(x)
{
if(x <= y)
{
int m = y / x;
y -= m * x;
ay -= ax * m;
by -= bx * m;
}
else
{
swap(x, y);
swap(ax, ay);
swap(bx, by);
}
}
int inverse = ay % py;
if(inverse < 0) inverse += py;__________________
Thanks

Start a new topic
Add Reply





MultiQuote
| 


