changeset 21:8476b3d9d295

Cleaning up and renaming things.
author samer
date Thu, 17 Jan 2013 14:21:24 +0000
parents ed2629b7f02b
children 4f5015db91aa
files README.txt general/numerical/alpha_norm.m general/numerical/map01.m general/numerical/maxnorm.m general/numerical/maxnormalise.m general/numerical/normalise01.m general/numerical/pdev.m general/numerical/pnorm.m general/numerical/rescale.m general/numerical/zerobase.m general/numerical/zeromax.m general/numerical/zeromean.m general/numerical/zeromin.m
diffstat 13 files changed, 67 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/README.txt	Thu Jan 17 13:33:36 2013 +0000
+++ b/README.txt	Thu Jan 17 14:21:24 2013 +0000
@@ -1,14 +1,38 @@
 
 
-  *** ISHARA - Matlab general purpose and signal processing tools
+  *** ISHARA 
+  ***   - Matlab general purpose and signal processing tools
+  ***
   *** Samer Abdallah
   *** C4DM, 2012-2013
 
   * Installation
 
+  Get them in your Matlab path.
+  Some functions (in audio and in sched) use Java classes. The class files
+  need to be on your Matlab Java classpath.
+  [Better instructions to follow.]
+
 
   * Subdirectories
 
+		general          - general purpose tools
+			arrutils      - array handling for arbitrary element types
+			funutils      - support for functional programming
+			cellutils     - support for using cell arrays as lists
+			numerical     - numerical tools (including scalar, array, matrix oriented functions)
+			discretise    - tools for mapping real numbers to integers
+			fileutils     - file reading and writing, file system search
+			algo          - algorithms and APIs for iteration, user interaction etc.
+
+		sched            - time-aware scheduling of code
+		sequences        - lazy list data type (like Haskell lists)
+		signals          - signal source data type with combinators and tools
+		sinks            - signal sink data type with combinators and tools
+		arrows           - framework for dataflow programming using arrow combinators
+		audio            - sampled audio input and output
+		dsp              - signal processing tools
+		stats            - statistics, probabilistic models etc.
 
   * Sub-projects
 
--- a/general/numerical/alpha_norm.m	Thu Jan 17 13:33:36 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-function l=alpha_norm(alpha,x)
-% alpha_norm - Minkowski norm (actually more like mean) using given exponent
-%
-% alpha_norm :: nonneg ~'exponent', [[N,M]] -> [[1,M]->nonneg].
-% alpha_norm :: nonneg ~'exponent', [[1,N]] -> nonneg.
-%
-% This version divides by the dimemnsionality of the space,
-% eg
-%    alpha_norm(2,x) = sqrt(mean(x.^2,1))
-%    alpha_norm(1,x) = mean(abs(x),1))
-l=real(mean(abs(x).^alpha).^(1/alpha));                                
-
--- a/general/numerical/map01.m	Thu Jan 17 13:33:36 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-function x=map01(x,dim)
-% map01 - Map values into the range [0,1].
-%
-% map01 :: [Size], D:natural -> [Size].
-
-if nargin<2, 
-	sz=size(x);
-	dims=find(sz>1);
-	if isempty(dims), dim=1; else dim=dims(1); end
-end
-	
-x=divnorm(@(z)max(z,[],dim),addnorm(@(y)min(y,[],dim),x));
-
--- a/general/numerical/maxnorm.m	Thu Jan 17 13:33:36 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-% maxnorm - additive normalisation of vectors
-%
-% maxnorm :: [[N]] -> [[N]], real.
-function [y,m]=maxnorm(x)
-	k=max(x);
-	if isfinite(k), y=x-k;
-	else y=zeros(size(x)); 
-	end
-end
--- a/general/numerical/maxnormalise.m	Thu Jan 17 13:33:36 2013 +0000
+++ b/general/numerical/maxnormalise.m	Thu Jan 17 14:21:24 2013 +0000
@@ -1,6 +1,5 @@
-function B=maxnormalise(A)
 % maxnormalise - columnwise multiplicative normalisation maximum value
 %
 % maxnormalise :: [[N,M]] -> [[N,M]].
+function B=maxnormalise(A), B=divnorm(@(x)max(x,[],1),A); end
 
