Re: [Jprogramming] (no subject)

2017-10-02 Thread Erling Hellenäs
Hi all !    a=: 2 5 7    f=: 1 : '/:~(#: }. i. 2 ^ # y) ([: u/ #) /"1 y'    + f a 2 5 7 7 9 12 14    * f a 2 5 7 10 14 35 70 Cheers, Erling On 2017-10-02 19:45, Erling Hellenäs wrote: Hi all! You don't want the combination of zero elements?    a=: 2 5 7    /:~(#: i. 2 ^ # a) ([:+/#) /"1 1 a

Re: [Jprogramming] (no subject)

2017-10-02 Thread Roger Hui
http://code.jsoftware.com/wiki/Essays/Divisors What you have been asking for are computations on all possible subsets. When dealing with all possible subsets, start with the boolean matrix #:@i.@(2&^)@# . You can then do B +/ .* x for all sums or B */ . (^~) x for all products. Combinations are

Re: [Jprogramming] zmq - big step for J socket services

2017-10-02 Thread 'Pascal Jasmin' via Programming
There is a different J code path with windows and linux, not to mention underlying system differences. I made a repeat run with (J session that had been dormant for a day and) my echo modification, and it (qrun) hung, on the last "end task", and presumably on the kill__c command. I've tried th

Re: [Jprogramming] (no subject)

