Re: [Jprogramming] scalars vs. lists in boxes

2017-12-19 Thread Raul Miller
Or, more specifically, = is comparing atoms (the things that go into arrays, which includes everything in a box - including the shape of things in the box). Thanks, -- Raul On Wed, Dec 20, 2017 at 12:48 AM, Devon McCormick wrote: > Or, to put it another way, equality (=) which compares values

Re: [Jprogramming] scalars vs. lists in boxes

2017-12-19 Thread Devon McCormick
Or, to put it another way, equality (=) which compares values is different from equivalence (-:) which accounts for shape as well. On Wed, Dec 20, 2017 at 12:35 AM, bill lam wrote: > = is rank 0 > -: is rank infinity > > Try 0= 1$0 and 0-: 1$0 > and note the shape of results > > On Dec 20, 2017

Re: [Jprogramming] scalars vs. lists in boxes

2017-12-19 Thread bill lam
= is rank 0 -: is rank infinity Try 0= 1$0 and 0-: 1$0 and note the shape of results On Dec 20, 2017 1:16 PM, "Dabrowski, Andrew John" wrote: > Here's my latest exasperation. > > zero =: < (1$0) > > zero > > ┌─┐ > > │0│ > > └─┘ > > > zero > > 0 > > $ > zero > > 1 > > zero =

[Jprogramming] scalars vs. lists in boxes

2017-12-19 Thread Dabrowski, Andrew John
Here's my latest exasperation.    zero =: < (1$0)    zero ┌─┐ │0│ └─┘    > zero 0    $ > zero 1    zero = <0 0    (>zero) = 0 1 Why in God's name does J consider a singleton list 0 equal to the scalar 0 but consider the boxed versions of each distinct?

Re: [Jprogramming] HMAC

2017-12-19 Thread bill lam
Wouldn't it type less if key=. 128{.x,128#{.a. or key=. 128{.!.({.a.)x On Dec 20, 2017 12:01 PM, "Scott Locklin" wrote: > This verb might be useful to someone at some point. Pretty > straightforward stuff, but fiddley and no point in reinventing the wheel > if someone else needs it. > > https://

Re: [Jprogramming] gpu-backed J vs Tensorflow

2017-12-19 Thread TongKe Xue
@dabrowski: In my experience, J beats Java-server-mode. J gets C level performance. I've never gotten C-level performance via Java. @bill: I'm happy to use "J restricted to floating points" -- I have no attachment to doubles. I guess no one has an argument for J+GPU beating wrappers-around-CUDA -

[Jprogramming] HMAC

2017-12-19 Thread Scott Locklin
This verb might be useful to someone at some point. Pretty straightforward stuff, but fiddley and no point in reinventing the wheel if someone else needs it. https://en.wikipedia.org/wiki/Hash-based_message_authentication_code NB. hmac signature NB. x key, y needs signature hmac=: 4 : 0  key=. x

Re: [Jprogramming] gpu-backed J vs Tensorflow

2017-12-19 Thread bill lam
One weakness of J for GPU is that J doesn't support single precision or half precision float but which are what GPU being commonly used for. The overhead of conversion from/to double precision may or may not be significant, it depends on applications, ymmv. On Dec 20, 2017 4:39 AM, "TongKe Xue" w

Re: [Jprogramming] viewmat export size

2017-12-19 Thread bill lam
Someone else should have ask that, but I forget. The image should already saved as ~temp/viewmat.png, its default size should also be capable of being changed by users. On Dec 20, 2017 9:49 AM, "Louis de Forcrand" wrote: Hi, Does anyone know how to save a viewmat image to disk, and if so, how t

[Jprogramming] viewmat export size

2017-12-19 Thread Louis de Forcrand
Hi, Does anyone know how to save a viewmat image to disk, and if so, how to chose the resulting image’s size? Thanks, Louis -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Another Quora problem

2017-12-19 Thread Raul Miller
Here's another approach: f=: [ * i.@<.@%~ 60 -.&(f&1000) 24 60 180 300 420 540 660 780 900 Of course, you could easily replace f with it definition (in parenthesis), since it's referenced only once. But this way it's easy to see what f is doing: 60 f 1000 0 60 120 180 240 300 360 420 4

Re: [Jprogramming] tail recursion optimization?

2017-12-19 Thread Raul Miller
I should add: the tail-recursion-like idiom is F^:test^:_ arg Thanks, -- Raul On Tuesday, December 19, 2017, Raul Miller wrote: > J's induction operation ( ^: ) is very similar to tail recursion (in terms > of data flow) except that it does not have full recursion as one of its > failure mod

Re: [Jprogramming] gpu-backed J vs Tensorflow

2017-12-19 Thread 'Pascal Jasmin' via Programming
One of the reasons I bound to arrayfire was that it provided one interface to AMD (opencl) and nvidia (cuda faster on it than opencl), and also to paralel cpu libraries if no gpu is available. A practicality downside is that arrayfire routines have a compilation step such that the first time

Re: [Jprogramming] tail recursion optimization?