-B=A./repmat(max(A,[],1),size(A,1),1);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/general/numerical/normalise01.m	Thu Jan 17 14:21:24 2013 +0000
@@ -0,0 +1,13 @@
+function x=normalise01(x,dim)
+% normalise01 - scale and shift all values into the range [0,1].
+%
+% normalise01 :: [Size], D:natural -> [Size].
+
+if nargin<2, 
+	sz=size(x);
+	dims=find(sz>1);
+	if isempty(dims), dim=1; else dim=dims(1); end
+end
+	
+x=divnorm(@(z)max(z,[],dim),addnorm(@(y)min(y,[],dim),x));
+
--- a/general/numerical/pdev.m	Thu Jan 17 13:33:36 2013 +0000
+++ b/general/numerical/pdev.m	Thu Jan 17 14:21:24 2013 +0000
@@ -12,11 +12,10 @@
 
 if nargin<2, D=1; end;
 
-% Should these be sum or mean?
 if p==2
 	N=sqrt(mean(abs(A).^2,D));
 else
-	N=mean(abs(A).^p,D).^(1/p);
+	N=real(mean(abs(A).^p,D).^(1/p));
 end
 	
 
--- a/general/numerical/pnorm.m	Thu Jan 17 13:33:36 2013 +0000
+++ b/general/numerical/pnorm.m	Thu Jan 17 14:21:24 2013 +0000
@@ -12,7 +12,6 @@
 
 if nargin<2, D=1; end;
 
-% Should these be sum or mean?
 if p==2
 	N=sqrt(sum(abs(A).^2,D));
 else
--- a/general/numerical/rescale.m	Thu Jan 17 13:33:36 2013 +0000
+++ b/general/numerical/rescale.m	Thu Jan 17 14:21:24 2013 +0000
@@ -1,4 +1,4 @@
-function B=rescale(A,mx), B=A/max(A(isfinite(A)));
+function B=rescale(A,mx), B=A*(mx/max(A(isfinite(A))));
 % rescale - rescale array values so maximum value is MX
 %
 % rescale :: [DIM->real], real -> [DIM->real]
--- a/general/numerical/zerobase.m	Thu Jan 17 13:33:36 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-function x=zerobase(x,dim)
-% zerobase - shift values so minimum is zero
-%
-% zerobase :: 
-%    [D:[[E]]] ~'E dimensional array of size D', 
-%    1..D      ~'dimension to normalise along' 
-% -> [D] ~'shifted data'.
-x=addnorm(@(y)min(y,[],dim),x);
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/general/numerical/zeromax.m	Thu Jan 17 14:21:24 2013 +0000
@@ -0,0 +1,9 @@
+% zeromax - additive normalisation so max value us zero
+%
+% zeromax :: 
+%    [D:[[E]]] ~'E dimensional array of size D', 
+%    1..D      ~'dimension to normalise along' 
+% -> [D] ~'shifted data'.
+%
+% non-finite values are ignored. Dimension defaults to 1.
+function [y,m]=zeromax(x,dim), x=addnorm(@(y)max(y,[],dim),x); end
--- a/general/numerical/zeromean.m	Thu Jan 17 13:33:36 2013 +0000
+++ b/general/numerical/zeromean.m	Thu Jan 17 14:21:24 2013 +0000
@@ -1,5 +1,8 @@
-function x=zeromean(x,dim)
-% zeromean(x,dim): make x zero mean 
-% 	if x is a matrix, operate on each ROW independently
-x=addnorm(@(y)mean(y,dim),x);
+% zeromean - additive normalisation to zero mean
+%
+% zeromean :: 
+%    [D:[[E]]] ~'E dimensional array of size D', 
+%    1..D      ~'dimension to normalise along' 
+% -> [D] ~'shifted data'.
+function x=zeromean(x,dim), x=addnorm(@(y)mean(y,dim),x); end
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/general/numerical/zeromin.m	Thu Jan 17 14:21:24 2013 +0000
@@ -0,0 +1,10 @@
+% zeromin - shift values so minimum is zero
+%
+% zeromin :: 
+%    [D:[[E]]] ~'E dimensional array of size D', 
+%    1..D      ~'dimension to normalise along' 
+% -> [D] ~'shifted data'.
+%
+% Dimension defaults to 1.
+function x=zeromin(x,dim), x=addnorm(@(y)min(y,[],dim),x); end
+