Index: setup.py
===================================================================
RCS file: /home/repository/biopython/biopython/setup.py,v
retrieving revision 1.115
diff -u -r1.115 setup.py
--- setup.py	10 Oct 2006 03:53:34 -0000	1.115
+++ setup.py	14 Mar 2007 15:45:10 -0000
@@ -76,8 +76,6 @@
     dependencies = [
         ("mxTextTools", is_mxTextTools_installed, 1,
          "http://www.egenix.com/files/python/eGenix-mx-Extensions.html"),
-        ("Numerical Python", is_Numpy_installed, 0,
-         "http://numpy.sourceforge.net/"),
         ("Reportlab", is_reportlab_installed, 0,
          "http://www.reportlab.org/downloads.html"),
         ]
@@ -127,10 +125,40 @@
                                ["Bio/KDTree/KDTree.cpp",
                                 "Bio/KDTree/KDTree.swig.cpp"],
                                libraries=["stdc++"],
+                               include_dirs=arrayobject_h_include,
+                               define_macros=[(NUMPY_CHOICE, None)],
                                language="c++"))
     
-    
-    return 1
+    return check_numpy()
+
+
+def check_numpy():
+    """Return whether the installation should continue."""
+    choice = None
+    print "Testing for Numeric: "
+    if is_Numeric_installed():
+        print "found."
+        choice = "Numeric"
+    else:
+        print "not found."
+    print "Testing for NumPy: "
+    if is_NumPy_installed():
+        print "found."
+        choice = "numpy"
+    else:
+        print "not found."
+    if choice is None:
+        print """
+        These packages are optional, which means they are only used in a few
+        specialized modules in Biopython.  You probably don't need this if you
+        are unsure.  You can ignore this requirement, and install it later if
+        you see ImportErrors."""
+        print "You can find both Numeric and NumPy at http://numpy.sourceforge.net/"
+
+        if not get_yes_or_no("Do you want to continue this installation?", True):
+            return False
+    return True
+
 
 class install_biopython(install):
     """Override the standard install to check for dependencies.
@@ -152,8 +180,8 @@
         # it automatically.
         if not is_Martel_installed():
             self.packages.append("Martel")
-        # Add software that requires Numpy to be installed.
-        if is_Numpy_installed():
+        # Add software that requires Numeric or NumPy to be installed.
+        if is_NumPy_installed() or is_Numeric_installed():
             self.packages.extend(NUMPY_PACKAGES)
         build_py.run(self)
 
@@ -181,8 +209,8 @@
     def run(self):
         if not check_dependencies_once():
             return
-        # add software that requires NumPy to install
-        if is_Numpy_installed():
+        # Add software that requires Numeric or NumPy to be installed.
+        if is_NumPy_installed() or is_Numeric_installed():
             self.extensions.extend(NUMPY_EXTENSIONS)
         build_ext.run(self)
 
@@ -305,9 +333,12 @@
         return 1
     return can_import("mx.TextTools")
 
-def is_Numpy_installed():
+def is_Numeric_installed():
     return can_import("Numeric")
 
+def is_NumPy_installed():
+    return can_import("numpy")
+
 def is_reportlab_installed():
     return can_import("reportlab")
                   
@@ -401,7 +432,7 @@
     'Bio.WWW',
     ]
 
-# packages that require Numeric Python
+# packages that require Numerical Python
 NUMPY_PACKAGES = [
     'Bio.Affy',
     'Bio.Cluster',
@@ -453,12 +484,29 @@
               ),
     ]
 
-# extensions that require numeric python
+# Extensions that require Numeric or NumPy
+if can_import("numpy"):
+    import numpy
+    arrayobject_h_include = [numpy.get_include()]
+    NUMPY_CHOICE = "NUMPY"
+else:
+    arrayobject_h_include = []
+    if can_import("Numeric"):
+        NUMPY_CHOICE = "NUMERIC"
+    else:
+        NUMPY_CHOICE = "NONE"
+
 NUMPY_EXTENSIONS = [
+    Extension('Bio.numpy_selector',
+              ['Bio/numpy_selector.c'],
+              include_dirs= arrayobject_h_include,
+              define_macros=[(NUMPY_CHOICE, None)]
+              ),
     Extension('Bio.Cluster.cluster',
               ['Bio/Cluster/clustermodule.c',
                'Bio/Cluster/cluster.c'],
-              include_dirs=["Bio/Cluster"]
+              include_dirs=["Bio/Cluster"] + arrayobject_h_include,
+              define_macros=[(NUMPY_CHOICE, None)]
               ),
 #   CplusplusExtension('Bio.Affy._cel',  # The file parser in celmodule.cc was
 #            ['Bio/Affy/celmodule.cc'],  # replaced by a scanner/consumer in
Index: Bio/LogisticRegression.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/LogisticRegression.py,v
retrieving revision 1.4
diff -u -r1.4 LogisticRegression.py
--- Bio/LogisticRegression.py	3 Feb 2007 17:22:44 -0000	1.4
+++ Bio/LogisticRegression.py	14 Mar 2007 15:45:10 -0000
@@ -14,8 +14,8 @@
 classify     Classify an observation into a class.
 """
 try:
-    from Numeric import *
-    from LinearAlgebra import *  # inverse
+    from Bio.numpy_wrapper import *
+    from Bio.linear_algebra_wrapper import *  # inverse
 except ImportError, x:
     raise ImportError, "This module requires Numeric (precursor to NumPy) with the LinearAlgebra lib"
 