2017-12-19 Thread Raul Miller
J's induction operation ( ^: ) is very similar to tail recursion (in terms of data flow) except that it does not have full recursion as one of its failure modes. -- Raul On Tuesday, December 19, 2017, Dabrowski, Andrew John wrote: > Is J a good language for using recursion? In particular does

Re: [Jprogramming] tail recursion optimization?

2017-12-19 Thread Henry Rich
J has elegant recursion facilities, but it doesn't support tail-recursion removal.  Not yet, anyway; we have a plan for doing so but it's low-priority. Henry Rich On 12/19/2017 5:10 PM, Dabrowski, Andrew John wrote: Is J a good language for using recursion? In particular does it do tail rec

Re: [Jprogramming] gpu-backed J vs Tensorflow

2017-12-19 Thread 'Skip Cave' via Programming
GPU programming interfaces: https://developer.nvidia.com/nvidia-gpu-programming-guide Skip Skip Cave Cave Consulting LLC On Tue, Dec 19, 2017 at 3:22 PM, Henry Rich wrote: > >Given that much of said works reduces to cuBlas + cuDNN, it seems like a >> GPU-backed-J, although more concise, w

Re: [Jprogramming] Another Quora problem

2017-12-19 Thread 'Skip Cave' via Programming
Jimmy's solution is nice, and fast as well. It answers the question that was posed, but I usually like to list the resulting numbers, just as a check. Of course, it's easy to get the resulting numbers using Jimmy's approach (which is also faster than the bulk elimination approach.) a#~*24|a=

[Jprogramming] tail recursion optimization?

2017-12-19 Thread Dabrowski, Andrew John
Is J a good language for using recursion? In particular does it do tail recursion optimization? -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] gpu-backed J vs Tensorflow

2017-12-19 Thread Dabrowski, Andrew John
Even when running java in server mode? On 12/19/2017 03:39 PM, TongKe Xue wrote: Hi, In my experience, on the CPU, J beats Java. I suspect this is due to Java's GC and J's ability to via "higher representation of ranks/loops" to run highly optimized code. Is there any reason to believe that

Re: [Jprogramming] Another Quora problem

2017-12-19 Thread Jimmy Gauvin
​​Explicit (and faster for larger range) : +/*24|60*i.>:<.1000%60 8 In this specific case is tacit necessary? useful? On Tue, Dec 19, 2017 at 1:52 PM, 'Skip Cave' via Programming < programm...@jsoftware.com> wrote: > How many numbers from 1 to 1000 are divisible by 60 but not by 24? >

Re: [Jprogramming] gpu-backed J vs Tensorflow

2017-12-19 Thread Henry Rich
Given that much of said works reduces to cuBlas + cuDNN, it seems like a GPU-backed-J, although more concise, would end up calling the same functions. I expect you're right.  I don't know what the interfaces to GPUs look like, but the goal would be to have the rank operator (gpufunc"2 for e

Re: [Jprogramming] Another Quora problem

2017-12-19 Thread chris burke
> I.1=#.|:0=24 60 |/i.1001 Slightly simpler: I. wrote: > Here's one approach: > >I.1=#.|:0=24 60 |/i.1001 > 60 180 300 420 540 660 780 900 > > Thanks, > > -- > Raul > > > On Tue, Dec 19, 2017 at 1:52 PM, 'Skip Cave' via Programming > wrote: > > How many numbers from 1 to 1000 are divisible

[Jprogramming] gpu-backed J vs Tensorflow

2017-12-19 Thread TongKe Xue
Hi, In my experience, on the CPU, J beats Java. I suspect this is due to Java's GC and J's ability to via "higher representation of ranks/loops" to run highly optimized code. Is there any reason to believe that GPU-backed-J would beat Tensorflow on Tensor / Deep Learning work ? Given that

Re: [Jprogramming] Another Quora problem

2017-12-19 Thread 'Skip Cave' via Programming
Thanks for the several nice solutions to the Quora problem. On Quora, most of the solutions to this type of problem are like Mike Day's approach, where they use logic to finesse the answer. I prefer the "brute force" approach, listing and eliminating candidates in bulk. J's array-handling primitiv

Re: [Jprogramming] Another Quora problem

2017-12-19 Thread Raul Miller
Here's one approach: I.1=#.|:0=24 60 |/i.1001 60 180 300 420 540 660 780 900 Thanks, -- Raul On Tue, Dec 19, 2017 at 1:52 PM, 'Skip Cave' via Programming wrote: > How many numbers from 1 to 1000 are divisible by 60 but not by 24? > > Here's my somewhat inelegant explicit solution: > >

Re: [Jprogramming] The n-cell model of an array

2017-12-19 Thread Raul Miller
Ok, yes - rank is itself a rank zero array. Empty shape, zero rank. Thanks, -- Raul On Tue, Dec 19, 2017 at 2:11 PM, Jimmy Gauvin wrote: > not empty rank rather o rank > > On Tue, Dec 19, 2017 at 2:01 PM, Raul Miller wrote: > >> An empty tank zero array would be inconsistent. >> >> The numb

Re: [Jprogramming] Another Quora problem

2017-12-19 Thread Henry Rich
   numaliquotsbelow =: <.@(%~ <:)    1000 -&(60&numaliquotsbelow - (60*.24)&numaliquotsbelow) 60 8    1000 -&(60&numaliquotsbelow - (60*.24)&numaliquotsbelow) 59 8    1000 -&(60&numaliquotsbelow - (60*.24)&numaliquotsbelow) 61 7    1000 -&(60&numaliquotsbelow - (60*.24)&numaliquotsbelow) 1 8 Henr

Re: [Jprogramming] Another Quora problem

2017-12-19 Thread 'Mike Day' via Programming
    q:24 60 2 2 2 3 2 2 3 5 So we can see that odd multiples of 60 are not divisible by 24,  while even ones are.    1000 >.@% 60 17 shows that there are 16 multiples of 60,  <: 1000 and greater than zero. 8 of these are even, divisible by 24,  and 8 odd,  not divisible by 24 .     60*1

Re: [Jprogramming] The n-cell model of an array

2017-12-19 Thread Jimmy Gauvin
not empty rank rather o rank On Tue, Dec 19, 2017 at 2:01 PM, Raul Miller wrote: > An empty tank zero array would be inconsistent. > > The number of elements in an array is the product of its dimensions, and > the multiplicative identity is 1, not 0. > > Thanks, > > -- > Raul > > On Tuesday, Dec

Re: [Jprogramming] The n-cell model of an array

2017-12-19 Thread Raul Miller
An empty tank zero array would be inconsistent. The number of elements in an array is the product of its dimensions, and the multiplicative identity is 1, not 0. Thanks, -- Raul On Tuesday, December 19, 2017, Jimmy Gauvin wrote: > Hi, > > Thinking about nothing, specifically about the empty

[Jprogramming] Another Quora problem

2017-12-19 Thread 'Skip Cave' via Programming
How many numbers from 1 to 1000 are divisible by 60 but not by 24? Here's my somewhat inelegant explicit solution: #e=.c#~d=.-.0=24|/c=.a#~b=.0=60|/a=.1+i.1000 8 NB. What are the numbers? e 60 180 300 420 540 660 780 900 How would I construct a more compact tacit solution? Skip

Re: [Jprogramming] The n-cell model of an array

2017-12-19 Thread Jimmy Gauvin
Hi, Thinking about nothing, specifically about the empty scalar or empty 0-cell. Erling H. - " I experience an inconsistency in this model in the sense that an array of rank greater than zero can be empty, a 0-cell can not." The internal structure of a J array could support a rank 0 empty objec

Re: [Jprogramming] The n-cell model of an array

2017-12-19 Thread Erling Hellenäs
The paper is here: http://www.jsoftware.com/papers/APLDictionary.htm /Erling Den 2017-12-19 kl. 16:00, skrev John Baker: Dictionary APL -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] The n-cell model of an array

2017-12-19 Thread John Baker
You might want to look up Ken Iverson’s 1980s era paper Dictionary APL. I believe Roger maintains an online version. This document clearly explains a lot of what you see in J. Sent from my iPhone > On Dec 19, 2017, at 7:22 AM, Raul Miller wrote: > > Well.. the issue I remember was that axis n

Re: [Jprogramming] The n-cell model of an array

2017-12-19 Thread Raul Miller
Well.. the issue I remember was that axis notation specifically and bracket notation in general was inconsistent with the rest of the syntax for APL. There were at least two ways out of this - one would be to generalize bracket notation (I think that K might have followed that path). The other wou

Re: [Jprogramming] The n-cell model of an array

2017-12-19 Thread Erling Hellenäs
Hi all! IBM, APL2 Programming: Language Reference http://publibfp.boulder.ibm.com/epubs/pdf/h2110611.pdf You were right in that a scalar was considered an array. There is a difference in that we used the AXIS notation instead of what is Rank? See page 55. This means the functions did not n

Re: [Jprogramming] AoC Day 11 - something is wrong

2017-12-19 Thread David Lambert
In particular I failed to realize that the optimal step might not be unique.  Before I boxed p=. p, Date: Mon, 18 Dec 2017 09:07:52 -0500 From: Raul Miller To: Programming forum Subject: Re: [Jprogramming] AoC Day 11 - something is wrong Message-ID: Content-Type: text/plain; charset="UT

Re: [Jprogramming] The n-cell model of an array

2017-12-19 Thread Raul Miller
I'm not completely sure what you are getting at here, actually. When I was learning APL, I was taught that a scalar was a rank zero array. And it seems to me that J uses the same design. If you look at J's 3!:1 and 3!:2 foreigns (or you can use 3!:3 instead of 3!:1 if you prefer), you'll see that

[Jprogramming] The n-cell model of an array

2017-12-19 Thread Erling Hellenäs
Hi all ! In APL we had the same array model as in Fortran. An array was an array and you indexed it like in most other languages, except that you could use an array as index and therefore could get very varying results. The only problems I personally experienced with this model was that you c