General utility functions and classes for Topographica that require numpy.
|
|
ufunc_script_repr(f,
imports,
prefix=None,
settings=None)
Return a runnable representation of the numpy ufunc f, and an
import statement for its module. |
source code
|
|
|
|
L2norm(v)
Return the L2 norm of the vector v. |
source code
|
|
|
|
norm(v,
p=2)
Returns the Lp norm of v, where p is arbitrary and defaults to 2. |
source code
|
|
|
|
divisive_normalization(weights)
Divisively normalize an array to sum to 1.0 |
source code
|
|
|
|
add_border(matrix,
width=1,
value=0.0)
Returns a new matrix consisting of the given matrix with a border
or margin of the given width filled with the given value. |
source code
|
|
|
|
|
|
|
octave_str(mat,
name='mat',
owner='')
Print the given Numpy matrix in Octave format, listing the given
matrix name and the object that owns it (if any). |
source code
|
|
|
|
octave_output(filename,
mat,
name='mat',
owner='')
Writes the given matrix to a new file of the given name, in Octave format. |
source code
|
|
|
|
centroid(array_2D)
Return the centroid (center of gravity) for a 2D array. |
source code
|
|
|
|
|
|
|
|
|
|
wrap(lower,
upper,
x)
Circularly alias the numeric value x into the range [lower,upper). |
source code
|
|
|
|
array_argmax(arr)
Returns the coordinates of the maximum element in the given array. |
source code
|
|