Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread bill lam
Certainly this is correct and that why I asked I had misread. for any given text, dynamic huffman coding always encoded with exactly the same table and there is a one to one mapping between bit length vector and huffman codes. I think hcodes is also stable in that it generates the same huffman co

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Raul Miller
I thought the bit lengths were encoded in the file, not recreated by an algorithm in the decoder? Thanks, -- Raul On Fri, Sep 12, 2014 at 1:27 AM, bill lam wrote: > I think this matters a lot because output of our encoder will > also be decoded by other zlib compliant decoders such as zlib.so

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread bill lam
I think this matters a lot because output of our encoder will also be decoded by other zlib compliant decoders such as zlib.so itself. Or I had mis-read your question? Пт, 12 сен 2014, Raul Miller написал(а): > If we define > > bitlen=:4 :0 > b=. 0~:x > b #inv #@>(b#x) hcodes b#y > ) > > Doe

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Raul Miller
If we define bitlen=:4 :0 b=. 0~:x b #inv #@>(b#x) hcodes b#y ) Does it matter that these numbers are sometimes different from those used in another implementation? Thanks, -- Raul On Fri, Sep 12, 2014 at 12:59 AM, bill lam wrote: > Consider an example > >1 0 0 2 1 hcode

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread bill lam
Hi Raul, This article seems containing an algorithm for generating dynamic huffman coding in a human language. An Explanation of the `Deflate' Algorithm http://www.zlib.net/feldspar.html -- regards, GPG key 1024D/4434BAB3 2008-08-24 gpg --k

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread bill lam
Consider an example 1 0 0 2 1 hcodes_jzlib_ i.5 +-+---+---+-+---+ |1 1 1|1 1 0 0|1 1 0 1|0|1 0| +-+---+---+-+---+ #&> 1 0 0 2 1 hcodes_jzlib_ i.5 3 4 4 1 2 (0~:1 0 0 2 1)* #&> 1 0 0 2 1 hcodes_jzlib_ i.5 3 0 0 1 2 classic huf

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Raul Miller
That's what I thought at first, also. But, let's look at the example at http://www.jsoftware.com/pipermail/programming/2014-September/039299.html and the bit widths given at http://www.jsoftware.com/pipermail/programming/2014-September/039327.html Here's how it looks to me: bits -:#@>F hcode

Re: [Jprogramming] Longest Collatz sequence

2014-09-11 Thread Kenneth Lettow
http://www.jsoftware.com/jwiki/Essays/Collatz%20Conjecture On Thu, Sep 11, 2014 at 11:16 PM, Neill Robson wrote: > I've been working on various Project Euler problems in J, and I seem to > always get stuck whenever a problem requires excessive/lengthy recursion. > In particular, I've been workin

[Jprogramming] Longest Collatz sequence

2014-09-11 Thread Neill Robson
I've been working on various Project Euler problems in J, and I seem to always get stuck whenever a problem requires excessive/lengthy recursion. In particular, I've been working on problem number 14, which asks what starting value (under 1 million) produces the longest Collatz sequence. Now, I st

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread bill lam
Thanks. I prefer reading essays in wikipedia or rfc for human language descriptions rather than guessing from computer language codes (perhpas exclusing J). rfc 1950 and 1951 for png and zlib for specification is self contained except for the algorithm of getting the dynamic huffman code (not f

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Joe Bogner
One more link: http://www.opensource.apple.com/source/zlib/zlib-43/zlib/contrib/puff/puff.c * puff.c is a simple inflate written to be an unambiguous way to specify the * deflate format. It is not written for speed but rather simplicity. Not sure if it's any use On Thu, Sep 11, 2014 at 9:46

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Joe Bogner
Thanks for the background. I don't know if I'm helping any but figured I'd share one more thing (for now). I found a library, https://github.com/lvandeve/lodepng, that has a permissive license and successfully decoded and encoded a png file. As simple as: lodepng_decode32_file(&image, &width, &he

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Jose Mario Quintana
Yes, it does indeed: u=. + ((u^:((# - 1:))@:{.) -: u/) (i.1) 1 Also, erase'u' 1 ((u^:((# - 1:))@:{.) -: u/) (i.1) 1 I have to digest it a little bit more but so far everything seems to be falling into place; at least, your interpretation is consistent. Thanks On Thu, Sep 11, 20

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread bill lam
It seems everyone use huffman code in its own way, at least huffman coding in jpeg is different from that in deflate. The intent to is to replace bmp with png as the default image format in jal addons for j803. This is already almost fully done. With dynamic huffman coding, png images can achieve

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Joe Bogner
The bit widths are calculated from the huffman tree See http://stackoverflow.com/questions/759707/efficient-way-of-storing-huffman-tree http://www.siggraph.org/education/materials/HyperGraph/video/mpeg/mpegfaq/huffman_tutorial.html The timing is interesting considering we were talking about tre

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Raul Miller
Remember that the definition of u/ was: "u/y applies the dyad u between the items of y". The items of i.1 are {.i.1 And: ({.i.1) -: +/i.1 1 Does that make sense? (And, yes, I intentionally mangled english grammar in my third sentence of this message.) Thanks, -- Raul On Thu, Sep 11, 201

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Jose Mario Quintana
Now, that is interesting. Thus, it seems, the unofficial documentation about / is not quite correct (depending on what the meaning of "is" is.). I have another question: if "u is applied (#y)-1 times." How come, (-: u^:0)i.1 1 ? On Thu, Sep 11, 2014 at 6:36 PM, Raul Miller wrote: > y a

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Raul Miller
y always remains unchanged. Note also that the result is distinct from y: (-: +/) i.1 0 Thanks, -- Raul On Thu, Sep 11, 2014 at 3:13 PM, Jose Mario Quintana wrote: > My only guess is: > "m/y inserts successive verbs from the gerund m between items of y" > > So, if there is no "between item

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Raul Miller
Certainly. "u/y applies the dyad u between the items of y". This means that u is applied (#y)-1 times. And an error would be inconsistent with the concept expressed for the case where 0=#y. Thanks, -- Raul On Thu, Sep 11, 2014 at 1:50 PM, Dan Bron wrote: > Pepe wrote: >> My only question is

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Raul Miller
Here's the code I came up with, with Bill's help: bl_count=:3 :0 NB. y is result of freqs 0,}.<:#/.~(,~ [: i. 1 + >./)y ) start_vals=: +:@+/\.&.|.@}:@,~&0 find_codes=:3 :0 NB. y is result of freqs b=. bl_count y v=. start_vals b n=. /:~ ~.y-.0 o=. ;({./.~ /:~ (n (([#2:) #: ])&.> (*b)#v+&.>

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Jose Mario Quintana
I wrote: " I do not think the dictionary is wrong but perhaps it is incomplete. As you pointed out, the tally is 1 and the neutral element intance provision does not apply; so, for example, in the sentence (*/0) or in general (u/A) where A is an atom the result is the atom (A) (even if u is undefin

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Dan Bron
Even NuVuc refers back to the DoJ as the authoritative, normative reference. If pointing out gaps in the Dictionary on the Forums isn't the way to get it updated, what is? Please excuse typos; sent from a phone. > On Sep 11, 2014, at 4:45 PM, Henry Rich wrote: > > Crying about the Dictionar

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Joe Bogner
bill, I'd be interested in a solution but I don't think I can contribute any more on this. I played with https://code.google.com/p/miniz/ and became even more convinced of the complexity. It seems as though the compressor can decide whether to include the dictionary code table or not -- likely base

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Henry Rich
Crying about the Dictionary isn't going to get things documented. Yeah, it's documented in NuVoc. Henry Rich On 9/11/2014 3:13 PM, Jose Mario Quintana wrote: My only guess is: "m/y inserts successive verbs from the gerund m between items of y" So, if there is no "between items of y" inserts

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Dan Bron
Agreed. - Original Message --- Subject: Re: [Jprogramming] Replace one item of a list From: Jose Mario Quintana Date: Thu, 11 Sep 2014 16:05:26 -0400 To: Programming forum I copied the wrong text from the Dictionary; it should have been: " u/y applies the dyad u be

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Jose Mario Quintana
I copied the wrong text from the Dictionary; it should have been: " u/y applies the dyad u between the items of y " Incidentally, as Thomas proposed, if it cannot insert the verb, then issuing an error could not have been a valid alternative as well? On Thu, Sep 11, 2014 at 3:13 PM, Jose Mario Q

Re: [Jprogramming] Question on rank conjunction's behavior regarding "unexpected" vector transposition

2014-09-11 Thread Linda Alvord
I don't know matlab, but is this what you are looking for ]A=:i.2 4 7 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 +/"2 A 42 46 50 54 58 62 66 154 158 162 1

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Jose Mario Quintana
My only guess is: "m/y inserts successive verbs from the gerund m between items of y" So, if there is no "between items of y" inserts nothing and y remains unchanged; but, it seems to me that the Dictionary could be more assertive in this instance. On Thu, Sep 11, 2014 at 2:13 PM, Dan Bron wrot

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Dan Bron
Pepe wrote: > My only question is: Does the Dictionary support this behavior? > Raul responded: > Yes, it does. I replied: > I am intrigued. Can you elaborate? Thomas followed-up: > I assumed that by not mentioning it, the implementation > is free to do what it chooses. It could be anythi

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Thomas Costigliola
On Thu, Sep 11, 2014 at 1:50 PM, Dan Bron wrote: > Pepe wrote: > > My only question is: Does the Dictionary support this behavior? > > Raul responded: > > Yes, it does. > > I am intrigued. Can you elaborate? > I assumed that by not mentioning it, the implementation is free to do what it chooses

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Thomas Costigliola
What I would expect to happen with u/ Y where 1=#Y is: if the neutral element (E) is known then E u Y otherwise a domain error, with the ability to specify E through (!.). I think my mindset is a bit more pure where as the implementation is a bit more practical, albeit, as Pepe said, arbitrary. On

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Dan Bron
Pepe wrote: > My only question is: Does the Dictionary support this behavior? Raul responded: > Yes, it does. I am intrigued. Can you elaborate? In particular, can you help me see, given only the text of the Dictionary, that u/y where 1=#y must be y ? And not, for example, an error? -D

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread bill lam
This codes seemed invalid. 1 is a prefix of 11 which is a prefix of 111. Suppose there is a bit pattern of 1 1 , it is ambiguous to mean [68,'1'] [68,'1'] or [65,'11'] The huffman code in rfc is canonical meaning there is exactly one possible huffman codes for a given bit length vector. This

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Dan Bron
Pepe wrote: > My only question is: Does the Dictionary support > [the behavior that y ? u/y when 1=#y ]? No, I don't believe it does. At the very least, it's not supported by the vocabulary entry for / . That said, there are other areas where such reasoning applies (e.g. ;. ), so maybe it

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Raul Miller
On Thu, Sep 11, 2014 at 1:02 PM, Jose Mario Quintana wrote: > My only question is: Does the Dictionary support this behavior? Yes, it does. Thanks, -- Raul -- For information about J forums see http://www.jsoftware.com/forums.

Re: [Jprogramming] Question on rank conjunction's behavior regarding "unexpected" vector transposition

2014-09-11 Thread Raul Miller
The important thing to understand is that Rank is a count of dimensions. So u"1 means that the arguments to u have (at most) 1 dimension, and u"2 means that the arguments to u have (at most) 2 dimensions. Any 'extra' dimensions get treated independently. See also: https://en.wikipedia.org/wiki/Ra

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread bill lam
Joe, both of the 2 rules in rfc involve bit lengths, so that your output would probably also need to display the bit length of each code for validation. try something like "ABDD" you may expect bit length of each symbol shuold be something like A <: C <: D <: B This may or may not since d

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Jose Mario Quintana
I wrote: " I do not think the dictionary is wrong but perhaps it is incomplete. As you pointed out, the tally is 1 and the neutral element intance provision does not apply; so, for example, in the sentence (*/0) or in general (u/A) where A is an atom the result is the atom (A) (even if u is undefin

Re: [Jprogramming] Ragged Array Shapes are Trees

2014-09-11 Thread Dan Bron
David Lambert wrote: > I wrote the rosetta code red-black tree entry. I haven't read/reviewed the Red-Black tree implementation on RosettaCode, but it did remind me of an argument I once made for supplying I. with an inverse [1]: > I.-space is useful, particularly when the domain (input & ou

Re: [Jprogramming] Ragged Array Shapes are Trees

2014-09-11 Thread David Lambert
I wrote the rosetta code red-black tree entry. As Devon guessed, I followed Robert Sedgewick's left leaning red-black tree paper. As the notes page indicates, merely giving an example of symbols relies on implementation detail. I'll post such an entry if there's an agreement. 1r3 of the cod

Re: [Jprogramming] Question on rank conjunction's behavior regarding "unexpected" vector transposition

2014-09-11 Thread bill lam
First of all, rank conjunction <> axis specification. Matlab seems using axis specification although I know nothing about it. +/ or +/"r always insert + between "items" but will not change the order of axis. Items of a vector is scalar; Items of a matrix is its row; item of i.2 4 7 is a matrix of

Re: [Jprogramming] Question on rank conjunction's behavior regarding "unexpected" vector transposition

2014-09-11 Thread Kip Murray
For practical reasons the items of a vector are listed horizontally but the items of higher dimensional arrays are listed vertically. You must remember this when you interpret displays. To illustrate, in i. 3 2 4 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread David Lambert
I do not know where to find the documentation easily. However, the definitions lurk in the z locale. inv ^:_1 names_z_ 3 ... copath copathnl copathnlx coreset ... winpathsep xedit names_z_ 1 define each every fapplylines inv inverse items leaf rows rxapply rxmerge table On 09/

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Dan Bron
Yep, that's it. And, being that there's only one argument to work with (the scalar), there's insufficient information to actually invoke the dyad, so it isn't. -Dan - Original Message --- Subject: Re: [Jprogramming] Replace one item of a list From: David Lambert Date: Thu

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Joe Bogner
Ignore the pako.js example output... It was just outputting the binary representation of A-Z, not the huffman code This is what I meant to send For ABCD: [65,'11'], [66,'0'], [67,'10'], [68,'1'], [256,'111'] It still doesn't seem to be sorting correctly lexographically, but I'm not really in my

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread David Lambert
Perhaps the confusion is simply that the insert adverb implies dyadic invocation of the verb. On Wed, Sep 10, 2014 at 9:57 AM, Linda Alvord > >wrote: > > > >> > >>Here's the example that is puzzling me. > >> > >> *i.5 > >>0 1 1 1 1 > >>*/"0 i.5 > >>0 1 2 3 4 > >> > >> > >It looks like

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Joe Bogner
I think the prefix coding looks OK, but the 2 rules does not: I modified the code[1] to allow passing in a string and outputting the codes C:\temp>deflate ABCDEFGHIJKLMONPQRSTUVWXYZ code 65 : 0 code 66 : 6 0110 code 67 : 8 0

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Dan Bron
Kyle M. Rudden wrote: > Is there is list of non-primitive standard structures > somewhere I am missing? > > NuVoc and other vocabulary lists tend to have primitives only. > Where would I find a discussion / explanation of "#inv" on the wiki? > > Useful non-primitive structures like "each"

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread bill lam
This is strange since every author must had decode its own encoded data as a smoke test. Did you test if huffman code or bit lengths it produced was correct or not, ie it is a prefix coding and it satisfy the 2 rules in rfc. Чт, 11 сен 2014, Joe Bogner написал(а): > unfortunately the dynamic codi

Re: [Jprogramming] Question on rank conjunction's behavior regarding "unexpected" vector transposition

2014-09-11 Thread 'Pascal Jasmin' via Programming
to get a column sum, all of these would work +/ +/"_1 i.2 4 7 196 204 212 220 228 236 244 +/ +/"2 i.2 4 7 196 204 212 220 228 236 244 +/ +/ i.2 4 7 / or +/ in this case will only "remove" (reduce along) one dimension at a time. - Original Message - From: George Dallas To: pro

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread chris burke
> In my experience so far, very useful non-primitive structures like "each" you have to discover by reading all available materials and monitoring these discussions. See the standard library docs at http://www.jsoftware.com/help/user/library.htm . For example, this includes the expand verb. I al

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread 'Pascal Jasmin' via Programming
as nice as # inv is, you may find this adverb more flexible and intuitive: insertitem =: 1 : '(u"_ {. ]) , [ , u"_ }. ]' the adverb argument is a verb that tells which item position to insert. The verb argument is dyadic, but can be a constant verb. Add @:] to it to just use y as the argument

[Jprogramming] Question on rank conjunction's behavior regarding "unexpected" vector transposition

2014-09-11 Thread George Dallas
Let’s say we have a rank 3 array A like so: ]A=.i.2 4 7 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 And we would like to add the rows. The rank conjunction

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Kyle M. Rudden
Useful and interesting ... but where would I find a discussion / explanation of "#inv" on the wiki? NuVoc and other vocabulary lists tend to have primitives only. In my experience so far, very useful non-primitive structures like "each" you have to discover by reading all available materials and

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Ben Gorte - CITG
> Ben Gorte wrote: > > I use an adverb called ins that behaves like } , except that it inserts :) > In the argument to the adverb, does 1 ins refer to the item at index 1 in > the argument, or the empty space between item 1 and item 2, or the empty > space between item 0 and item 1, or what? The

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Linda Alvord
My solutions usually are from a beginner's attach on the problem, but sometimes this may be helpful. ]A=:3 3$0 0 0 0 0 0 0 0 0 0 ]B=: 0 1 3 2 {"1 A(,"1) 1 0 0 1 0 0 0 1 0 0 0 1 0 ]C=:0 1 3 2{"2 B(,"2) 1 0 0 1 0 0 0 1 0 1 1 1 1 0 0 1 0 ]D=:0 1 3{"2 C 0 0 1 0 0 0 1 0 0 0

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Joe Bogner
unfortunately the dynamic coding in the putty fork doesn't seem to work: deflate -c deflate.c > out deflate -d out decoding error: incorrect data checksum it works fine with static tables C:\temp>echo ABCD > ABCD C:\temp>deflate -c ABCD > out C:\temp>deflate -d out ABCD I added some debuggi

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Roger Hui
Fractional axes specs are an abomination. Don't bother trying to model it. ,: and ,:"r are far superior. On Thu, Sep 11, 2014 at 7:00 AM, Dan Bron wrote: > Ben Gorte wrote: > > I use an adverb called ins that behaves like } , except that it inserts > :) > > In the argument to the adverb, does

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Dan Bron
Ben Gorte wrote: > I use an adverb called ins that behaves like } , except that it inserts :) In the argument to the adverb, does 1 ins refer to the item at index 1 in the argument, or the empty space between item 1 and item 2, or the empty space between item 0 and item 1, or what? If I recall co

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Ben Gorte - CITG
> I use a verb called ins that behaves like } , except that it inserts :) Correction: adverb Sorry about that, Ben -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Henry Rich
#^:_1 is discussed at http://www.jsoftware.com/jwiki/Vocabulary/Inverses#Expand_.23.5E:_1 and other inverses are discussed on the same page. Henry Rich On 9/11/2014 7:04 AM, Sebastian wrote: Hi Raul and Dan, Many thanks for your great help! :) I found # as copy in the j vocabulary now, but

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Ben Gorte - CITG
If you find the inv-thing quirky and complex numbers too, you can use e.g. 1 2 1#M to duplicate a row of M. Then put something else at the copy using } (amend), but you were probably going to do that anyhow. I use a verb called ins that behaves like } , except that it inserts :) 888 (3) ins

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Jan-Pieter Jacobs
# inv is the same as #^:_1 (using the power conjunction). A list of default inverses can be found at http://www.jsoftware.com/help/dictionary/d202n.htm #^:_1 is listed under point 6. Kind regards, Jan-Pieter 2014-09-11 13:04 GMT+02:00 Sebastian : > Hi Raul and Dan, > > Many thanks for your grea

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Linda Alvord
Why do the words matter? It seems the hcodes are independent of the words. A abcdef F 3 1 4 1 5 9 F hcodes A ┌─┬───┬───┬───┬───┬───┐ │1 0 1│1 0 0 0│0 0│1 0 0 1│0 1│1 1│ └─┴───┴───┴───┴───┴───┘ F hcodes (?6#256){a. ┌─┬───┬───┬───┬───┬──

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Sebastian
Hi Raul and Dan, Many thanks for your great help! :) I found # as copy in the j vocabulary now, but I cannot find #inv. Where I have to search? Sebastian -- Originalnachricht -- Von: "Raul Miller" An: "Programming forum" Gesendet: 11.09.2014 12:58:37 Betreff: Re: [Jprogramming] Ext

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Raul Miller
Here's an example of how I frequently use non-truth-valued # 9!:7]9 1 1#'+|-' Thanks, -- Raul On Thu, Sep 11, 2014 at 6:49 AM, Dan Bron wrote: > Note also that you can use plain, uninverted # to expand arguments: > >1 1j1 1 (#!.1) 3 3 $ 0 > 0 0 0 > 0 0 0 > 1 1 1 > 0 0 0 >1 1j1 1 (

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Linda Alvord
-Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of bill lam Sent: Thursday, September 11, 2014 3:46 AM To: Programming forum Subject: Re: [Jprogramming] zlib huffman coding the frequencies (guessing from bit l

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread Raul Miller
Here's a corrected implementation of find_codes bl_count=:3 :0 0,}.<:#/.~(,~ [: i. 1 + >./)y ) start_vals=: +:@+/\.&.|.@}:@,~&0 find_codes=:3 :0 b=. bl_count y v=. start_vals b n=. /:~ ~.y-.0 o=. ;({./.~ /:~ (n (([#2:) #: ])&.> (*b)#v+&.>i.&.>b c /: o ) Argument is the same as for huffma

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Dan Bron
Note also that you can use plain, uninverted # to expand arguments: 1 1j1 1 (#!.1) 3 3 $ 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1j1 1 (#!.1"1) 3 3 $ 0 0 0 1 0 0 0 1 0 0 0 1 0 Which approach you pick often depends on whether it's easier for you to express your expansion vector with length N (complex

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread bill lam
oops, I made lots of typo. .. without prior knowing On Sep 11, 2014 3:45 PM, "bill lam" wrote: > the frequencies (guessing from bit lengths) should be something like 2 3 1 > 1 > (2 3 1 1) hcodes 'ABCD' > > the hard part is the inverse problem: how to get the huffman code with > prior kno

Re: [Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Raul Miller
Here are some perhaps relevant examples: 1 1 0 1 #inv (3 3$ 0) 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 #inv!.1 (3 3$ 0) 0 0 0 0 0 0 1 1 1 0 0 0 1 1 0 1 #inv!.1"1 (3 3$ 0) 0 0 1 0 0 0 1 0 0 0 1 0 1 1 0 1 #inv!.1"1 (1 1 0 1) #inv!.1 (3 3$ 0) 0 0 1 0 0 0 1 0 1 1 1 1 0 0 1 0 1 1 0 1 # 1 1 0 1 #

[Jprogramming] Extend/reduce matrix dimensions

2014-09-11 Thread Sebastian
Hi, I know the verbs , ,. ,: to add rows, columns and dimensions to matrices. It is easy to add these to begin or the end of the corrosponding dimension, but what is to do, if I want to add one row/column in the middle of a matrix? Is the only way to slice the matrix in two pieces and join th

Re: [Jprogramming] Replace one item of a list

2014-09-11 Thread Sebastian
Thanks for your help and the great discussion. -- Originalnachricht -- Von: "Roger Hui" An: "Programming forum" Gesendet: 08.09.2014 16:21:05 Betreff: Re: [Jprogramming] Replace one item of a list a=: i.5 a 0 1 2 3 4 a=: 100 (2}) a a 0 1 100 3 4 On Mon, Sep 8, 2014 at 7

Re: [Jprogramming] Ragged Array Shapes are Trees

2014-09-11 Thread 'Bo Jacoby' via Programming
Thanks, Dan and Thomas, for asking. I do not know the answers to Thomas' questions. Everything about ordinal fractions is contained in this text: https://www.dropbox.com/s/o23cz6aao6gpanx/pluk.of?dl=0 It is an ordinal fraction database. The file is actually a turbo pascal program, because everyth

Re: [Jprogramming] zlib huffman coding

2014-09-11 Thread bill lam
the frequencies (guessing from bit lengths) should be something like 2 3 1 1 (2 3 1 1) hcodes 'ABCD' the hard part is the inverse problem: how to get the huffman code with prior knowing the bits for each symbol. Your pointer to the putty fork looks like helpful. The comment is in lines 861 to