2017-10-02 Thread 'Bo Jacoby' via Programming
f=.[:+/]*[:|:(2#~#)#:[:i.2^# f 2 5 7 0 7 5 12 2 9 7 14 g=.[:*/]^[:|:(2#~ #)#:[:i.2^# g 2 5 7 1 7 5 35 2 14 10 70 NB. I didn't check if this solution has already been offered. I just coded it. Den 21:40 mandag den 2. oktober 2017 skrev Raul Miller : Perhaps this is closer to what you

Re: [Jprogramming] (no subject)

2017-10-02 Thread Skip Cave
My initial goal was to find all the divisors of a number, eg 100: Get the prime factors: q:100 2 2 5 5 Get all combinations of those prime factors (the power set) ps0 =: #:@i.@(2&^)@#<@#"1 _] ps0 q:100 ┌┬─┬─┬───┬─┬───┬───┬─┬─┬───┬───┬─┬───┬─┬─┬───┐ ││5│5│5 5│2│2 5│2

Re: [Jprogramming] (no subject)

2017-10-02 Thread Raul Miller
Perhaps this is closer to what you want? F=:1 :', u@> { (~. (u@#"0~ i.@>:)&.> #/.~) y' f=: /F *f 2 2 5 7 1 7 5 35 2 14 10 70 4 28 20 140 +f 2 2 5 7 0 7 5 12 2 9 7 14 4 11 9 16 I probably should just merge the two definitions together, but I think this works? (Note that I have sort o

Re: [Jprogramming] (no subject)

2017-10-02 Thread Skip Cave
Sorry about the wrong terminology. What i meant was: Given a vector of random integers (there may be duplicates), what is the most concise and or efficient way to generate a list of the numbers along with the sum of all combinations of the numbers in a single vector? How about the products of al

Re: [Jprogramming] (no subject)

2017-10-02 Thread Raul Miller
Prime factors of an integer are not, in the general case, a set. And you really should be careful to avoid specifying a set when what you want is not a set. You might be interested in https://rosettacode.org/wiki/Factors_of_an_integer#J ? That said, refinement is an important part of the specific

Re: [Jprogramming] zmq - big step for J socket services

2017-10-02 Thread Devon McCormick
I believe I once got wd to work in jconsole by building my own event-handler but don't think I have a working example to share. On Mon, Oct 2, 2017 at 12:11 AM, bill lam wrote: > jconsole and jhs can not run wd commands and I > don't think problem is qt related or can be solved > by qt. > > I ha

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Marc Simpson
On Mon, Oct 2, 2017 at 11:13 AM, Erling Hellenäs wrote: > And what would you call these posts. A factual discussion? /Erling Sure; a discussion with suggestions, differing opinions. I find dismissing replies as 'spam' a tad rude; let's try and keep conversation civil and friendly (on all sides)?

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Erling Hellenäs
And what would you call these posts. A factual discussion? /Erling On 2017-10-02 19:54, Marc Simpson wrote: On Mon, Oct 2, 2017 at 10:51 AM, Erling Hellenäs wrote: [snip] Normally, if I get spammed like this, I would assume that what I said WAS important, and I'd repost it and write more about

Re: [Jprogramming] (no subject)

2017-10-02 Thread Skip Cave
My original approach was even more naive than Marc's: NB. fromRoger Hui's Combinations essay on the J website: https://goo.gl/WL4nXn c=: ((= +/"1) |.@:I.@# ]) #:@i.@(2&^) NB. Roger called this 'comb2' NB. I used this definition because I could cut & paste one line, and not require an edi

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Louis de Forcrand
Beyond wether these tests are useful or not, you should run "ts" with a left argument, as a single run which lasts only 0.1 seconds can be somewhat imprecise. ts's left argument n is the number of times to run the string of code, and its result will be the total time elapsed divided by n. Cheer

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Marc Simpson
On Mon, Oct 2, 2017 at 10:51 AM, Erling Hellenäs wrote: > [snip] > Normally, if I get spammed like this, I would assume that what I said WAS > important, and I'd repost it and write more about it. Referring to on-list replies as 'spam' is rather insulting to those who take time to respond. --

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Erling Hellenäs
Hi all! If something is not interesting or important, a good general idea could be to not spend forum time on lengthy  discussions about it? Normally, if I get spammed like this, I would assume that what I said WAS important, and I'd repost it and write more about it. However, since this is a

Re: [Jprogramming] (no subject)

2017-10-02 Thread Erling Hellenäs
Hi all! You don't want the combination of zero elements?    a=: 2 5 7    /:~(#: i. 2 ^ # a) ([:+/#) /"1 1 a 0 2 5 7 7 9 12 14    /:~(#: i. 2 ^ # a) ([:*/#) /"1 1 a 1 2 5 7 10 14 35 70 Guess I could drop it. Cheers, Erling On 2017-10-02 18:49, Skip Cave wrote: Given a set of integers, what i

Re: [Jprogramming] (no subject)

2017-10-02 Thread Ben Gorte - CITG
http://code.jsoftware.com/wiki/Essays/Power_Set is an essay by Roger Hui about power sets, including a number of ways to generate these, such as: ps0 =: #:@i.@(2&^)@# <@#"1 _ ] ps0 2 5 7 ┌┬─┬─┬───┬─┬───┬───┬─┐ ││7│5│5 7│2│2 7│2 5│2 5 7│ └┴─┴─┴───┴─┴───┴───┴─┘ Now your f can be:

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Raul Miller
Well... hypothetically speaking, a case might be made for special code which evaluates -@- with a domain check and then ] -- but I guess we are not seeing anything useful about that case yet. And there's a small cost to special code, so we usually don't want it doing things people should not use.

Re: [Jprogramming] advancing in labs in jconsole

2017-10-02 Thread chris burke
In j806 console, to advance enter: lab 0 On Mon, Oct 2, 2017 at 10:18 AM, 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > How would I advance to next section in a lab with jconsole 8.06 (windows > 10)? > > | | Virus-free. www.avast.com | > > -

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Don Guinn
Detailed measurements are useful and meaningful if your application is performing badly. But general statements about poor performance in parts of an application that isn't used much is a waste of time. @ vs. @: is a concern but blanket proclamations is wrong. Today @ performs better than @: most

[Jprogramming] advancing in labs in jconsole

2017-10-02 Thread 'Pascal Jasmin' via Programming
How would I advance to next section in a lab with jconsole 8.06 (windows 10)? | | Virus-free. www.avast.com | -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] (no subject)

2017-10-02 Thread Marc Simpson
More naive than Raul's approach, first pass using the 'stats' lib: a=.2 5 7 require'stats' combv=: ] {~ (comb #@]) 3 combv a 2 5 7 2 combv a 2 5 2 7 5 7 1 combv a 2 5 7 combos=: (1 + i.@#) <@combv"0 1 ] combos a ┌─┬───┬─┐ │2│2 5│2 5 7│ │5│2 7│ │ │7│5 7│ │ └─┴───

Re: [Jprogramming] (no subject)

2017-10-02 Thread Raul Miller
For a first effort, I would go with F=:1 :'(u@#~ #:@i.@(2^#))@~.' f=: /F Hopefully that makes the issues obvious - the specification here calls for a result which grows exponentially with the size of the argument set. Also: The ~. might be extra work, but for typical cases the effort of ens

[Jprogramming] (no subject)

2017-10-02 Thread Skip Cave
Given a set of integers, what is the most concise and or efficient way to list the numbers along with the sum of all combinations of the numbers? the products of all combinations? for example: a =. 2 5 7 + f aNB. 2, 5, 7, (2+5), (2+7), (5+7), (2+5+7) 2 5 7 7 9 12 14 * f aNB. 2, 5, 7, (2*

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Raul Miller
I actually don't think these particular measurements are all that relevant. And I guess I should apologize for not making that clear. That said, I think timing the test suite which comes with j source (except for the *t.* files -- too many race conditions there) is kind of interesting. Thanks, -

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Erling Hellenäs
You are welcome to show us better measurements if you think these measurements are very important and worthy of a lengthy discussion in the forum. /Erling On 2017-10-02 17:53, Raul Miller wrote: The null case here should be ] (-@- -: ]) v 1 Thanks,

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Erling Hellenäs
Hi all ! Here are the same measurements with Bill Lams proposed way to measure this. As we can all see it is lousy because the overhead in the measurement loop is much higher than that in @.    n=.50    v=.?~n    $v 50    10{.v 414253 208033 396027 190208 112248 196018 51503 465441 27

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Raul Miller
The null case here should be ] (-@- -: ]) v 1 Thanks, -- Raul On Mon, Oct 2, 2017 at 11:48 AM, Erling Hellenäs wrote: > Hi all ! > > Here are the same measurements with a null case we can deduct, if we want to > know the exact speed on my particular machine. > >ts'-AtTacit-AtTacit-AtT

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Erling Hellenäs
Hi all ! Here are the same measurements with a null case we can deduct, if we want to know the exact speed on my particular machine.    ts'-AtTacit-AtTacit-AtTacit-AtTacit-@- v' 0.261088 1.32199e8    ts'-AtTacit-AtTacit-AtTacit-AtTacit-AtopTacit- v' 0.264798 1.322e8    ts'-At-At-At-At-Atop- v'

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Erling Hellenäs
Well, I do some observations and if anyone finds them interesting he can respond. Anyone can do their own measurement. It does not obviously improve the discussion to look for all kinds of perceived faults in peoples posts and start discussion these, instead of the subject of the thread? /Erlin

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Erling Hellenäs
Yes, I was not sure if it might only concern the Unix binaries, but since it worked on my machine it seemed to concern the Windows binaries too. Thanks for clearing it out.  /Erling On 2017-10-02 17:26, Jose Mario Quintana wrote: " I guess the Jx j.dll is compiled without it." That is correct

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Jose Mario Quintana
" I guess the Jx j.dll is compiled without it." That is correct, both, the provided dll and the so binaries do not support avx as stated in the release post: " Jx 1.1 Release A Jx v1.1 Extensions Guide, a J/Jx Cheatsheet, a Jx Assertions script together with links to a Windows 64 bit dll, a Uni

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Raul Miller
Believe me, I understood that. But this particular performance measure is rather like measuring the performance of tires sliding sideways (as opposed to rolling) in a parking lot while carrying several hundred pounds of meatloaf. In other words, it's not something I would feel comfortable optimiz

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Erling Hellenäs
Even  if Raul wouldn't consider them meaningful for some reason I don't understand it seems he should still understand that they are performance measurements? That I am creating a loop over a piece of code to measure the performance of this piece of code?  /Erling On 2017-10-02 17:01, Don Guin

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Don Guinn
How many times do you have to be told that these kinds of measurements and meaningless? On Oct 2, 2017 8:57 AM, "Erling Hellenäs" wrote: > How many times do I have to tell that I do this to measure performance? > /Erling > > On 2017-10-02 16:39, Raul Miller wrote: > >> Generally speaking, you wa

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Erling Hellenäs
How many times do I have to tell that I do this to measure performance? /Erling On 2017-10-02 16:39, Raul Miller wrote: Generally speaking, you want to push the large arrays into J's primitives as much as possible. Going the other direction, like you're doing here (using relatively expensive fu

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Raul Miller
Generally speaking, you want to push the large arrays into J's primitives as much as possible. Going the other direction, like you're doing here (using relatively expensive functions at rank 0 on relatively large arrays) is mostly going to bog down. Thanks, -- Raul On Mon, Oct 2, 2017 at 9:42

Re: [Jprogramming] Composition conjunctions

2017-10-02 Thread Erling Hellenäs
Hi all ! These measurements are with Jx j.dll on the latest Beta release.    n=.50    v=.?~n    $v 50    10{.v 50689 85238 136693 442735 25192 304048 139323 96663 216893 142946    ts'-AtTacit-AtTacit-AtTacit-AtTacit-@- v' 0.1156 4.19917e6    ts'-AtTacit-AtTacit-AtTacit-AtTacit-AtopTacit-

[Jprogramming] Composition conjunctions

2017-10-02 Thread Erling Hellenäs
Hi all ! I tried to create explicit and tacit definitions of our composition conjunctions. I think the result could possibly be used to clarify the descriptions in NuVoc. Opinions are welcome, there are probably still some bugs or misunderstandings of function, there could be interesting asp