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
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
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
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
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
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
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
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
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
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)?
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
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
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
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.
--
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
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
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:
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.
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 |
>
> -
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
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
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│ │
└─┴───
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
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*
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,
-
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,
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
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
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'
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
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
" 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
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
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
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
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
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
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-
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
39 matches
Mail list logo