(I'm dangling this off the meg that started the thread)
Is there a clever way of doing this for non-numeric strings?
I couldn't think of a way to start on a tacit solution; dg0
is clear but not noticeably clever or fast:
dg0=: 3 : 0
nn=. # y
inds=. <"1@:(<"0) ,.~ i. nn
M=.(,~ nn)$ 1{.0{. y
y inds}M
)
str0=.'qwer'
str1=.'a';'bra';'ca';'dabra'
[I'm having trouble with copy-and-paste, but
dg0 str0
and
dg0 str1
should give the results you expect]
On 2014.02.26 22:02:00, you,
the extraordinary Joe Bogner, spake thus:
> I'm experimenting with svd and am looking for a nicer way of creating
> a matrix from the S diagonal
<snip!>
--
Nollaig MacKenzie
http://www.yorku.ca/nollaig
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm