Package snobfit :: Module util

Module util

source code

Supplementary or Auxiliary Functions for Snobfit

Most of them are the functions of the Rough MATLAB-Numpy Equivalents.

Functions
 
rand(d0, d1, dn, ...)
Random values in a given shape.
source code
 
within(low, x, high) source code
 
feval(funcName, *args) source code
 
find(*args, **kw) source code
 
toCol(v)
v is a vector
source code
 
toRow(m)
m is a n x 1 matrix
source code
 
mldiv(a, b)
Backslash or left matrix divide.
source code
 
chol(a)
a is a mat
source code
 
svd(a)
a is a mat
source code
 
qr(a) source code
 
vector(n)
Return a vector of the given length.
source code
 
ivector(n=0)
Return a int vector of the given length.
source code
 
sort(x) source code
 
std(x)
STD(X) normalizes by (N-1) where N is the sequence length.
source code
 
max_(x)
[Y,I] = MAX(X) returns the indices of the maximum values in vector I.
source code
 
min_(x)
[Y,I] = MIN(X) returns the index of the minimum value in vector I.
source code
 
toInt(x) source code
 
isEmpty(x) source code
 
removeByInd(a, ind) source code
 
duplicate(v, n, axis=0) source code
 
dup(v, n, axis=0) source code
 
dot3(a, b, c) source code
 
crdot(m, v) source code
 
rsort(x, w=None)
Sort x in increasing order, remove multiple entries, and adapt weights w accordingly x and w must both be a row or a column default input weights are w=1
source code
Variables
  eps = 2.2204460492503131e-16
  inf = inf
  nan = nan
  isnan = <ufunc 'isnan'>
Function Details

rand(d0, d1, dn, ...)

source code 

Random values in a given shape.

Create an array of the given shape and propagate it with random samples from a uniform distribution over [0, 1).

Parameters

d0, d1, ..., dn : int
Shape of the output.

Returns

out : ndarray, shape (d0, d1, ..., dn)
Random values.

See Also

random

Notes

This is a convenience function. If you want an interface that takes a shape-tuple as the first argument, refer to random.

Examples

>>> np.random.rand(3,2)
array([[ 0.14022471,  0.96360618],  #random
       [ 0.37601032,  0.25528411],  #random
       [ 0.49313049,  0.94909878]]) #random

mldiv(a, b)

source code 
Backslash or left matrix divide. a is the matrix division of A into B, which is roughly the same as INV(A)*B

std(x)

source code 
STD(X) normalizes by (N-1) where N is the sequence length. This makes STD(X).^2 the best unbiased estimate of the variance if X is a sample from a normal distribution.

max_(x)

source code 
[Y,I] = MAX(X) returns the indices of the maximum values in vector I. If the values along the first non-singleton dimension contain more than one maximal element, the index of the first one is returned.

min_(x)

source code 
[Y,I] = MIN(X) returns the index of the minimum value in vector I. If the values along the first non-singleton dimension contain more than one minimal element, the index of the first one is returned.

rsort(x, w=None)

source code 

Sort x in increasing order, remove multiple entries, and adapt weights w accordingly x and w must both be a row or a column default input weights are w=1

If w==None, the weighted empirical cdf is computed at x dof = len(x) at input is the original number of degrees of freedom

Warning: when you use this function, make sure x and w is row vector