Index: Bio/MarkovModel.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/MarkovModel.py,v
retrieving revision 1.2
diff -u -r1.2 MarkovModel.py
--- Bio/MarkovModel.py	21 Mar 2004 16:56:53 -0000	1.2
+++ Bio/MarkovModel.py	14 Mar 2007 15:45:10 -0000
@@ -17,8 +17,8 @@
 """
 import math
 
-from Numeric import *
-import RandomArray
+from Bio.numpy_wrapper import *
+from Bio.random_array_wrapper import seed, random
 
 import StringIO     # StringIO is in Numeric's namespace, so import this after.
 
@@ -26,7 +26,7 @@
 
 
 #RandomArray.seed(0, 0)   # use 0 for debugging
-RandomArray.seed()
+seed()
 
 VERY_SMALL_NUMBER = 1E-300
 LOG0 = log(VERY_SMALL_NUMBER)
@@ -173,12 +173,15 @@
                 pseudo_initial=None, pseudo_transition=None,
                 pseudo_emission=None, update_fn=None):
     # Returns (p_initial, p_transition, p_emission)
-    p_initial = _safe_copy_and_check(p_initial, (N,)) or \
-                _random_norm(N)
-    p_transition = _safe_copy_and_check(p_transition, (N,N)) or \
-                   _random_norm((N,N))
-    p_emission = _safe_copy_and_check(p_emission, (N,M)) or \
-                 _random_norm((N,M))
+    p_initial = _safe_copy_and_check(p_initial, (N,))
+    if alltrue(p_initial == 0):
+        p_initial == _random_norm(N)
+    p_transition = _safe_copy_and_check(p_transition, (N,N))
+    if alltrue(p_transition.flat == 0):
+        p_transition == _random_norm((N,N))
+    p_emission = _safe_copy_and_check(p_emission, (N,M))
+    if alltrue(p_emission.flat == 0):
+        p_emission = _random_norm((N,M))
 
     # Do all the calculations in log space to avoid underflows.
     lp_initial, lp_transition, lp_emission = map(
@@ -504,7 +507,7 @@
     return _normalize(matrix)
 
 def _random_norm(shape):
-    matrix = asarray(RandomArray.random(shape), MATCODE)
+    matrix = asarray(random(shape), MATCODE)
     return _normalize(matrix)
 
 def _copy_and_check(matrix, desired_shape):
Index: Bio/MaxEntropy.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/MaxEntropy.py,v
retrieving revision 1.4
diff -u -r1.4 MaxEntropy.py
--- Bio/MaxEntropy.py	21 Mar 2004 16:56:53 -0000	1.4
+++ Bio/MaxEntropy.py	14 Mar 2007 15:45:10 -0000
@@ -13,7 +13,7 @@
 
 """
 import math
-from Numeric import *
+from Bio.numpy_wrapper import *
 from Bio import listfns
 
 # XXX typecodes for Numeric
Index: Bio/NaiveBayes.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/NaiveBayes.py,v
retrieving revision 1.4
diff -u -r1.4 NaiveBayes.py
--- Bio/NaiveBayes.py	3 Feb 2007 17:33:58 -0000	1.4
+++ Bio/NaiveBayes.py	14 Mar 2007 15:45:10 -0000
@@ -30,7 +30,7 @@
 # use objects
 
 try:
-    from Numeric import *
+    from Bio.numpy_wrapper import *
 except ImportError, x:
     raise ImportError, "This module requires Numeric (precursor to NumPy)"
 
Index: Bio/cMarkovModelmodule.c
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/cMarkovModelmodule.c,v
retrieving revision 1.2
diff -u -r1.2 cMarkovModelmodule.c
--- Bio/cMarkovModelmodule.c	27 Nov 2002 01:38:13 -0000	1.2
+++ Bio/cMarkovModelmodule.c	14 Mar 2007 15:45:10 -0000
@@ -9,6 +9,8 @@
 #include "Python.h"
 #include "csupport.h"
 
+void initcMarkovModel(void);
+static PyObject *cMarkovModel__logadd(PyObject *self, PyObject *args);
 
 /* Functions in this module. */
 
Index: Bio/distance.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/distance.py,v
retrieving revision 1.4
diff -u -r1.4 distance.py
--- Bio/distance.py	3 Feb 2007 17:22:44 -0000	1.4
+++ Bio/distance.py	14 Mar 2007 15:45:10 -0000
@@ -9,7 +9,7 @@
 # XXX cosine distance
 import math
 try:
-    from Numeric import *
+    from Bio.numpy_wrapper import *
 except ImportError, x:
     raise ImportError, "This module requires Numeric (precursor to NumPy)"
 
