Domain error.
Henry Rich
On Tue, Apr 4, 2023, 6:56 PM 'Mike Day' via Programming <
programm...@jsoftware.com> wrote:
> Lovely. Hopefully including negative powers! How will you deal with
> ill-defined results,
> though?
>
> Thanks,
>
> Mike
>
> Sent from my iPad
>
> > On 4 Apr 2023, at 19:07,
Lovely. Hopefully including negative powers! How will you deal with
ill-defined results,
though?
Thanks,
Mike
Sent from my iPad
> On 4 Apr 2023, at 19:07, Henry Rich wrote:
>
> Expect primitive support for modular inverse in an upcoming beta.
>
> Henry Rich
>
>
>> On Tue, Apr 4, 2023,
Modular exponentiation and inverse are the two functions cryptographers
wish were primitives.
On Tue, Apr 4, 2023 at 11:07 AM Henry Rich wrote:
> Expect primitive support for modular inverse in an upcoming beta.
>
> Henry Rich
>
>
> On Tue, Apr 4, 2023, 1:49 PM 'Michael Day' via Programming <
Expect primitive support for modular inverse in an upcoming beta.
Henry Rich
On Tue, Apr 4, 2023, 1:49 PM 'Michael Day' via Programming <
programm...@jsoftware.com> wrote:
> Thanks, Chris, and Cliff too.
>
> Yes, a mod inverse helps a lot. Once you've got an inverse, it's easy
> to derive a
Thanks, Chris, and Cliff too.
Yes, a mod inverse helps a lot. Once you've got an inverse, it's easy
to derive a modular divide, or vice
versa.
inversep in primutil.ijs is well defined for a prime modulus - the name
"primutil" does of course imply
a prime modulus.
inversep also appears t
Cliff
There are some mod functions in the math/misc addon, e.g. this gives
Mike Day's table
load 'math/misc/primutil'
f=: (17 timesmod) (17&inversep)
2 3 4 f"0 table >:i.8
+---+-+
|f"0|1 2 3 4 5 6 7 8|
+---+-+
|2 |2 1 12 9 14 6 10 13|
|3
I dug up an old extended gcd to build an adverb for modular divide
NB. Find the gcd of two numbers
NB. and coef giving gcd as a linear combination of y
gcd2x=: 3 : 0
'r0 r1'=.y
's0 s1'=.1 0x
't0 t1'=.0 1x
while. r1 ~: 0 do.
q=. r0 <.@% r1
'r0 r1'=. r1,r0-q*r1
's0 s1'=. s1,s0-q*s1
't0 t1'
I think I recall a conversation, some decades ago, with Roger about whether
specifying a modulus for system solving makes sense for J. I thought maybe
that was a use for the fit conjunction but now think that would be a poor
choice for such a numeric function. I have vague memories of J essays on
g
While this primitve works nicely in an example:
(2 3 4) (17&|@*)/ table >:i.8
+---+-+
|17&|@*/|1 2 3 4 5 6 7 8|
+---+-+
|2 |2 4 6 8 10 12 14 16|
|3 |3 6 9 12 15 1 4 7|
|4 |4 8 12 16 3 7 11 15|
+---+---