For a while I listed it as Deprecated because it is largely superseded
by m}, and I mistakenly thought it was unnecessarily slow. That's why
it's relegated to a footnote.
Henry Rich
On 2/6/2022 5:18 PM, 'Pascal Jasmin' via Programming wrote:
scouring until the footnotes, I found
scouring until the footnotes, I found
https://code.jsoftware.com/wiki/Vocabulary/curlyrtu#dyadic
new to me. actually just found it in "oldvoc" too
https://www.jsoftware.com/help/dictionary/d530v.htm
replacing all 1s with maximum value in matrix
(>./@:, (I.@:(1&=)@,@])} ]) i.10 10
On
No, they're very old and little used. See the last paragraphs in
https://code.jsoftware.com/wiki/Vocabulary/curlyrt#Details .
Henry Rich
On 2/6/2022 4:49 PM, 'Pascal Jasmin' via Programming wrote:
these u} forms are new and never showed up in release notes or nuvoc.
it is not identical to
for the last tasks, in 903
ar =: 1 : '5!:1 <''u'''
amend =: [` ([. ` ar) `{`] `: 6 ` (]."_) `] }~~
NB. add 100 to column index 1
100 + amend 1 &.|: i.10 10
NB. add 100 to row index 2
100 + amend 2 i.10 10
On Sunday, February 6, 2022, 02:24:17 p.m. EST, Andrew P
wrote:
I am
these u} forms are new and never showed up in release notes or nuvoc.
it is not identical to [`u`]}
On Sunday, February 6, 2022, 03:15:08 p.m. EST, Henry Rich
wrote:
Another way to replace the second column with 0:
mat =. 0 ( 1, giving the index list of
each cell to be modified.
On Sun, Feb 6, 2022 at 2:24 PM Andrew P wrote:
> I am trying to learn how to manipulate tables of numbers in J coming from a
> NumPy/Python background. Assuming *mat* is a 10x10 matrix, that's what I
> have figured out so far:
>
> - Replace values equal to 1 with 10
> (mat e. 1) } mat ,: 10
That
Another way to replace the second column with 0:
mat =. 0 (Operations on rows/columns do not have a special notation. You must
extract the row/col, operate on it, and replace it. Use v0`v1`v2} to
combine these actions:
mat =. 1 (+ {."1)`((For more complex stuff you need the details of (x
Where to start?
Maybe work your way up to building that set of indices and
then just use them for amending, maybe something like this
mat =: _ (<"1 ,.~ i. # mat) } mat
for the \ diagonal and
mat =: __ ({ ;~ (#~ 2|>:) i.# mat) } mat
for the even indices
(even wrt python indices? replace >: by ]
The indices were off by one in my solution wrt your python indices.
You may use these instead:
mat =: (+1=#\)"1 mat
and
mat =: (+3=#\) mat
Am 06.02.22 um 20:35 schrieb Hauke Rehr:
One way to achieve that would be
mat =: (+0=i.@#)"1 mat
and
mat =: (+2=i.@#) mat
Am 06.02.22 um 20:24 schrieb
One way to achieve that would be
mat =: (+0=i.@#)"1 mat
and
mat =: (+2=i.@#) mat
Am 06.02.22 um 20:24 schrieb Andrew P:
- Add 1 to each value in the first column
x[:,1] += 1
- Add 1 to each value in the third row
x[3,:] += 1
--
--
mail written using NEO
neo-layout.org
I am trying to learn how to manipulate tables of numbers in J coming from a
NumPy/Python background. Assuming *mat* is a 10x10 matrix, that's what I
have figured out so far:
- Replace values equal to 1 with 10
(mat e. 1) } mat ,: 10
- Replace all non-multiples of 5 with _
(-. 0 = mat |~ 5) } mat
11 matches
Mail list logo