Index: Bio/kNN.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/kNN.py,v
retrieving revision 1.4
diff -u -r1.4 kNN.py
--- Bio/kNN.py	3 Feb 2007 17:33:58 -0000	1.4
+++ Bio/kNN.py	14 Mar 2007 15:45:10 -0000
@@ -25,7 +25,7 @@
 
 """
 try:
-    from Numeric import *
+    from Bio.numpy_wrapper import *
 except ImportError, x:
     raise ImportError, "This module requires Numeric (precursor to NumPy)"
 
Index: Bio/linear_algebra_wrapper.py
===================================================================
RCS file: Bio/linear_algebra_wrapper.py
diff -N Bio/linear_algebra_wrapper.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Bio/linear_algebra_wrapper.py	14 Mar 2007 15:45:10 -0000
@@ -0,0 +1,21 @@
+"""
+A simple wrapper interface for Numeric and NumPy.
+
+Sees whether numpy_selector.c was compiled with Numeric or NumPy support,
+and imports the appropriate package.
+
+Date created: 2007-03-05
+Author: Ed Schofield <ed.schofield@cancer.org.uk>
+"""
+
+import numpy_selector
+
+choice = numpy_selector.choice()
+if choice == "Numeric":
+    from LinearAlgebra import *
+elif choice == "numpy":
+    from numpy.oldnumeric.linear_algebra import *
+else:
+    raise ImportError, "BioPython was not compiled with support for "\
+		       "Numeric or NumPy"
+
Index: Bio/matrix_wrapper.py
===================================================================
RCS file: Bio/matrix_wrapper.py
diff -N Bio/matrix_wrapper.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Bio/matrix_wrapper.py	14 Mar 2007 15:45:10 -0000
@@ -0,0 +1,21 @@
+"""
+A simple wrapper interface for Numeric and NumPy.
+
+Sees whether numpy_selector.c was compiled with Numeric or NumPy support,
+and imports the appropriate package.
+
+Date created: 2007-03-05
+Author: Ed Schofield <ed.schofield@cancer.org.uk>
+"""
+
+import numpy_selector
+
+choice = numpy_selector.choice()
+if choice == "Numeric":
+    from Matrix import *
+elif choice == "numpy":
+    from numpy.oldnumeric.matrix import *
+else:
+    raise ImportError, "BioPython was not compiled with support for "\
+		       "Numeric or NumPy"
+
Index: Bio/mlab_wrapper.py
===================================================================
RCS file: Bio/mlab_wrapper.py
diff -N Bio/mlab_wrapper.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Bio/mlab_wrapper.py	14 Mar 2007 15:45:10 -0000
@@ -0,0 +1,21 @@
+"""
+A simple wrapper interface for Numeric and NumPy.
+
+Sees whether numpy_selector.c was compiled with Numeric or NumPy support,
+and imports the appropriate package.
+
+Date created: 2007-03-05
+Author: Ed Schofield <ed.schofield@cancer.org.uk>
+"""
+
+import numpy_selector
+
+choice = numpy_selector.choice()
+if choice == "Numeric":
+    from MLab import *
+elif choice == "numpy":
+    from numpy.oldnumeric.mlab import *
+else:
+    raise ImportError, "BioPython was not compiled with support for "\
+		       "Numeric or NumPy"
+
Index: Bio/numpy_selector.c
===================================================================
RCS file: Bio/numpy_selector.c
diff -N Bio/numpy_selector.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Bio/numpy_selector.c	14 Mar 2007 15:45:10 -0000
@@ -0,0 +1,60 @@
+/* Simple C module that exports the compile-time selection of NumPy or Numeric
+ * back to Python. This is to prevent breakage if a user compiles BioPython
+ * against Numeric, then later installs NumPy (or vice versa).
+ *
+ * Date created: 2007-03-05
+ * Author: Ed Schofield <ed.schofield@cancer.org.uk>
+ * License: see LICENSE file in root of BioPython tree
+ */
+
+#include "Python.h"
+
+static PyObject* choice(PyObject *self, PyObject *args);
+PyMODINIT_FUNC initnumpy_selector(void);
+
+static char numpy_selector__doc__[] = \
+  "numpy_selector: a simple C module that exports BioPython's compile-time\n "\
+  "selection of NumPy or Numeric back to Python. This is to prevent breakage\n"\
+  "if a user compiles BioPython against Numeric, then later installs NumPy\n"\
+  "(or vice versa).\n";
+                                                      
+static char choice__doc__[] = \
+  "choice(): returns either 'Numeric' or 'numpy' as a string, indicating\n"
+  "which array package the BioPython C modules were compiled against.\n";
+                                                      
+static PyObject*
+choice(PyObject *self, PyObject *args)
+{
+#ifdef NUMERIC
+    return Py_BuildValue("s", "Numeric");
+#else
+#ifdef NUMPY
+    return Py_BuildValue("s", "numpy");
+#else
+    /* neither */
+    Py_INCREF(Py_None);
+    return Py_None;
+#endif
+#endif
+}
+
+
+/* Module functions */
+static PyMethodDef module_methods[] = {
+    {"choice",  choice, METH_VARARGS, choice__doc__},
+    {NULL, NULL, 0, NULL}  /* Sentinel */
+};
+
+
+#ifndef PyMODINIT_FUNC  /* declarations for shared library import/export */
+#define PyMODINIT_FUNC DL_EXPORT(void)
+#endif
+PyMODINIT_FUNC
+initnumpy_selector(void)
+{
+    /* Create the module and add the functions */
+    (void) Py_InitModule3("numpy_selector", module_methods, 
+                          numpy_selector__doc__); 
+}
+
+
Index: Bio/numpy_wrapper.py
===================================================================
RCS file: Bio/numpy_wrapper.py
diff -N Bio/numpy_wrapper.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Bio/numpy_wrapper.py	14 Mar 2007 15:45:10 -0000
@@ -0,0 +1,21 @@
+"""
+A simple wrapper interface for Numeric and NumPy.
+
+Sees whether numpy_selector.c was compiled with Numeric or NumPy support,
+and imports the appropriate package.
+
+Date created: 2007-03-05
+Author: Ed Schofield <ed.schofield@cancer.org.uk>
+"""
+
+from Bio import numpy_selector
+
+choice = numpy_selector.choice()
+if choice == "Numeric":
+    from Numeric import *
+elif choice == "numpy":
+    from numpy.oldnumeric import *
+else:
+    raise ImportError, "BioPython was not compiled with support for "\
+		       "Numeric or NumPy"
+
Index: Bio/random_array_wrapper.py
===================================================================
RCS file: Bio/random_array_wrapper.py
diff -N Bio/random_array_wrapper.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Bio/random_array_wrapper.py	14 Mar 2007 15:45:10 -0000
@@ -0,0 +1,21 @@
+"""
+A simple wrapper interface for Numeric and NumPy.
+
+Sees whether numpy_selector.c was compiled with Numeric or NumPy support,
+and imports the appropriate package.
+
+Date created: 2007-03-05
+Author: Ed Schofield <ed.schofield@cancer.org.uk>
+"""
+
+import numpy_selector
+
+choice = numpy_selector.choice()
+if choice == "Numeric":
+    from RandomArray import *
+elif choice == "numpy":
+    from numpy.oldnumeric.random_array import *
+else:
+    raise ImportError, "BioPython was not compiled with support for "\
+		       "Numeric or NumPy"
+
Index: Bio/Affy/CelFile.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/Affy/CelFile.py,v
retrieving revision 1.3
diff -u -r1.3 CelFile.py
--- Bio/Affy/CelFile.py	11 Feb 2005 08:08:30 -0000	1.3
+++ Bio/Affy/CelFile.py	14 Mar 2007 15:45:10 -0000
@@ -16,7 +16,7 @@
 # import _cel
 
 from Bio.ParserSupport import AbstractConsumer
-from Numeric import *
+from Bio.numpy_wrapper import *
 
 class CelScanner:
     """Scannner for Affymetrix CEL files.
Index: Bio/Affy/celmodule.cc
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/Affy/celmodule.cc,v
retrieving revision 1.2
diff -u -r1.2 celmodule.cc
--- Bio/Affy/celmodule.cc	4 May 2004 16:15:29 -0000	1.2
+++ Bio/Affy/celmodule.cc	14 Mar 2007 15:45:10 -0000
@@ -9,7 +9,12 @@
 //
 
 #include "Python.h"
+
+#ifdef NUMERIC
 #include "Numeric/arrayobject.h"
+#else
+#include "numpy/arrayobject.h"
+#endif
 
 using namespace std;
 
Index: Bio/Cluster/__init__.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/Cluster/__init__.py,v
retrieving revision 1.6
diff -u -r1.6 __init__.py
--- Bio/Cluster/__init__.py	19 Jun 2006 19:39:44 -0000	1.6
+++ Bio/Cluster/__init__.py	14 Mar 2007 15:45:10 -0000
@@ -1,4 +1,4 @@
-from Numeric import *
+from Bio.numpy_wrapper import *
 from cluster import *
 
 
Index: Bio/Cluster/clustermodule.c
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/Cluster/clustermodule.c,v
retrieving revision 1.15
diff -u -r1.15 clustermodule.c
--- Bio/Cluster/clustermodule.c	13 Mar 2007 15:06:05 -0000	1.15
+++ Bio/Cluster/clustermodule.c	14 Mar 2007 15:45:10 -0000
@@ -1,8 +1,24 @@
 #include "Python.h"
+
+#ifdef NUMERIC
 #include "Numeric/arrayobject.h"
+/* The data type used to store the Numeric or NumPy dimensions and strides
+ * array attributes: */
+typedef int npy_generic_dimension_t;
+#define NPY_GENERIC_DIMENSION_FMT "d"
+
+#else		/* Assume NumPy */
+
+#include "numpy/arrayobject.h"
+typedef npy_intp npy_generic_dimension_t;
+#define NPY_GENERIC_DIMENSION_FMT NPY_INTP_FMT
+#endif
+
+
 #include <stdio.h>
 #include <string.h>
 #include <float.h>
+
 #include "cluster.h"
 
 static char buffer[512];
@@ -21,7 +37,7 @@
 /* Takes the Python object from the argument list, and finds the microarray
  * data set. In case of an error, the array is DECREF'ed and set to NULL. */
 { int i, j;
-  int nrows, ncols;
+  npy_generic_dimension_t nrows, ncols;
   double** data = NULL;
   if(!PyArray_Check (object)) /* Try to convert object to a 2D double array */
   { *array = (PyArrayObject*) PyArray_FromObject(object, PyArray_DOUBLE, 2, 2);
@@ -84,7 +100,7 @@
 free_data(PyArrayObject* array, double** data)
 { if(data[0]!=(double*)(array->data))
   { int i;
-    const int nrows = array->dimensions[0];
+    const npy_generic_dimension_t nrows = array->dimensions[0];
     for (i=0; i<nrows; i++) free(data[i]);
   }
   free (data);
@@ -95,10 +111,10 @@
 /* -- mask ------------------------------------------------------------------ */
 
 static int**
-parse_mask (PyObject* object, PyArrayObject** array, const int dimensions[2])
+parse_mask (PyObject* object, PyArrayObject** array, const npy_generic_dimension_t dimensions[2])
 { int i, j;
-  const int nrows = dimensions[0];
-  const int ncolumns = dimensions[1];
+  const npy_generic_dimension_t nrows = dimensions[0];
+  const npy_generic_dimension_t ncolumns = dimensions[1];
   int** mask;
   if (object==NULL) /* Return the default mask */
   { mask = malloc(nrows*sizeof(int*));
@@ -137,7 +153,8 @@
   }
   if((*array)->dimensions[0] != nrows) /* Checking number of rows */
   { sprintf(message,
-      "mask has incorrect number of rows (%d expected %d)",
+      "mask has incorrect number of rows (%" NPY_GENERIC_DIMENSION_FMT \
+      ", expected %" NPY_GENERIC_DIMENSION_FMT ")", \
       (*array)->dimensions[0], nrows);
     PyErr_SetString (PyExc_ValueError, buffer);
     Py_DECREF((PyObject*)*array);
@@ -147,7 +164,8 @@
   /* no checking on last dimension of expected size 1 */
   if (ncolumns != 1 && (*array)->dimensions[1] != ncolumns)
   { sprintf(message,
-      "mask incorrect number of columns (%d expected %d)",
+      "mask has incorrect number of columns (%" NPY_GENERIC_DIMENSION_FMT \
+      ", expected %" NPY_GENERIC_DIMENSION_FMT ")",
       (*array)->dimensions[1], ncolumns);
     PyErr_SetString (PyExc_ValueError, buffer);
     *array = NULL;
@@ -166,7 +184,7 @@
     const int colstride =  (*array)->strides[1];
     for (i=0; i < nrows; i++)
     { const char* p = p0;
-      mask[i] = malloc(ncolumns*sizeof(int));
+      mask[i] = malloc(ncolumns*sizeof(int*));
       for (j=0; j < ncolumns; j++, p+=colstride) mask[i][j] = *((int*)p);
       p0 += rowstride;
     }
@@ -221,7 +239,7 @@
   { /* no checking on last dimension of expected size 1 */
     if (ndata!=1 && ndata!=(*array)->dimensions[0]) 
     { sprintf(message,
-              "weight has incorrect extent (%d expected %d)",
+              "weight has incorrect extent (%" NPY_GENERIC_DIMENSION_FMT ", expected %d)",
               (*array)->dimensions[0], ndata);
       PyErr_SetString (PyExc_ValueError, buffer);
       Py_DECREF(*array);
@@ -311,8 +329,8 @@
   if(array->nd == 1)
   { /* no checking on last dimension of expected size 1 */
     if (nitems!=1 && nitems!=array->dimensions[0]) 
-    { sprintf(message, "initialid has incorrect extent (%d expected %d)",
-        array->dimensions[0], nitems);
+    { sprintf(message, "initialid has incorrect extent (%" NPY_GENERIC_DIMENSION_FMT \
+                       ", expected %d)", array->dimensions[0], nitems);
       PyErr_SetString (PyExc_ValueError, buffer);
       Py_DECREF((PyObject*) array);
       Py_DECREF((PyObject*) clusterid);
@@ -369,7 +387,7 @@
 /* -- clusterid ------------------------------------------------------------- */
 
 static int*
-parse_clusterid(PyObject* object, PyArrayObject** array, unsigned int nitems,
+parse_clusterid(PyObject* object, PyArrayObject** array, int nitems,
   int* nclusters)
 /* This function reads the cluster assignments of all items from object */
 { int i;
@@ -411,7 +429,7 @@
   { /* no checking on last dimension of expected size 1 */
     if (nitems!=1 && nitems!=(*array)->dimensions[0]) 
     { sprintf(message,
-              "clusterid has incorrect extent (%d expected %d)",
+              "clusterid has incorrect extent (%" NPY_GENERIC_DIMENSION_FMT ", expected %d)",
               (*array)->dimensions[0], nitems);
       PyErr_SetString (PyExc_ValueError, buffer);
       Py_DECREF((PyObject*) (*array));
@@ -549,7 +567,7 @@
             break;
           }
           if (a->dimensions[0]!=i)
-          { sprintf (message, "Row %d in the distance matrix has incorrect size (%d, should be %d).", i, a->dimensions[0], i);
+          { sprintf (message, "Row %d in the distance matrix has incorrect size (%" NPY_GENERIC_DIMENSION_FMT ", should be %d).", i, a->dimensions[0], i);
             PyErr_SetString(PyExc_ValueError, buffer);
             break;
           }
@@ -605,7 +623,7 @@
             break;
           }
           if (a->dimensions[0]!=i)
-          { sprintf (message, "Row %d in the distance matrix has incorrect size (%d, should be %d).", i, a->dimensions[0], i);
+          { sprintf (message, "Row %d in the distance matrix has incorrect size (%" NPY_GENERIC_DIMENSION_FMT ", should be %d).", i, a->dimensions[0], i);
             PyErr_SetString(PyExc_ValueError, buffer);
             Py_DECREF((PyObject*)a);
             break;
@@ -1305,9 +1323,8 @@
 static PyObject*
 py_kcluster (PyObject* self, PyObject* args, PyObject* keywords)
 { int NCLUSTERS = 2;
-  int nrows, ncolumns;
-  int nitems;
-  int ndata;
+  npy_generic_dimension_t nrows, ncolumns;
+  int nitems, ndata;
   PyObject* DATA = NULL;
   PyArrayObject* aDATA = NULL;
   double** data = NULL;
@@ -1700,8 +1717,7 @@
   }
 
   if (DISTANCEMATRIX==NULL) /* DATA contains gene expression data */
-  { int nrows;
-    int ncolumns;
+  { npy_generic_dimension_t nrows, ncolumns;
     int ndata;
     PyArrayObject* aDATA = NULL;
     PyArrayObject* aMASK = NULL;
@@ -1841,10 +1857,8 @@
 
 static PyObject*
 py_somcluster (PyObject* self, PyObject* args, PyObject* keywords)
-{ int nrows;
-  int ncolumns;
-  int nitems;
-  int ndata;
+{ npy_generic_dimension_t nrows, ncolumns;
+  int nitems, ndata;
   PyObject* DATA = NULL;
   PyArrayObject* aDATA = NULL;
   double** data = NULL;
@@ -2304,9 +2318,8 @@
 
 static PyObject*
 py_clustercentroids(PyObject* self, PyObject* args, PyObject* keywords)
-{ int nrows;
-  int ncolumns;
-  unsigned int nitems;
+{ npy_generic_dimension_t nrows, ncolumns;
+  int nitems;
   int nclusters;
   PyObject* DATA = NULL;
   PyArrayObject* aDATA = NULL;
@@ -2474,7 +2487,8 @@
   int TRANSPOSE = 0;
   char DIST = 'e';
   double** distances = NULL;
-  int nrows, ncolumns, nelements, ndata;
+  npy_generic_dimension_t nrows, ncolumns;
+  int nelements, ndata;
  
   /* -- Read the input variables ----------------------------------------- */
   static char* kwlist[] = { "data",
Index: Bio/KDTree/KDTree.i
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/KDTree/KDTree.i,v
retrieving revision 1.1
diff -u -r1.1 KDTree.i
--- Bio/KDTree/KDTree.i	21 Mar 2004 14:37:46 -0000	1.1
+++ Bio/KDTree/KDTree.i	14 Mar 2007 15:45:10 -0000
@@ -4,7 +4,11 @@
 
 %{
 	#include "KDTree.h"
-	#include <Numeric/arrayobject.h> 
+	#ifdef NUMERIC
+	#include "Numeric/arrayobject.h"
+	#else
+	#include "numpy/arrayobject.h"
+	#endif
 %}
 
 // import_array() call initialises Numpy
Index: Bio/KDTree/KDTree.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/KDTree/KDTree.py,v
retrieving revision 1.5
diff -u -r1.5 KDTree.py
--- Bio/KDTree/KDTree.py	3 Feb 2007 17:05:09 -0000	1.5
+++ Bio/KDTree/KDTree.py	14 Mar 2007 15:45:10 -0000
@@ -8,11 +8,10 @@
 """
 
 try:
-    import Numeric
-    from Numeric import sum, sqrt
-    from RandomArray import *
+    from Bio.numpy_selector import sum, sqrt
+    from Bio.random_array_wrapper import random
 except ImportError:
-    raise ImportError, "This module requires Numeric (precursor to NumPy)"
+    raise ImportError, "this module requires Numeric or NumPy"
 
 import CKDTree 
 
@@ -128,16 +127,16 @@
     def set_coords(self, coords):
         """Add the coordinates of the points.
 
-        o coords - two dimensional Numeric array of type "f". E.g. if the 
-        points have dimensionality D and there are N points, the coords 
-        array should be NxD dimensional. 
+        o coords - two dimensional Numeric or NumPy array of type "f".
+        E.g. if the points have dimensionality D and there are N points,
+        the coords array should be NxD dimensional. 
         """
         if min(coords)<=-1e6 or max(coords)>=1e6:
                 raise Exception, "Points should lie between -1e6 and 1e6"
         if len(coords.shape)!=2 or coords.shape[1]!=self.dim:
-                raise Exception, "Expected a Nx%i Numeric array" % self.dim
+                raise Exception, "Expected an Nx%i array" % self.dim
         if coords.typecode()!="f":
-                raise Exception, "Expected a Numeric array of type float" 
+                raise Exception, "Expected an array of type float" 
         self.kdt.set_data(coords, coords.shape[0])
         self.built=1
 
@@ -146,17 +145,16 @@
     def search(self, center, radius):
         """Search all points within radius of center.
 
-        o center - one dimensional Numeric array of type "f". E.g. if the 
-        points have dimensionality D, the center array should be D 
-        dimensional. 
-        o radius - float>0
+        o center - one dimensional Numeric or NumPy array of type "f".
+        E.g. if the points have dimensionality D, the center array should
+        be D dimensional.  o radius - float>0
         """
         if not self.built:
                 raise Exception, "No point set specified"
         if center.shape!=(self.dim,):
-                raise Exception, "Expected a %i-dimensional Numeric array" % self.dim
+                raise Exception, "Expected a %i-dimensional array" % self.dim
         if center.typecode()!="f":
-                raise Exception, "Expected a Numeric array of type float" 
+                raise Exception, "Expected an array of type float"
         self.kdt.search_center_radius(center, radius)
 
     def get_radii(self):
@@ -173,9 +171,9 @@
     def get_indices(self):
         """Return the list of indices.
 
-        Return the list of indices after a neighbor search.
-        The indices refer to the original coords Numeric array. The
-        coordinates with these indices were within radius of center.
+        Return the list of indices after a neighbor search.  The indices
+        refer to the original coords array. The coordinates with these
+        indices were within radius of center.
 
         For an index pair, the first index<second index. 
         """
@@ -201,15 +199,13 @@
     def all_get_indices(self):
         """Return All Fixed Neighbor Search results.
 
-        Return a Nx2 dim Numeric array containing
-        the indices of the point pairs, where N
-        is the number of neighbor pairs.
+        Return a Nx2 dim array containing the indices of the point pairs,
+        where N is the number of neighbor pairs.
         """
         a=self.kdt.neighbor_get_indices()
         if a is None:
             return [] 
-        # return as Nx2 dim Numeric array, where N
-        # is number of neighbor pairs.
+        # return as Nx2 dim array, where N is number of neighbor pairs.
         a.shape=(-1, 2)
         return a
 
@@ -227,7 +223,7 @@
 
 if __name__=="__main__":
 
-    from RandomArray import *
+    from Bio.random_array_wrapper import random
 
     nr_points=100000
     dim=3
Index: Bio/KDTree/KDTree.swig.cpp
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/KDTree/KDTree.swig.cpp,v
retrieving revision 1.1
diff -u -r1.1 KDTree.swig.cpp
--- Bio/KDTree/KDTree.swig.cpp	4 May 2004 15:43:58 -0000	1.1
+++ Bio/KDTree/KDTree.swig.cpp	14 Mar 2007 15:45:11 -0000
@@ -723,7 +723,11 @@
 
 
 	#include "KDTree.h"
-	#include <Numeric/arrayobject.h> 
+	#ifdef NUMERIC
+	#include "Numeric/arrayobject.h"
+	#else
+	#include "numpy/arrayobject.h"
+	#endif
 
 
 	PyObject *KDTree_get_indices(KDTree *kdtree)
Index: Bio/MetaTool/Record.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/MetaTool/Record.py,v
retrieving revision 1.4
diff -u -r1.4 Record.py
--- Bio/MetaTool/Record.py	21 Jun 2003 02:49:53 -0000	1.4
+++ Bio/MetaTool/Record.py	14 Mar 2007 15:45:11 -0000
@@ -4,7 +4,7 @@
 # standard modules
 import string
 
-import Matrix
+# import Matrix
 
 # local stuff
 import Bio.MetaTool
Index: Bio/MetaTool/__init__.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/MetaTool/__init__.py,v
retrieving revision 1.7
diff -u -r1.7 __init__.py
--- Bio/MetaTool/__init__.py	13 May 2004 16:58:34 -0000	1.7
+++ Bio/MetaTool/__init__.py	14 Mar 2007 15:45:11 -0000
@@ -18,7 +18,7 @@
 import sgmllib
 import urlparse
 import copy
-import Matrix
+from Bio.matrix_wrapper import Matrix
 
 # XML from python 2.0
 from xml.sax import handler
@@ -224,7 +224,7 @@
 
     def end_stochiometric( self, content ):
         if( self._vectors != [] ):
-            self.data.stochiometric.matrix = Matrix.Matrix( self._vectors  )
+            self.data.stochiometric.matrix = Matrix( self._vectors  )
         self.data.stochiometric.enzymes = []
         for enzyme in self._enzymes:
             self.data.stochiometric.enzymes.append( enzyme )
@@ -236,7 +236,7 @@
 
     def end_kernel( self, content ):
         if( self._vectors != [] ):
-            self.data.kernel.matrix = Matrix.Matrix( self._vectors )
+            self.data.kernel.matrix = Matrix( self._vectors )
         self.data.kernel.enzymes = []
         for enzyme in self._enzymes:
             self.data.kernel.enzymes.append( enzyme )
@@ -245,7 +245,7 @@
 
     def end_subsets( self, content ):
         if( self._vectors != [] ):
-            self.data.subsets.matrix = Matrix.Matrix( self._vectors )
+            self.data.subsets.matrix = Matrix( self._vectors )
         self.data.subsets.enzymes = []
         for enzyme in self._enzymes:
             self.data.subsets.enzymes.append( enzyme )
@@ -255,7 +255,7 @@
 
     def end_reduced_system( self, content ):
         if( self._vectors != [] ):
-            self.data.reduced_system.matrix = Matrix.Matrix( self._vectors[:14] )
+            self.data.reduced_system.matrix = Matrix( self._vectors[:14] )
         self.data.reduced_system.enzymes = []
         for enzyme in self._enzymes:
             self.data.reduced_system.enzymes.append( enzyme )
@@ -267,7 +267,7 @@
 
     def end_convex_basis( self, content ):
         if( self._vectors != [] ):
-            self.data.convex_basis.matrix = Matrix.Matrix( self._vectors )
+            self.data.convex_basis.matrix = Matrix( self._vectors )
         self.data.convex_basis.enzymes = []
         for enzyme in self._enzymes:
             self.data.convex_basis.enzymes.append( enzyme )
@@ -276,7 +276,7 @@
 
     def end_conservation_relations( self, content ):
         if( self._vectors != [] ):
-            self.data.conservation_relations.matrix = Matrix.Matrix( self._vectors )
+            self.data.conservation_relations.matrix = Matrix( self._vectors )
         self.data.conservation_relations.enzymes = []
         for enzyme in self._enzymes:
             self.data.conservation_relations.enzymes.append( enzyme )
@@ -286,7 +286,7 @@
 
     def end_elementary_modes( self, content ):
         if( self._vectors != [] ):
-            self.data.elementary_modes.matrix = Matrix.Matrix( self._vectors )
+            self.data.elementary_modes.matrix = Matrix( self._vectors )
         self.data.elementary_modes.enzymes = []
         for enzyme in self._enzymes:
             self.data.elementary_modes.enzymes.append( enzyme )
Index: Bio/PDB/Atom.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/PDB/Atom.py,v
retrieving revision 1.18
diff -u -r1.18 Atom.py
--- Bio/PDB/Atom.py	3 Feb 2007 17:23:36 -0000	1.18
+++ Bio/PDB/Atom.py	14 Mar 2007 15:45:11 -0000
@@ -4,7 +4,7 @@
 # as part of this package.           
 
 # Python stuff
-from Numeric import array, sum, sqrt, matrixmultiply
+from Bio.numpy_wrapper import array, sum, sqrt, dot
 
 # My stuff
 from Entity import DisorderedEntityWrapper
@@ -228,7 +228,7 @@
         @param tran: the translation vector
         @type tran: size 3 Numeric array
         """
-        self.coord=matrixmultiply(self.coord, rot)+tran
+        self.coord=dot(self.coord, rot)+tran
         
     def get_vector(self):
         """
Index: Bio/PDB/Entity.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/PDB/Entity.py,v
retrieving revision 1.20
diff -u -r1.20 Entity.py
--- Bio/PDB/Entity.py	6 Feb 2007 17:13:04 -0000	1.20
+++ Bio/PDB/Entity.py	14 Mar 2007 15:45:11 -0000
@@ -5,7 +5,7 @@
 
 from __future__ import generators
 
-from Numeric import Float0
+from Bio.numpy_wrapper import Float0
 from copy import copy
 
 from PDBExceptions import PDBConstructionException, PDBException
Index: Bio/PDB/FragmentMapper.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/PDB/FragmentMapper.py,v
retrieving revision 1.9
diff -u -r1.9 FragmentMapper.py
--- Bio/PDB/FragmentMapper.py	3 Feb 2007 17:23:36 -0000	1.9
+++ Bio/PDB/FragmentMapper.py	14 Mar 2007 15:45:11 -0000
@@ -3,7 +3,7 @@
 # license.  Please see the LICENSE file that should have been included
 # as part of this package.
 
-from Numeric import array, Float0, zeros
+from Bio.numpy_wrapper import array, Float0, zeros
 import os
 
 from Bio.SVDSuperimposer import SVDSuperimposer
Index: Bio/PDB/MMCIFParser.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/PDB/MMCIFParser.py,v
retrieving revision 1.4
diff -u -r1.4 MMCIFParser.py
--- Bio/PDB/MMCIFParser.py	12 Oct 2006 08:47:37 -0000	1.4
+++ Bio/PDB/MMCIFParser.py	14 Mar 2007 15:45:11 -0000
@@ -5,7 +5,7 @@
 
 #Python stuff
 from string import atoi, atof, letters
-from Numeric import array, Float0
+from Bio.numpy_wrapper import array, Float0
 
 # My stuff
 from MMCIF2Dict import MMCIF2Dict
Index: Bio/PDB/Model.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/PDB/Model.py,v
retrieving revision 1.7
diff -u -r1.7 Model.py
--- Bio/PDB/Model.py	12 Oct 2006 08:47:37 -0000	1.7
+++ Bio/PDB/Model.py	14 Mar 2007 15:45:11 -0000
@@ -3,7 +3,7 @@
 # license.  Please see the LICENSE file that should have been included
 # as part of this package.  
 
-from Numeric import sqrt, argmin, argmax, sum, power, concatenate, array, Float0
+from Bio.numpy_wrapper import sqrt, argmin, argmax, sum, power, concatenate, array, Float0
 import os
 
 # My Stuff
Index: Bio/PDB/NeighborSearch.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/PDB/NeighborSearch.py,v
retrieving revision 1.15
diff -u -r1.15 NeighborSearch.py
--- Bio/PDB/NeighborSearch.py	3 Feb 2007 17:15:57 -0000	1.15
+++ Bio/PDB/NeighborSearch.py	14 Mar 2007 15:45:11 -0000
@@ -3,7 +3,7 @@
 # license.  Please see the LICENSE file that should have been included
 # as part of this package.
 
-from Numeric import array
+from Bio.numpy_wrapper import array
 
 from Bio.KDTree import *
 from PDBExceptions import PDBException
@@ -123,7 +123,7 @@
 
 if __name__=="__main__":
 
-    from RandomArray import *
+    from Bio.random_array_wrapper import *
 
     class Atom:
         def __init__(self):
Index: Bio/PDB/PDBParser.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/PDB/PDBParser.py,v
retrieving revision 1.20
diff -u -r1.20 PDBParser.py
--- Bio/PDB/PDBParser.py	16 Feb 2007 15:26:44 -0000	1.20
+++ Bio/PDB/PDBParser.py	14 Mar 2007 15:45:11 -0000
@@ -6,7 +6,7 @@
 # Python stuff
 import sys
 from string import split
-from Numeric import array, Float0
+from Bio.numpy_wrapper import array, Float0
 
 # My stuff
 from StructureBuilder import StructureBuilder
Index: Bio/PDB/Polypeptide.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/PDB/Polypeptide.py,v
retrieving revision 1.32
diff -u -r1.32 Polypeptide.py
--- Bio/PDB/Polypeptide.py	18 Dec 2006 11:29:53 -0000	1.32
+++ Bio/PDB/Polypeptide.py	14 Mar 2007 15:45:11 -0000
@@ -3,7 +3,7 @@
 # license.  Please see the LICENSE file that should have been included
 # as part of this package.
 
-from Numeric import sum
+from Bio.numpy_wrapper import sum
 from types import StringType
 
 from Bio.Alphabet import ProteinAlphabet
Index: Bio/PDB/ResidueDepth.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/PDB/ResidueDepth.py,v
retrieving revision 1.8
diff -u -r1.8 ResidueDepth.py
--- Bio/PDB/ResidueDepth.py	3 Feb 2007 17:15:57 -0000	1.8
+++ Bio/PDB/ResidueDepth.py	14 Mar 2007 15:45:11 -0000
@@ -6,7 +6,7 @@
 # make yield compatible with Python 2.2
 from __future__ import generators
 
-from Numeric import array, sum, sqrt
+from Bio.numpy_wrapper import array, sum, sqrt
 import tempfile
 import os
 import sys
Index: Bio/PDB/Superimposer.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/PDB/Superimposer.py,v
retrieving revision 1.8
diff -u -r1.8 Superimposer.py
--- Bio/PDB/Superimposer.py	12 Oct 2006 08:47:37 -0000	1.8
+++ Bio/PDB/Superimposer.py	14 Mar 2007 15:45:11 -0000
@@ -3,7 +3,7 @@
 # license.  Please see the LICENSE file that should have been included
 # as part of this package.
 
-from Numeric import Float0, zeros
+from Bio.numpy_wrapper import Float0, zeros
 
 from Bio.SVDSuperimposer import SVDSuperimposer
 from Bio.PDB.PDBExceptions import PDBException
@@ -60,7 +60,7 @@
 if __name__=="__main__":
 
     import sys
-    from Numeric import *
+    from Bio.numpy_wrapper import *
 
     from Bio.PDB import *
 
Index: Bio/PDB/Vector.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/PDB/Vector.py,v
retrieving revision 1.40
diff -u -r1.40 Vector.py
--- Bio/PDB/Vector.py	3 Feb 2007 17:15:57 -0000	1.40
+++ Bio/PDB/Vector.py	14 Mar 2007 15:45:11 -0000
@@ -3,11 +3,11 @@
 # license.  Please see the LICENSE file that should have been included
 # as part of this package.
 
-from Numeric import array, sum, sqrt, arccos, matrixmultiply, transpose, cos, \
+from Bio.numpy_wrapper import array, sum, sqrt, arccos, dot, transpose, cos, \
         sin, zeros, trace
 from math import acos
-from LinearAlgebra import determinant, eigenvectors
-from MLab import eye
+from Bio.linear_algebra_wrapper import determinant, eigenvectors
+from Bio.mlab_wrapper import eye
 import sys
 from math import pi
 
@@ -138,7 +138,7 @@
     b=pq.get_array()
     b.shape=(3, 1)
     i=eye(3)
-    ref=i-2*matrixmultiply(b, transpose(b))
+    ref=i-2*dot(b, transpose(b))
     return ref
 
 def rotmat(p,q):
@@ -158,7 +158,7 @@
     @return: rotation matrix that rotates p onto q
     @rtype: 3x3 Numeric array
     """
-    rot=matrixmultiply(refmat(q, -p), refmat(p, -p))
+    rot=dot(refmat(q, -p), refmat(p, -p))
     return rot
 
 def calc_angle(v1, v2, v3):
@@ -301,12 +301,12 @@
 
     def left_multiply(self, matrix):
         "Return Vector=Matrix x Vector"
-        a=matrixmultiply(matrix, self._ar)
+        a=dot(matrix, self._ar)
         return Vector(a)
 
     def right_multiply(self, matrix):
         "Return Vector=Vector x Matrix"
-        a=matrixmultiply(self._ar, matrix)
+        a=dot(self._ar, matrix)
         return Vector(a)
 
     def copy(self):
@@ -316,8 +316,8 @@
 if __name__=="__main__":
 
         from math import pi
-        from RandomArray import *
-        from Numeric import *
+        from Bio.random_array_wrapper import *
+        from Bio.numpy_wrapper import *
 
         v1=Vector(0,0,1)
         v2=Vector(0,0,0)
Index: Bio/SVDSuperimposer/SVDSuperimposer.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/SVDSuperimposer/SVDSuperimposer.py,v
retrieving revision 1.2
diff -u -r1.2 SVDSuperimposer.py
--- Bio/SVDSuperimposer/SVDSuperimposer.py	19 Mar 2004 21:37:02 -0000	1.2
+++ Bio/SVDSuperimposer/SVDSuperimposer.py	14 Mar 2007 15:45:11 -0000
@@ -3,8 +3,8 @@
 # license.  Please see the LICENSE file that should have been included
 # as part of this package.
 
-from Numeric import matrixmultiply, transpose, sum, sqrt
-from LinearAlgebra import singular_value_decomposition, determinant
+from Bio.numpy_wrapper import dot, transpose, sum, sqrt
+from Bio.linear_algebra_wrapper import singular_value_decomposition, determinant
 
 
 class SVDSuperimposer:
@@ -77,14 +77,14 @@
         coords=coords-av1
         reference_coords=reference_coords-av2
         # correlation matrix
-        a=matrixmultiply(transpose(coords), reference_coords)
+        a=dot(transpose(coords), reference_coords)
         u, d, vt=singular_value_decomposition(a)
-        self.rot=transpose(matrixmultiply(transpose(vt), transpose(u)))
+        self.rot=transpose(dot(transpose(vt), transpose(u)))
         # check if we have found a reflection
         if determinant(self.rot)<0:
             vt[2]=-vt[2]
-            self.rot=transpose(matrixmultiply(transpose(vt), transpose(u)))
-        self.tran=av2-matrixmultiply(av1, self.rot)
+            self.rot=transpose(dot(transpose(vt), transpose(u)))
+        self.tran=av2-dot(av1, self.rot)
 
     def get_transformed(self):
         "Get the transformed coordinate set."
@@ -93,7 +93,7 @@
         if self.rot is None:
             raise Exception, "Nothing superimposed yet."
         if self.transformed_coords is None:
-            self.transformed_coords=matrixmultiply(self.coords, self.rot)+self.tran
+            self.transformed_coords=dot(self.coords, self.rot)+self.tran
         return self.transformed_coords
 
     def get_rotran(self):
@@ -120,7 +120,7 @@
 
 if __name__=="__main__":
 
-    from Numeric import *
+    from Bio.numpy_wrapper import *
 
     # start with two coordinate sets (Nx3 arrays - Float0)
 
@@ -151,7 +151,7 @@
     rot, tran=sup.get_rotran()
 
     # rotate y on x
-    y_on_x1=matrixmultiply(y, rot)+tran
+    y_on_x1=dot(y, rot)+tran
 
     # same thing
     y_on_x2=sup.get_transformed()
Index: Bio/Statistics/lowess.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/Statistics/lowess.py,v
retrieving revision 1.2
diff -u -r1.2 lowess.py
--- Bio/Statistics/lowess.py	3 Feb 2007 17:24:32 -0000	1.2
+++ Bio/Statistics/lowess.py	14 Mar 2007 15:45:11 -0000
@@ -11,8 +11,8 @@
 """
 
 try:
-    from Numeric import *
-    from LinearAlgebra import solve_linear_equations
+    from Bio.numpy_wrapper import *
+    from Bio.linear_algebra_wrapper import solve_linear_equations
 except ImportError, x:
     raise ImportError, "This module requires Numeric (precursor to NumPy) with the LinearAlgebra and MLab libraries"
 
Index: Doc/install/Installation.html
===================================================================
RCS file: /home/repository/biopython/biopython/Doc/install/Installation.html,v
retrieving revision 1.9
diff -u -r1.9 Installation.html
--- Doc/install/Installation.html	27 Sep 2006 03:50:07 -0000	1.9
+++ Doc/install/Installation.html	14 Mar 2007 15:45:11 -0000
@@ -301,14 +301,18 @@
 
 <H3><A NAME="htoc12">3.2</A>&nbsp;&nbsp;Numerical Python</H3><!--SEC END -->
 
-The Numerical Python distribution (also known an Numeric or Numpy) is a
-fast implementation of arrays and associated array functionality. This
-is important for a number of Biopython modules that deal with
-number processing. The main web site for Numeric is:
+The Numerical Python distribution is a fast implementation of arrays and
+associated array functionality. This is important for a number of Biopython
+modules that deal with array processing. BioPython supports both the older
+Numeric package, which is mature but now deprecated, and the newer NumPy
+package, which is more efficient and offers new functionality.
+
+The main web site for both Numeric and NumPy is:
 <A HREF="http://sourceforge.net/projects/numpy"><TT>http://sourceforge.net/projects/numpy</TT></A> and downloads are
 available from:
 <A HREF="http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=1351"><TT>http://sourceforge.net/project/showfiles.php?group_id=1369&amp;package_id=1351</TT></A>.<BR>
 <BR>
+
 <!--TOC subsubsection UNIX and Mac OS X systems-->
 
 <H4><A NAME="htoc13">3.2.1</A>&nbsp;&nbsp;UNIX and Mac OS X systems</H4><!--SEC END -->
Index: Tests/test_Cluster.py
===================================================================
RCS file: /home/repository/biopython/biopython/Tests/test_Cluster.py,v
retrieving revision 1.6
diff -u -r1.6 test_Cluster.py
--- Tests/test_Cluster.py	27 Feb 2007 17:42:00 -0000	1.6
+++ Tests/test_Cluster.py	14 Mar 2007 15:45:11 -0000
@@ -1,4 +1,4 @@
-from Numeric import *
+from Bio.numpy_wrapper import *
 
 def print_row(data):
   print "[",
Index: Tests/test_MarkovModel.py
===================================================================
RCS file: /home/repository/biopython/biopython/Tests/test_MarkovModel.py,v
retrieving revision 1.1
diff -u -r1.1 test_MarkovModel.py
--- Tests/test_MarkovModel.py	11 Aug 2002 04:38:15 -0000	1.1
+++ Tests/test_MarkovModel.py	14 Mar 2007 15:45:11 -0000
@@ -4,7 +4,7 @@
 from operator import truth
 
 from Bio import MarkovModel
-from Numeric import ones, zeros, log, asarray
+from Bio.numpy_wrapper import ones, zeros, log, asarray
 
 def print_mm(markov_model):
     print "STATES: %s" % ' '.join(markov_model.states)
Index: Tests/test_SVDSuperimposer.py
===================================================================
RCS file: /home/repository/biopython/biopython/Tests/test_SVDSuperimposer.py,v
retrieving revision 1.2
diff -u -r1.2 test_SVDSuperimposer.py
--- Tests/test_SVDSuperimposer.py	11 Aug 2002 04:23:08 -0000	1.2
+++ Tests/test_SVDSuperimposer.py	14 Mar 2007 15:45:11 -0000
@@ -1,4 +1,4 @@
-from Numeric import *
+from Bio.numpy_wrapper import *
 
 from Bio.SVDSuperimposer import *
 
@@ -30,7 +30,7 @@
 rot, tran=sup.get_rotran()
 
 # rotate y on x manually
-y_on_x1=matrixmultiply(y, rot)+tran
+y_on_x1=dot(y, rot)+tran
 
 # same thing
 y_on_x2=sup.get_transformed()
