New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Huffman Encoding #8765
Comments
comment:2
Much room for extensions, e.g.: ;-)
There's actually a possible application within Sage itself: compression of prime_pi and nth_prime tables. (The table-based functions are still work in progress.) OT:
-Leif |
comment:4
To think I just needed a function for Huffmann encoding yesterday to test something.. Sounds like this file will soon be out of my reach :-D Nathann |
comment:5
Replying to @nathanncohen: I'd also add [more] type checks on the inputs. |
comment:6
Hi, I only had a very quick look and I'm a bit concerned about where to put this code in the library.
I would feel a lot more confortable with
|
comment:7
Sounds sensible enough ! I just moved the file in a source_coding subdirectory, but I can not import sage.coding.source_coding.huffman, as sage does not find the source_coding module... Where should I tell it it exists ? :-) Nathann |
comment:8
Replying to @nathanncohen:
Maybe you could try to add an (empty) init.py file to it before adding huffman.py? |
comment:9
Hmmm... I added this empty init.py file in source_coding/, but it made no difference... Is that what you meant ? :-/ Nathann |
comment:10
Replying to @nathanncohen:
Try putting a comment in that
|
comment:11
I just tried it (you were right, the file I created was empty), but noticed no difference... In the end, is it really worth creating a directory anyway ? I could just rename the file to source_coding.py and let this Huffman class stay inside ?.. But I still would like to understand how to get this directory detected :-/ anything to do in modules_list.py even though it is not a Cython file ? Nathann |
comment:12
What about this version (no directory, but a file source_coding.py ) ? :-) |
comment:13
This applies to 4.4.rc0 fine and passes sage -testall. |
comment:14
Replying to @wdjoyner:
We should do that before giving a positive review, I guess... :)
There are still typos in the description:
And as I said before I'd prefer type checks on the parameters (rather than relying on automatically raised exceptions later in the code). I also prefer having the return type documented at the top rather than (more or less) implicitly in the examples (e.g. in Doctests? (Still haven't tested the code, just read the patches, sorry.) -Leif |
comment:15
Updated ! :-) Nathann |
comment:16
Attachment: trac_8765.patch.gz
I'll test it this evening. |
Attachment: trac_8765-huffman.patch.gz new module sage.coding.source_coding.huffman |
comment:17
The patch trac_8765-huffman.patch replaces the earlier one trac_8765.patch. Now the Huffman module is in the directory |
This comment has been minimized.
This comment has been minimized.
comment:18
Replying to @sagetrac-mvngu: Have to clone again and import the new patch... ;-) -Leif |
This comment has been minimized.
This comment has been minimized.
comment:19
Attachment: trac_8765-clean-ups.patch.gz Changes in the reviewer patch include:
This means I have reviewed trac_8765-huffman.patch, so only my patch needs review by anyone but me. |
Reviewer: Minh Van Nguyen |
comment:20
Replying to @sagetrac-mvngu:
That patch looks very good. I'll only add some more doctests and perhaps edit some comments. I think improvements to the algorithm can be done on another ticket. -Leif |
comment:21
The only reason why I still read your patches, apply them, check they are correct, check the docstrings, build the documentation and read it, is that I fear some God may be watching over my shoulder. Another perfect patch from Minh :-D Thank you very much ! Nathann |
Merged: sage-4.4.4.alpha0 |
This is a basic implementation of Huffman's encoding. May it be useful to teach ! :-)
Apply patches in this order:
CC: @wdjoyner @sagetrac-mvngu @nexttime
Component: coding theory
Author: Nathann Cohen
Reviewer: Minh Van Nguyen
Merged: sage-4.4.4.alpha0
Issue created by migration from https://trac.sagemath.org/ticket/8765
The text was updated successfully, but these errors were encountered: