(". , ".) has the same issues as 7!:2 did. That is necessary because the
result of the sentence is used.
7!:2 per se doesn't affect the speed of the sentence it executes; but
the time a sentence takes depends greatly on the state of the caches,
including branch predictors. If you execute a se
Perhaps I'm getting too involved, but I noticed something else, which might
be related:
$(".) 'b=:1 (2 3 4) } b'NB. Elijah's b
10
executes instantaneously, whereas:
$(". , ".) 'b=:1 (2 3 4) } b'
20
takes about half a second (estimated).
Apparently there is no relation
Yesterday I was a bit surprised here that with (6!:2 , 7!:2) Elijah's
problem shows up, but with (7!:2, 6!:2) it does not. Also after Henry's
deep explanation I don't understand why it is like this, but okay, it's
solved in the next beta. The impression remains that somehow 6!:2 and/or
7!:2 influen
Impressive:
]cap =.(65+i.26){a.
ABCDEFGHIJKLMNOPQRSTUVWXYZ
]alphtest=.(?15#3){cap
CBACABCAACCBBBC
seqbx=.(<;.1~ 1, }.~:}:)
seqbx alphtest
┌─┬─┬─┬─┬─┬─┬─┬──┬──┬───┬─┐
│C│B│A│C│A│B│C│AA│CC│BBB│C│
└─┴─┴─┴─┴─┴─┴─┴──┴──┴───┴─┘
Thanks xash!
Skip Cave
Cave Consulting LLC
On Thu, Oct 21, 202
There are partition functions in general/misc/parts.ijs. For example:
load'parts'
partition 4 5 5 3 3 3 6 8 6 6 9 2 2 2
1 1 0 1 0 0 1 1 1 0 1 1 0 0
(partition <;.1 ]) 4 5 5 3 3 3 6 8 6 6 9 2 2 2
┌─┬───┬─┬─┬─┬───┬─┬─┐
│4│5 5│3 3 3│6│8│6 6│9│2 2 2│
└─┴───┴─┴─┴─┴───┴─┴─┘
O
Oh, or even simpler I guess:
(<;.1~ 1, }.~:}:) 0 1 0 1 1 1 0 0
On Thu Oct 21, 2021 at 7:14 PM CEST, xash wrote:
> (
> On Thu Oct 21, 2021 at 7:01 PM CEST, Raoul Schorer wrote:
> > Hi,
> >
> > Really trivial question I am stuck on:
> >
> > given a bit vector
> > 0 1 0 1 1 1 0 0
> >
> > how to easi
( Hi,
>
> Really trivial question I am stuck on:
>
> given a bit vector
> 0 1 0 1 1 1 0 0
>
> how to easily sequentially box 1s & 0s? Such as:
> |0|1|0|1 1 1|0 0|
>
> Thanks!
> Raoul
> --
> For information about J forums see http:/
Or more generally, how do you box sequential items that are identical?
|4|5 5|3 3 3|6|8|6 6|9|2 2 2|
Skip Cave
Cave Consulting LLC
On Thu, Oct 21, 2021 at 12:01 PM Raoul Schorer
wrote:
> Hi,
>
> Really trivial question I am stuck on:
>
> given a bit vector
> 0 1 0 1 1 1 0 0
>
> how to easily
Hi,
Really trivial question I am stuck on:
given a bit vector
0 1 0 1 1 1 0 0
how to easily sequentially box 1s & 0s? Such as:
|0|1|0|1 1 1|0 0|
Thanks!
Raoul
--
For information about J forums see http://www.jsoftware.com/forum
Solved, and fixed for next beta.
This is deep but I know Elijah likes it that way.
(7!:2 , 7!:2 , 7!:2 , 7!:2 , 7!:2 , 7!:2) 'b =: 1 (2 3 4)} b'
1408 1408 1408 1408 1073743328 1408
The problem is in the usecount of b. It starts at 1, as is fitting for
a value assigned to a name.
The fir
Wow, that's weird. I don't think it has to do with cache, because only
a tiny bit of the arguments are touched.
No, it has to do with inplacing:
b =: 1e9$0
(7!:2 , 7!:2) 'b =: 1 (2 3 4)} b'
1073743328 1408
(7!:2 , 7!:2 , 7!:2 , 7!:2 , 7!:2 , 7!:2) 'b =: 1 (2 3 4)} b'
1408 1408 1408 1
This looks like a cache liveness issue.
https://en.wikipedia.org/wiki/Cache_hierarchy#Multi-level_cache
I hope this makes sense,
--
Raul
On Thu, Oct 21, 2021 at 4:19 AM Elijah Stone wrote:
>
> a=: 1e6$0
> b=: 1e9$0
> timespacex 'a=: 1 (2 3 4}) a'
> 0.000395 1408
> timespacex '
Furthermore:
spacetimex =: 7!:2 , 6!:2@]
spacetimex 'a=: 1 (2 3 4}) a'
1408 1.9e_5
spacetimex 'b=: 1 (2 3 4}) b'
1408 1.9e_5
(this looks okay, but can't explain)
On Thu, 21 Oct 2021 at 21:11, Ben Gorte wrote:
> I thought I might know the answer, but it appears I do not.
> However, I no
I thought I might know the answer, but it appears I do not.
However, I noticed that they are equally fast when I use 6!:2 alone:
(1000) 6!:2 'a=:1 (2 3 4) } a'
2.378e_6
(1000) 6!:2 'b=:1 (2 3 4) } b'
2.316e_6
Also, with:
spacespacex =: 7!:2 , 7!:2@] NB. why?
you get:
spacespacex 'a=:1 (2
a=: 1e6$0
b=: 1e9$0
timespacex 'a=: 1 (2 3 4}) a'
0.000395 1408
timespacex 'b=: 1 (2 3 4}) b'
0.26758 1408
Since both of these operations take up the same amount of space, I assume
they are done in-place. But if that is the case, why does the latter take
longer?
--
15 matches
Mail list logo