From: <car...@us...> - 2012-05-12 14:42:33
|
Revision: 10424 http://octave.svn.sourceforge.net/octave/?rev=10424&view=rev Author: carandraug Date: 2012-05-12 14:42:27 +0000 (Sat, 12 May 2012) Log Message: ----------- signal: remove dependency to communications to avoid circular dependency. While it is ok with pkg install, pkg load will fail in this situation. This was fixed by making bi2de and de2bi subfunctions of bitrevorder. This is a temporary fix and hopefully bitrevorder will be rewritten to not use them at all Modified Paths: -------------- trunk/octave-forge/main/signal/DESCRIPTION trunk/octave-forge/main/signal/NEWS trunk/octave-forge/main/signal/inst/bitrevorder.m Modified: trunk/octave-forge/main/signal/DESCRIPTION =================================================================== --- trunk/octave-forge/main/signal/DESCRIPTION 2012-05-12 14:02:19 UTC (rev 10423) +++ trunk/octave-forge/main/signal/DESCRIPTION 2012-05-12 14:42:27 UTC (rev 10424) @@ -5,7 +5,7 @@ Maintainer: Octave-Forge community <oct...@li...> Title: Signal Processing. Description: Signal processing tools, including filtering, windowing and display functions. -Depends: octave (>= 3.6.0), optim (>= 1.0.0), specfun, control (>= 2.2.3), communications, image +Depends: octave (>= 3.6.0), optim (>= 1.0.0), specfun, control (>= 2.2.3), image Autoload: no License: GPLv3+, public domain Url: http://octave.sf.net Modified: trunk/octave-forge/main/signal/NEWS =================================================================== --- trunk/octave-forge/main/signal/NEWS 2012-05-12 14:02:19 UTC (rev 10423) +++ trunk/octave-forge/main/signal/NEWS 2012-05-12 14:42:27 UTC (rev 10424) @@ -6,7 +6,7 @@ ** signal is no longer dependent on the audio package. - ** signal is now dependent on the communications and image packages. + ** signal is now dependent on the image package. ** The function `marcumq' was imported from the communications package and has been completely rewritten to improve performance and fix computational Modified: trunk/octave-forge/main/signal/inst/bitrevorder.m =================================================================== --- trunk/octave-forge/main/signal/inst/bitrevorder.m 2012-05-12 14:02:19 UTC (rev 10423) +++ trunk/octave-forge/main/signal/inst/bitrevorder.m 2012-05-12 14:42:27 UTC (rev 10424) @@ -34,3 +34,65 @@ y(old_ind+1) = x(i); endfunction + +## The following functions, de2bi and bi2de, are from the communications package. +## However, the communications package is already dependent on the signal +## package and to avoid circular dependencies their code was copied here. Anyway, +## in the future bitrevorder should be rewritten as to not use this functions +## at all (and pkg can be fixed to support circular dependencies on pkg load +## as it already does for pkg install). + +## note that aside copying the code from the communication package, their input +## check was removed since in this context they were always being called with +## nargin == 1 + +function b = de2bi (d, n, p, f) + + p = 2; + n = floor ( log (max (max (d), 1)) ./ log (p) ) + 1; + f = 'right-msb'; + + d = d(:); + if ( any (d < 0) || any (d != floor (d)) ) + error ("de2bi: d must only contain non-negative integers"); + endif + + if (isempty (n)) + n = floor ( log (max (max (d), 1)) ./ log (p) ) + 1; + endif + + power = ones (length (d), 1) * (p .^ [0 : n-1] ); + d = d * ones (1, n); + b = floor (rem (d, p*power) ./ power); + + if (strcmp (f, 'left-msb')) + b = b(:,columns(b):-1:1); + elseif (!strcmp (f, 'right-msb')) + error ("de2bi: unrecognized flag"); + endif + +endfunction + + +function d = bi2de (b, p, f) + + p = 2; + f = 'right-msb'; + + if ( any (b(:) < 0) || any (b(:) != floor (b(:))) || any (b(:) > p - 1) ) + error ("bi2de: d must only contain integers in the range [0, p-1]"); + endif + + if (strcmp (f, 'left-msb')) + b = b(:,size(b,2):-1:1); + elseif (!strcmp (f, 'right-msb')) + error ("bi2de: unrecognized flag"); + endif + + if (length (b) == 0) + d = []; + else + d = b * ( p .^ [ 0 : (columns(b)-1) ]' ); + endif + +endfunction This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |