Mercurial > forge
changeset 2550:b1de5ceb2672 octave-forge
Added some document strings to rle* & shannonfano* files
author | gnumuthu |
---|---|
date | Mon, 02 Oct 2006 07:37:04 +0000 |
parents | 175fda85a1ba |
children | 1b16e543d7ab |
files | main/comm/inst/rledeco.m main/comm/inst/rleenco.m main/comm/inst/shannonfanodeco.m main/comm/inst/shannonfanoenco.m |
diffstat | 4 files changed, 64 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/main/comm/inst/rledeco.m Mon Oct 02 07:12:25 2006 +0000 +++ b/main/comm/inst/rledeco.m Mon Oct 02 07:37:04 2006 +0000 @@ -15,19 +15,25 @@ ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -## usage: rledeco(message) -## This function decodes a run-length encoded message into its -## original form. The encoded message has to be in the form of a +## -*- texinfo -*- +## @deftypefn {Function File} {} rledeco (@var{message}) +## +## Returns decoded run-length @var{message}. +## The RLE encoded @var{message} has to be in the form of a ## row-vector. The message format (encoded RLE) is like repetition -## factor, value. +## [factor, value]+. ## -## example: +## An example use of @code{rledeco} is +## @example +## @group ## message=[1 5 2 4 3 1]; ## rledeco(message) #gives ## ans = [ 5 4 4 1 1 1] -## -## see also: rleenco() -## +## @end group +## @end example +## @end deftypefn +## @seealso{rledeco} + function rmsg=rledeco(message) if nargin < 1 error('Usage: rledeco(message)')
--- a/main/comm/inst/rleenco.m Mon Oct 02 07:12:25 2006 +0000 +++ b/main/comm/inst/rleenco.m Mon Oct 02 07:37:04 2006 +0000 @@ -15,20 +15,25 @@ ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -## usage: rleenco(message) -## This function decodes a run-length encodes a message into its -## rle form. The original message has to be in the form of a -## row-vector. The message format (encoded RLE) is like repetition -## factor, value. +## -*- texinfo -*- +## @deftypefn {Function File} {} rleenco (@var{message}) ## -## example: +## Returns run-length encoded @var{message}. The +## rle form is built from @var{message}. The original @var{message} +## has to be in the form of a row-vector. The encoded @var{message} +## format (encoded RLE) is like [repetition factor]+, values. +## +## An example use of @code{rleenco} is +## @example +## @group ## message=[ 5 4 4 1 1 1] ## rleenco(message) #gives ## ans = [1 5 2 4 3 1]; -## -## -## see also: rledeco() -## +## @end group +## @end example +## @end deftypefn +## @seealso{rleenco} + function rmsg=rleenco(message) if nargin < 1 error('Usage: rleenco(message)')
--- a/main/comm/inst/shannonfanodeco.m Mon Oct 02 07:12:25 2006 +0000 +++ b/main/comm/inst/shannonfanodeco.m Mon Oct 02 07:37:04 2006 +0000 @@ -15,24 +15,32 @@ ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## +## -*- texinfo -*- +## @deftypefn {Function File} {} shannonfanodeco (@var{hcode},@var{dict}) ## -## usage: sig=shannonfanodeco(hcode,dict) -## The function returns the original signal that was -## Shannonfano encoded signal using shannonfanoenco. This function uses -## a dict built from the shannonfanodict and uses it to decode a signal -## list into a shannonfano list. -## Restrictions include hcode is expected to be a binary code; -## returned signal set that strictly belongs in the range [1,N] -## with N=length(dict). Also dict can only be from the -## shannonfanodict() routine. Whenever decoding fails, +## Returns the original signal that was Shannonfano encoded. The signal +## was encoded using @code{shannonfanoenco}. This function uses +## a dict built from the @code{shannonfanodict} and uses it to decode a signal +## list into a shannonfano list. Restrictions include hcode is expected to be a binary code; +## returned signal set that strictly belongs in the @code{range [1,N]}, +## with @code{N=length(dict)}. Also dict can only be from the +## @code{shannonfanodict(...)} routine. Whenever decoding fails, ## those signal values are indicated by -1, and we successively ## try to restart decoding from the next bit that hasnt failed in ## decoding, ad-infinitum. ## -## example: hd=shannonfanodict(1:4,[0.5 0.25 0.15 0.10]) +## An example use of @code{shannonfanodeco} is +## @example +## @group +## hd=shannonfanodict(1:4,[0.5 0.25 0.15 0.10]) ## hcode=shannonfanoenco(1:4,hd) # [ 1 0 1 0 0 0 0 0 1 ] ## shannonfanodeco(hcode,hd) # [1 2 3 4] ## +## @end group +## @end example +## @end deftypefn +## @seealso{shannonfanoenco, shannonfanodict} + function sig=shannonfanodeco(hcode,dict) if ( nargin < 2 || strcmp(class(dict),"cell")~=1 ) error('usage: shannonfanoenco(sig,dict)');
--- a/main/comm/inst/shannonfanoenco.m Mon Oct 02 07:12:25 2006 +0000 +++ b/main/comm/inst/shannonfanoenco.m Mon Oct 02 07:37:04 2006 +0000 @@ -15,20 +15,27 @@ ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -## -## usage:shannonfanoenco(sig,dict) -## The function returns the Shannon Fano encoded signal using dict. -## This function uses a dict built from the shannonfanodict +## -*- texinfo -*- +## @deftypefn {Function File} {} shannonfanoenco (@var{hcode},@var{dict}) +## Returns the Shannon Fano encoded signal using @var{dict}. +## This function uses a @var{dict} built from the @code{shannonfanodict} ## and uses it to encode a signal list into a shannon fano code. -## Restrictions include a signal set that strictly belongs -## in the range [1,N] with N=length(dict). Also dict can -## only be from the shannonfanodict() routine. -## +## Restrictions include a signal set that strictly belongs in the +## @code{range [1,N]} with @code{N=length(dict)}. Also dict can only be +## from the @code{shannonfanodict()} routine. ## -## example: hd=shannonfanodict(1:4,[0.5 0.25 0.15 0.10]) + +## An example use of @code{shannonfanoenco} is +## @example +## @group +## hd=shannonfanodict(1:4,[0.5 0.25 0.15 0.10]) ## shannonfanoenco(1:4,hd) # [ 0 1 0 1 1 0 1 1 1 0] +## @end group +## @end example +## @end deftypefn +## @seealso{shannonfanodeco, shannonfanodict} ## -## + function sf_code=shannonfanoenco(sig,dict) if nargin < 2 error('usage: huffmanenco(sig,dict)');