I am trying to write a function to find all cycles on a (not necessarily
connected) undirected graph. Two cycles are equivalent if they contain the
exact same edges, regardless of edge order.
My method follows. I am essentially doing a DFS on the edges (not vertices),
after first partitioning th
3 2 4 2 5 2 6 3 4 3 5 3 6 4 5 4 6 5 6
Thanks,Jon
On Friday, September 18, 2015 8:09 PM, 'Jon Hough' via Programming
wrote:
I am trying to write a function to find all cycles on a (not necessarily
connected) undirected graph. Two cycles are equivalent if they contain the
se.continue.end.end.CYCLES)
NB. some graphsg1=: 10 2 $ 1 2
1 3 2 3 3 4 5 6 5 7 6 8 8 9 7 9 5 9g2=: 10 2 $ 1 10 11 12 12
13 14 16 15 17 15 18 15 19 16 19 18 19 19 20NB. k5k5=: 10 2
$ 1 2 1 3 1 4 1 5 2 3 2 4 2 5 3 4 3 5 4 5NB. k33k33=: 9 2 $
1 4 1 5 1 6 2 4 2 5 2 6 3 4 3 5 3 6k6=: 15 2 $ 1 2 1
COMP=.
connected_components y
a:-.~
component_cycles&.> CONCOMP
)
Is there something before
this?
Regards,
Devon
On Fri, Sep 18, 2015 at 8:04 AM, 'Jon
Hough' via Programming <
programm...@jsoftware.com>
wrote:
> Third time
lucky...
>
> I am
try
AM, Devon McCormick
wrote:
> Hi -
>
> The first piece of your code is
ungrammatical:
>
>
CONCOMP=. connected_components y
> a:-.~
component_cycles&.> CONCOMP
> )
>
> Is there something
before this?
>
>
Regards,
>
> Devon
I have a couple of verbs to represent a complete (undirected) graph as a list
of edges. Clearly there are "N choose 2" edges that need to be generated. This
is my code
complete =: 3 : 0
nodes =. i. y
getEdges nodes
)
getEdges =: 3 : 0
if. 1 > # y do.
else.
h =. 1{.y
t =. 1}.y
((h&,)"0 t ), get
Sorry, the second verb should be
getEdges =: 3 : 0
if. 1 > # y do.
else.
h =. 1{.y
t =. 1}.y
((h&,)"0 t ), getEdges t
end.
)
(changed getNodes to getEdges)
On Sat, 9/26/15, 'Jon Hough' via Programming wrote:
Subject: [
es)
>
>
>
--------
> On Sat, 9/26/15, 'Jon Hough' via
Programming
wrote:
>
> Subject: [Jprogramming]
Generate Complete Graphs
> To: "Programming
Forum"
> Date: Saturday, September 26,
2015, 10:16 P
1 4
>> 2 3
>> 2 4
>> 3 4
>>
>> 3 comb 4
>> 0 1 2
>> 0 1
3
>> 0 2 3
>> 1
2 3
>>
>>
>> -Original Message-
>> From: programming-boun...@forums.jsoftware.com
>> [mailto:programming-boun...@forums.jsoft
I was trying to dissect one of the answers to my "Complete Graphs" question:
dissect '5 5 #:I.,-.+/\=i.5'
In the answer I. looked like |., which threw me off for a brief moment.
However, I just rechecked on a Mac and the I. character has serifs, so it is
very clearly distinguished from |. , an
I thought I would have a go at creating a very simple bloom filter in J. I used
a boolean array as the backing data structure. It seems to work ok:
Bloom filters are nice data structures for holding lossy information about
items you stick in them. You can't retrieve the items but you can perform
Devon McCormick wrote:
Subject: Re: [Jprogramming] A simple bloom filter
To: "J-programming forum"
Date: Tuesday, November 3, 2015, 1:32 AM
Is there a good aspect to
reporting false positives?
On Mon, Nov 2, 2015 at 10:31 AM, 'Jon
Hough' via Programming <
progr
Apologies if this is the wrong forum.
I'm currently on this page
http://www.jsoftware.com/primer/phrases.htm
which I got to using the search function. (Query: statistics site:jsoftware.com
4th or 5th link )
Various links at the top of the screen, including "!:", "Voc", "wd", "help" give
"The r
I'm reading through the stats/base addon script. (stats/base/distributions.ijs)
Verb definitions here:
http://www.jsoftware.com/docs/help602/user/script_statdist.htm
There doesn't seem to be any definition of a geometric distribution here. Are
there any geometric distribution verbs defined anywh
he entire list
doesn't need to be held in
memory or
downloaded, but rather just the bloom filter. For example,
a
client could only have the bloom filter
and a server could have the full
list
available.
When the client
accesses a URL, it could check it's local bloom filter
and
Just an idea... a verb insert_transpose.
NB. insert transpose...
insrt =: (0;0)}
insert_transpose = insrt&.|:
16 insert_transpose (i. 4 4)
On Mon, 11/9/15, Linda A Alvord wrote:
Subject: [Jprogramming] This should be easy
To: programm...@jsoft
Sorry, I just reread your post and my reply is completely irrelevant. Please
ignore it.
On Mon, 11/9/15, 'Jon Hough' via Programming wrote:
Subject: Re: [Jprogramming] This should be easy
To: programm...@jsoftware.com
Date: Monday,
I noticed hfd / dfh have similar problems.
dfh hfd _17
239
On Fri, 11/13/15, Raul Miller wrote:
Subject: Re: [Jprogramming] twos complement
To: "Programming forum"
Date: Friday, November 13, 2015, 8:03 AM
On Thu, Nov 12, 2015 at
5:37 PM, 'Pa
_base is infinity - infinity*i , apparently. Is that the weird part?
On Mon, 12/7/15, Linda A Alvord wrote:
Subject: [Jprogramming] Very strange..
To: programm...@jsoftware.com
Date: Monday, December 7, 2015, 5:01 PM
What is happening here?
I've spent an hour on this, and am frustrated that I couldn't figure out a way
to do it (without using for_j or while).
I want to get all pairs ( pair order not important e.g. 2 3 is the same as 3 2)
of integers up to some value.
e.g. up to 4:
0 1
0 2
0 3
1 2
1 3
2 3
in frustration this is wh
wrote:
> http://www.jsoftware.com/jwiki/Essays/Odometer
might interest you.
>
> Thanks,
>
> --
> Raul
>
>
>
On Fri, Dec 18, 2015 at 7:58 AM, 'Jon Hough' via
Programming
>
wrote:
>> I've spent an hour on
this, and am frustrated tha
I created a toy genetic algorithm program to solve the traveling salesman
problem for a randomly generated graph (cities with distances). It's not
written in very J-like code unfortunately. It also seems pretty slow, possibly
due to lots of in-place assignments. Anyway, it might interest you.
N
e min cost
stops changing
> > NB.
for a set number of iterations.
>
> c=. 0
>
> for. i.#x do.
>
> c=. c + 1
> >
nextchildren=. MATING_POP+0 1
> > for_j. i.
SELECTED_POP do.
> >
choice=. ?SELECTED_POP
>
> newGeneratio
all things considered.
On Tue, 12/22/15, 'Jon Hough' via Programming wrote:
Subject: Re: [Jprogramming] Genetic algorithms?
To: programm...@jsoftware.com
Date: Tuesday, December 22, 2015, 6:28 PM
Thanks, Raul. It's a good point. This
I think it is because you are finding quadratic residues (
https://en.wikipedia.org/wiki/Quadratic_residue ), not simple residues.
In general, you are looking for the solution to
x^2 = q mod n,
i.e. looking for some x such that
n | (*: x)
is equal to q, for a given q. A solution does not nec
As an addendum,
in general to find if q is a quadratic residue modulo n, you need to calculate
the jacobi symbol (n/q), (not to be confused with the jacobian).
I wrote a method to do this... in Java...
https://github.com/jonghough/Java-Numbers/blob/master/src/algorithms/JacobiSymbol.java
but
In case anyone is interested, I wrote a verb to calculate the Jacobi symbol for
positive integers n,m (n/m), although my J syntax is pretty awkward:
NB. Jacobi symbol (x/y)
NB. x is numerator (positive int, or zero)
NB. y is denominator (positive int)
jac=: 4 : 0
numer=. x
denom=. y
jacobi=. 1
i
dons/math/misc/legendre.ijs. Should this
be added to that directory?
On 5 January 2016 at 02:50, 'Jon Hough'
via Programming <
programm...@jsoftware.com>
wrote:
> In case anyone
is interested, I wrote a verb to calculate the Jacobi
> symbol for positive integers n,m (
This looks very interesting. Is it possible for non-contributors to clone the
repo?
Also, I noticed from browsing the commit history that there is only one branch.
It might be better to make a develop branch and use something like git-flow
http://nvie.com/posts/a-successful-git-branching-model/
I don't think for a minute that this will be the most terse or most elegant but
this is what I got:
animals =:
'bird';'cow';'cow';'dog';'cow';'cow';'cow';'bird';'dog';'cat';'dog';'pig';'dog';'bird';'pig'
ids =: 1;2;3;4;5;6;7;8;9;10;11;12;13;14;15
f =: (((1,~ #) $])@:~.@:]) ,. (]/.)~
ids f ani
------------
On Fri, 3/4/16, 'Jon Hough' via Programming wrote:
Subject: Re: [Jprogramming] J Challenge
To: programm...@jsoftware.com
Date: Friday, March 4, 2016, 6:34 PM
I don't think for a minute that this
will be the most terse or most elegant but this is what I
got:
Thanks,
This is only for personal study. I'm going through a Machine Learning textbook,
and am trying to implement some of the
algorithms in J, for study use only. I'm on the chapter on Support Vector
Machines, which require QP. But I'm thinking I might just try to
transliterate another languag
As a fellow beginner (learning for well over a year, on and off), I'll show a
way I would do it:
isAnagramOf =: -:&:(-.&' '@:/:~@:tolower)
I think Henry mentioned using the above conjunctions.
Also, as Henry said, Dissecting the verb is a great way to see what happened.
NB. name the string lite
I'm pretty sure there used to be some sort of style guide in the wiki (the old
wiki). But I cannot find any trace of it, so I possibly imagined it.
Anyway, does anyone have a style guide they could share, or point me to one in
the wiki? I'm talking about things like camelCase vs snake_case, verb
Yes, thanks Dan,
this is pretty much what I was looking for.
Thanks,
Jon
On Thu, 3/17/16, Joe Bogner wrote:
Subject: Re: [Jprogramming] Style guide
To: programm...@jsoftware.com
Date: Thursday, March 17, 2016, 11:22 AM
Dan, thank you very much
My JVERSION::
JVERSION
Engine: j803/2014-10-19-11:11:11
Library: 8.03.13
Qt IDE: 1.3.1/5.3.2
Platform: Darwin 64
Installer: J803 install
InstallPath: ...my/install/path
(yes, still on J803!)
load 'debug/lint'
lint ' ~addons/debug/dissect/dissect.ijs'
works. (Incidentally dissect has 9
Also,
load 'debug/lint'
(command + K)
lint ' ~addons/debug/dissect/dissect.ijs'
results in the same crash.
----
On Tue, 3/22/16, 'Jon Hough' via Programming wrote:
Subject: Re: [Jprogramming] Help, please - cra
Henry, you were right... kind of. I was using old versions of lint and dissect.
Now I have upgraded to
dissect version 4.6.6
lint version 1.18.9
... and I get 12 errors.
If you think this is an issue, I can start a new thread and show you the error
list. This thread might not be the best plac
As part of some OCaml self-study, I have created Ocaml bindings for Libj.so /
j.dll, that may be useful to somebody (although probably not).
https://github.com/jonghough/ocaml2j
I have only tested and run this on 32-bit Linux, so I don't know how much work
will be needed to support other platfo
I am sure there is a simple answer to this, but I would like to know it.
Say I have two matrices:
a =: 1 4 $ 1 2 3 4
b =: 2 4 $ 10 11 12 13 14 15 16 17
and I want to multiply a's single row element-wise with each of b's rows. Not
matrix multiplication, so the resulting matrix should have dimens
you can multiply-1:
>
> (,a) *"1 b
> 10 22 36 52
> 14 30 48
68
>
> Do you really
need a to be 1xn ?
>
>
> On Mon, Apr 18, 2016
at 11:41 AM, 'Jon Hough' via Programming <
> programm...@jsoftware.com>
wrote:
>
>> I am
sure there
Monday, April 18, 2016 4:49 AM
Subject: Re: [Jprogramming] Simple scalar
multiplication of matrices
If you remove the first axis of a you can
multiply-1:
(,a) *"1
b
10 22 36 52
14 30 48 68
Do you really need a to be 1xn
?
On Mon,
Apr 18, 2016 at 11:41 AM, 'Jon Ho
I don't have an explicit solution, but two ideas that spring to mind are:
(a) Partition problem (similar to knapsack)
https://en.wikipedia.org/wiki/Partition_problem
If you are trying to minimize the difference in sizes, then consider the
set S of integers representing your file sizes and f
I'm sure this isn't what you are looking for but I had some time today, so I
calculated Nivens constant using the zeta function and bernoullis. My guess is
that it is computationally less expensive than using q:
Step 1: Generate Bernoulli Numbers. We get a list of (even) Bernoulli numbers
up to
nivens constnat
mean >./@(0&,)@(_&q:)"0 }.i.1e6
1.70519
The first 1 million ints gives a closer approximation.
------------
On Wed, 7/6/16, 'Jon Hough' via Programming wrote:
Subject: Re: [Jprogramming] Niven's constant
To: program
Hi Raul,
"But is it possible to perform this calculation in a reasonable fashion
using d. (or D.)?"
I'm no expert, but I doubt it. In the first answer to the question in your
link, the user gave a comprehensive answer for calculating the case of a unit
square. I think it can be extended to the
Raul,
your solution seems to miss out some vertices and duplicates others.
On Thu, 8/25/16, Raul Miller wrote:
Subject: Re: [Jprogramming] determine the cycle
To: "Programming forum"
Date: Thursday, August 25, 2016, 9:07 PM
Best I can come up
I think it depends on the definition of "cycle". A simple cycle is usually
defined to be a cycle that never crosses itself. So in that case, your cycle is
not simple. (and you could keep appending itself to itself ad infinitum, so is
pretty pointless to consider non-simple cycles)
By the way, th
p. 49 1 0 0 0 1
also crashes J
(J804, Windows 7 64)
On Tue, 8/30/16, Andrew Nikitin wrote:
Subject: [Jprogramming] p. bug
To: "J programming"
Date: Tuesday, August 30, 2016, 10:21 PM
p. _48 1 0 0 0 1
crashes j.
Tried with 803 and earlier.
Given a list of numbers, find the greatest increasing subsequence of the list.
e.g if list is 6 1 3 4 2 8 then the greatest increasing subsequence is 1 3 4 8.
My solution:
NB. find greatest increasing subsequence of number list.
NB. example list
l =: 7 4 4 5 2 7 1 8 13 2 10 4 9 1 4 5 5 4 3 10
This is a leetcode question:
https://leetcode.com/problems/count-and-say/
Description:
The count-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, ...
1 is read off as "one 1" or 11.
11 is read off as "two 1s" or 21.
21 is read off as "one 2, then one 1" o
le =:(3 : 'str=: str, (":@:# , {.) t' )]((3 :'t=:t,{.y')]}.)^:(3 :
'(h&=@:{.y)')^:_
calc =: takewhile^:(3 : ' t=: '''''](0&<@:#)[(3 : 'h=:{.y'))^:_
val=. ((3 : 'str')[calc)^:(3 : 'ctr:ctr')^:_
Just out of interest, I compared the various results.
I wrote a fully imperative version, which uses in-place modification of the
results array.
I also wrote a version that avoids any while / for loops (because I wanted to
avoid using them), and ended up putting
most of the logic in anonymous v
is particularly interesting, but it
avoided that explicit while loop.
>
> Mike
>
> Please reply to mike_liz....@tiscali.co.uk.
> Sent from my iPad
>
>> On 5 Sep 2016,
at 08:07, 'Jon Hough' via Programming
wrote:
>>
>>
This also works
(_1+i.5)&{~^:(<4)
so you could have used the & conjunction. I'm not sure what you version was
actually doing, or how it got stuck in a loop.
On Wed, 9/7/16, 'Jon Hough' via Programming wrote:
Subject: R
rly interesting, but it
avoided that explicit while loop.
>>
>> Mike
>>
>> Please reply
to mike_liz@tiscali.co.uk.
>> Sent from my iPad
>>
>>> On 5 Sep
2016, at 08:07, 'Jon Hough' via Programming
wrote:
>>>
>>>
details:
Engine: j804/j64/windows
Release: commercial/2015-12-21 16:18:48
Library: 8.04.15
Qt IDE: 1.4.10/5.4.2
Platform: Win 64
Installer: J804 install
----------------
On Wed, 9/7/16, 'Jon Hough' via Programming wrote:
Subject: Re: [Jprogramming]
This is largely pointless, but may be interesting. Below is a process for
calculating the function Z(x), for complex value x, where the real part = 0.5,
and imaginary part > 0. The zeros of
Z(x) are the zeros of the Riemann zeta function, for values with real part =
0.5.
https://en.wikipedia.o
This is a programming challenge from here:
https://leetcode.com/problems/zigzag-conversion/
The challenge is to convert a string into a "zig zag" formation with the given
number of rows.
e.g. (from the link)
PAYPALISHIRING is transformed into PAHNAPLSIIGYIR (the link explains clearly
this trans
example:
4 convert 'PAYPALISHIRING'
PINALSIGYAHRPI
Here converting to a zigzag with 4 rows.
This result looks right, looking at the zigzag below: (hopefully the formatting
wont be too messed up).
0 : 0
P I N
A L S I G
Y A H R
P I
)
-
4 5 cv each/
'';'paypa';1 2 3
4;'paypalishiring'
++-+---+--+
||paapy|1 2 4 3|pahnaplsiigyir|
++-+---+--+
||payap|1 2 3 4|pinalsigyahrpi|
++-+---+--+
||paypa|1 2 3 4|phasiyirpligan|
++-+-------+--+
Any use?
ad will result in a
domain error.
In my example tableau for
depth 5, I should have pointed out
that the
differences between columns are alternately 8 6 4 2 0 and 0
2 4 6 8
Any clearer?
Mike
On
27/09/2016 14:22, 'Jon Hough' via Programming
wrote:
> Sorry, I gave the corr
t;:
> l, the length
> of the input string.
>
> l<. ... limits the
indices to <: l
>
>
l -. ~ ~. removes l from the nub of indices
>
> y{~ ... reorders the
input array as required.
>
> Mike
>
>
>
>
On 27/09/2016 14:49, 'Jon
timate of the
remaining number of
>> colums after
"start"
>>
>> +/\start, nstep$difs calculates the
indices, in general with some >:
>> l, the length
>>
of the input string.
>>
>> l<. ... limits the indices to <:
l
>>
>> l -.
One way to provide this kind of thing is to use J transpiled to Javascript [0]
(I hope Joe Bogner doesn't mind me plugging his repo).
You can run this to try out all the J primitives (more or less). And its all in
the browser so the website hosting it needs no extra backend infrastructure.
I thi
I'm not sure what the rule is, but if you do:
g =: ]
a =: 1 : 0
h =. u
g =. +:
h y
)
g a 1
NB. what is g?
g
it shows g as ],
i.e Global g doesn't get reassigned.
Also,
g =: ]
a =: 1 : 0
g =. u
g y
)
^ a 1
NB. what is g?
g
shows ],
so global g doesn't get reassigned here either. But the g i
Hi, Welcome to the J forums.
I would like to help, but I don't understand what you are asking. Perhaps
others will understand better.
By *in*, do you mean the "Member in" verb?
http://code.jsoftware.com/wiki/Vocabulary/edot
On my pretty old spec 32-bit machine:
a =: ? #~ 1000 NB. 10 mill
I wrote an Object Oriented implementation of a hashmap a while ago:
https://github.com/jonghough/msgpack-j/blob/master/hashmap.ijs
It's not brilliant but I have used it for some things.
e.g.
hm =: '' conew 'HashMap'
set__hm (1; 'hello')
get__hm 1
It can also contain other hashmaps as values -
There's always FParsec:
(F# code) Something like...
let InsideParens = pstring "(" >>. (manyChars (noneOf ")")) .>> pstring ")"
will parse all characters between ( and ) but will not check if the enclosed
characters also have balanced parentheses. For that you will need to change the
parser st
I want to get the max value of a list, and return the first index of its
occurrence in the list, tacitly.
My solution
maxWithIndex =: {.@:I.@:(= >./), >./
works ok, but calculates >./ twice. Is there a tacit way to do this with only a
single calc of >./ ?
Thanks,
Jon
ing] Return of max of list and it's index in single pass
To: programm...@jsoftware.com
Date: Wednesday, January 25, 2017, 12:02 PM
(i. >./)
From section 1.6.6 of
http://code.jsoftware.com/wiki/Vocabulary/SpecialCombinations
Henry Rich
On 1/24/2017 9:58 PM, 'Jon Hough
y 25, 2017, 12:01 PM
maxIndexAndValue=:
((i.,]) >./)
I hope this
helps,
--
Raul
On Tue, Jan 24, 2017 at 9:58 PM, 'Jon
Hough' via Programming
wrote:
> I want to get the max value of a
list, and return the first index of its occurrence in the
list, tacitly.
>
>
Given an array, we can calculate the softmax function
https://en.wikipedia.org/wiki/Softmax_function
a =: 0.5 0.6 0.23 0.66
sm=:(] % +/ )@:^ NB. softmax
sm a
0.247399 0.273418 0.188859 0.290325
The (partial) derivative of softmax is a little more complicated:
If the array is of length N, we n
ax y
>
for_j. i.#vals do.
> if. j_index. =
i_index. do. rx=. rx , smx * (1 - smx)
>
else. rx=. rx ,(j softmax y)* (0 - smx) end.
> end. end.
> rx
> )
>
>
> - Original
Message -
> From: 'Jon Hough'
via Programming
> To: Prog
;>
>>
>> dsoftmax=: 4 : 0
>> rx=. ''
>> for_i. x do.
>>
smx=. i softmax y
>> for_j. i.#vals
do.
>> if. j_index. = i_index. do.
rx=. rx , smx * (1 - smx)
>> else.
rx=. rx ,(j softmax y)* (0 - smx) end.
>> end. end.
>&g
8305 0.206036
This returns the whole matrix, but it's
easy enough to save the output,
and extract
the indexed elements you need.
Or have I misunderstood the specification?
Mike
On 27/02/2017
08:09, 'Jon Hough' via Programming wrote:
> Given an a
D. and d., especially
higher derivatives. Have a look at it before
you get too far committed.
Henry Rich
On
2/27/2017 6:45 PM, 'Jon Hough' via Programming
wrote:
> Thanks, the dsoftmax is going to
be used for a toy Multilayer Perceptron Classifier I am
writing. Usin
I haven't attempted that Project Euler Question. But I did implement a priority
queue a while back.
I just put it here:
https://gist.github.com/jonghough/e3566dcfea95e4dbc5b23f9295388df6
It can handle arbitrary comparators, i.e. any verb returning 0 or 1. However, I
doubt it is of much use, bec
I just tried it and got the right answer. But my approach is essentially brute
force:
I basically stringified (":) the totient result, sorted it, and compared to
the sorted stringified original number.
I can be more specific if you like.
Regards,
Jon
---
supply what they
wanted. I supplied the first number that had
as a permutation of the digits given sorted by
(%totient)n . I cheated.
Stole totient from
J phrases.
The only thing I
can think of is that they wanted something other than the
n that I found.
On Tue, Mar 14, 2017 at 8:12 PM,
+ 1.
If you want to look at my answer, it is here:
https://github.com/jonghough/projecteulersolutions/blob/master/answers/projecteuler70.ijs
On Wed, 3/15/17, 'Jon Hough' via Programming wrote:
Subject: Re: [Jprogramming] Project Euler
I stumbled across this Stackoverflow question[0], based on an old puzzle, and I
really liked some of the answers. And of course, I started thinking how to do
it in J.
Has anyone written a J solution to this problem?
[0]
http://stackoverflow.com/questions/31/solving-who-owns-the-zebra-pro
I have a NxN matrix.
For each 2x2 subarray of this (keep it simple, N is even), I want to calculate
the maximum value and if the value of that cell equals the maximum of the 2x2
subarray write 1, else write 0.
e.g.
NB. T arbitrary 10x10 matrix
T =: 10 10 $ 0 _2 12 100 2 4.5 1 7 _5.5 3.2 120 2 _
:"2 <"1 > IsMax
Also creates the correct array.
------------
On Wed, 3/29/17, 'Jon Hough' via Programming wrote:
Subject: [Jprogramming] Unboxing after subarray function
To: "Programming Forum"
Date: Wednesday, March 29,
10 10 array ? If so, you gave this:
10 10 $ , > |:"2 <"1
> IsMax
Then my
suggestion is this (which reproduces your final line
only):
>,"1&.>/
,&.>/ IsMax
HTH,
Regards Rob
> On 29 Mar 2017, at 6:54 pm, 'Jon
Hough'
change the “ to the J form (just
retype this character after you copy/paste the line) …
this works likewise for the 3x3 cells…/Rob
> ,”1 &. > / , &.
> / IsMax
> On 29
Mar 2017, at 8:38 pm, 'Jon Hough' via Programming
wrote:
>
> Yes, the
200 200 200
> (= maxes) T
> 0 0
0 0 0 0
> 0 0 1 0 0 0
> 0 0 0 0 0 1
> 0 0 0 0 0
0
> 0 0 1 0 0 0
> 0 0
0 0 0 1
>
> Like
that?
>
> Thanks,
>
> --
> Raul
>
>
> On Wed, Mar 29, 2017
at 5:38 AM, 'Jon Hough' via Pr
I created one a while ago.
https://github.com/jonghough/msgpack-j/blob/master/hashmap.ijs
This is a crude implementation of a hashmap, using separate chaining.
Admittedly, it isn't particularly great. E.g. hashing function implementation
isnt very good. It uses symbols to represent inner hashmaps
ly don't have multiple things you're after:
> vals=. (keys i. names) { values
>
>Or, if you must have shorter lines (never mind that we're already more
>concise than a variety of implementations of dictionaries):
> v=.V{~k i.nm
>
>(or skip the assignment and plug the e
I'm no J guru, but
instead of
NP 1 $ 1
you should probably do
(NP, 1) $ 1
On Sat, 4/15/17, Michael Goodrich wrote:
Subject: [Jprogramming] J weirdness 0
To: programm...@jsoftware.com
Date: Saturday, April 15, 2017, 10:41 PM
OK J gurus, I fail
I have followed the instructions here
http://code.jsoftware.com/wiki/Guides/Qt_IDE/Install
The directories
/usr/bin
/usr/lib/x86_64-linux-gnu/
/usr/share/j/8.05
/etc/j/8.05
appear to have the correct files. I also installed the two libs:
sudo apt-get i
Thanks, so should I run jqt as root normally? Or only to use packman?
On Sun, 5/7/17, bill lam wrote:
Subject: Re: [Jprogramming] Problem Installing J805 on Ubuntu 16.10
To: "'Jon Hough' via Programming"
Date: Sunday,
Not sure if this helps. I would say bitshifting/masking would be a good
approach, but your values are too big, but you can do a slower bitshift /mask
with #:
a =: #:<:2^48x
b=: 23456789123451x*2112345x
bigMod =:#.@:|.@:*./@:([ ,: |.@:#:@:])
a bigMod b
timespacex 'a bigMod b'
0.000168
My JVERSION:
JVERSION
Engine: j805/j64/linux
Release: commercial/2016-12-11T08:02:52
Library: 8.05.14
Qt IDE: 1.5.3/5.6.1
Platform: Linux 64
Installer: unknown
InstallPath: /usr/share/j/8.05
Contact: www.jsoftware.com
I recently installed J on a fresh Ubuntu 16.10 installation, following t
Patrick
>
> On Wed, 24 May 2017,
'Jon Hough' via Programming wrote:
> > My JVERSION:
>
>
> > JVERSION
> > Engine: j805/j64/linux
> > Release:
commercial/2016-12-11T08:02:52
> >
Libra
Let
a=: 'a'
b=: 'b'
c=: 'c'
and let
arr=: a;b;a;c;b;c;a;b;b;b;c;a;b NB. i.e. all items from a,b,c
I want to relabel the items
with
e=: 'e'
f=: 'f'
g=: 'g'
so a -> e, b -> f, c -> g.
so arr becomes
e;f;e;g;f;g;e;f;f;f;g;e;f
Is there a succinct (preferably tacit) way to do this?
I feel like
a c b c a b b b c a
b'
(;:'a b c')i.arr
0 1 0 2 1 2 0 1 1 1 2 0 1
((;:'a b c')i.arr){;:'e f g'
┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│e│f│e│g│f│g│e│f│f│f│g│e│f│
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
I hope this helps,
--
Raul
On Sat, May
27, 2017 at 4:4
Assume I have a dataset of shape 4 4
data=: 4 4 $ i. 16
and some other data of shape 2 4 (i.e. same number of columns, different number
of rows)
other=: 2 4 $ 100 200 130 250 2 4 6 8
I want to subtract each row of other from data, so that the result has shape 2
4 4. i.e. I know the result of
giving result shape 4 2 4 (i.
e. a transpose of what you got).
I use u"r1"r2 (two
ranks) pretty often, three ranks very rarely, and
have never had a use for four ranks.
Henry Rich
On 6/7/2017 4:12 AM, 'Jon Hough' via
Programming wrote:
> Assume I have a
I may be wrong in doing this, but I usually write
empty=: ''
to signify an empty list, array, matrix etc.
On Jun 7, 2017, 23:59, at 23:59, Michael Rice wrote:
>Is there a special "noun" for an empty list?
>
>Creating one seems enigmatic.
>
> empty =: 1 2
> empty
>1 2
> empty =: }. empty
>
1 - 100 of 193 matches
Mail list logo