rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
c,rowc,ptrc,ierr = func(data1,self.rowind[:nnz1],self.indptr,data2,other.rowind[:nnz2],other.indptr) | c,rowc,ptrc,ierr = func(data1,self.rowind[:nnz1],self.indptr,data2,ocs.rowind[:nnz2],ocs.indptr) | def __add__(self, other): ocs = csc_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." typecode = _coerce_rules[(self.typecode,other.typecode)] nnz1, nnz2 = self.nnz, other.nnz data1, data2 = _convert_data(self.data[:nnz1], other.data[:nnz2], typecode) func = getattr(sparsetools,_trans... |
tcode = s.typecode func = getattr(sparsetools,tcode+'transp') | func = getattr(sparsetools,s.ftype+'transp') | def __init__(self,s,ij=None,M=None,N=None,nzmax=100,typecode=Float,copy=0): spmatrix.__init__(self, 'csr') if isinstance(s,spmatrix): if isinstance(s, csr_matrix): # do nothing but copy information self.shape = s.shape if copy: self.data = s.data.copy() self.colind = s.colind.copy() self.indptr = s.indptr.copy() else: ... |
func(s.data, s.rowind, s.indptr) | func(s.shape[1], s.data, s.rowind, s.indptr) | def __init__(self,s,ij=None,M=None,N=None,nzmax=100,typecode=Float,copy=0): spmatrix.__init__(self, 'csr') if isinstance(s,spmatrix): if isinstance(s, csr_matrix): # do nothing but copy information self.shape = s.shape if copy: self.data = s.data.copy() self.colind = s.colind.copy() self.indptr = s.indptr.copy() else: ... |
if (len(self.data) != len(self.colind)): | if (len(self.data) != nzmax): | def _check(self): M,N = self.shape if (rank(self.data) != 1) or (rank(self.colind) != 1) or \ (rank(self.indptr) != 1): raise ValueError, "Data, colind, and indptr arrays "\ "should be rank 1." if (len(self.data) != len(self.colind)): raise ValueError, "Data and row list should have same length" if (len(self.indptr) !=... |
if (nzmax < nnz): raise ValueError, "Nzmax must not be less than nnz." | def _check(self): M,N = self.shape if (rank(self.data) != 1) or (rank(self.colind) != 1) or \ (rank(self.indptr) != 1): raise ValueError, "Data, colind, and indptr arrays "\ "should be rank 1." if (len(self.data) != len(self.colind)): raise ValueError, "Data and row list should have same length" if (len(self.indptr) !=... | |
if (self.indptr[-1] > len(self.colind)): | if (nnz > nzmax): | def _check(self): M,N = self.shape if (rank(self.data) != 1) or (rank(self.colind) != 1) or \ (rank(self.indptr) != 1): raise ValueError, "Data, colind, and indptr arrays "\ "should be rank 1." if (len(self.data) != len(self.colind)): raise ValueError, "Data and row list should have same length" if (len(self.indptr) !=... |
self.nnz = self.indptr[-1] self.nzmax = len(self.colind) | def _check(self): M,N = self.shape if (rank(self.data) != 1) or (rank(self.colind) != 1) or \ (rank(self.indptr) != 1): raise ValueError, "Data, colind, and indptr arrays "\ "should be rank 1." if (len(self.data) != len(self.colind)): raise ValueError, "Data and row list should have same length" if (len(self.indptr) !=... | |
new = csr_matrix(N,M,nzmax=0,typecode=self.typecode) | new = csc_matrix(N,M,nzmax=0,typecode=self.typecode) | def transp(self, copy=0): M,N = self.shape new = csr_matrix(N,M,nzmax=0,typecode=self.typecode) if copy: new.data = self.data.copy() new.colind = self.rowind.copy() new.indptr = self.indptr.copy() else: new.data = self.data new.colind = self.rowind new.indptr = self.indptr new._check() return new |
new.colind = self.rowind.copy() | new.rowind = self.colind.copy() | def transp(self, copy=0): M,N = self.shape new = csr_matrix(N,M,nzmax=0,typecode=self.typecode) if copy: new.data = self.data.copy() new.colind = self.rowind.copy() new.indptr = self.indptr.copy() else: new.data = self.data new.colind = self.rowind new.indptr = self.indptr new._check() return new |
new.colind = self.rowind | new.rowind = self.colind | def transp(self, copy=0): M,N = self.shape new = csr_matrix(N,M,nzmax=0,typecode=self.typecode) if copy: new.data = self.data.copy() new.colind = self.rowind.copy() new.indptr = self.indptr.copy() else: new.data = self.data new.colind = self.rowind new.indptr = self.indptr new._check() return new |
dict['__header__'] = fid.fid.read(124).strip(' \t\n\000') | dict['__header__'] = fid.raw_read(124).strip(' \t\n\000') | def _parse_header(fid, dict): correct_endian = (ord('M')<<8) + ord('I') # if this number is read no BS fid.seek(126) # skip to endian detector endian_test = fid.read(1,'int16') if (endian_test == correct_endian): openstr = 'n' else: # must byteswap if LittleEndian: openstr = 'b' else: openstr = 'l' fid.setformat(open... |
test = fid.fid.read(1) | test = fid.raw_read(1) | def _get_element(fid): test = fid.fid.read(1) if len(test) == 0: # nothing left raise EOFError else: fid.rewind(1) # get the data tag raw_tag = fid.read(1,'u') # check for compressed numbytes = raw_tag >> 16 if numbytes > 0: # compressed format if numbytes > 4: raise IOError, "Problem with MAT file: " \ "too many b... |
if typecode is None: return out else: return out.astype(typecode) | if typecode is not None: out = out.astype(typecode) if not isinstance(out, ndarray): out = asarray(out) return out | def valarray(shape,value=nan,typecode=None): """Return an array of all value. """ out = reshape(repeat([value],product(shape)),shape) if typecode is None: return out else: return out.astype(typecode) |
if not _active.window_is_alive(): | if not _active.proxy_object_alive: | def validate_active(): global _active if _active is None: figure() try: if not _active.window_is_alive(): _active = None figure() except: pass |
""" | """ fs =float(fs) | def bilinear(b,a,fs=1.0): """Return a digital filter from an analog filter using the bilinear transform. The bilinear transform substitutes (z-1) / (z+1) for s """ a,b = map(r1array,(a,b)) D = len(a) - 1 N = len(b) - 1 artype = Num.Float M = max([N,D]) Np = M Dp = M bprime = Num.zeros(Np+1,artype) aprime = Num.zeros(D... |
fs = 2 | fs = 2.0 | def iirfilter(N, Wn, rp=None, rs=None, btype='band', analog=0, ftype='butter', output='ba'): """IIR digital and analog filter design given order and critical points. Description: Design an Nth order lowpass digital or analog filter and return the filter coefficients in (B,A) (numerator, denominator) or (Z,P,K) form. ... |
for k, col in enumerate(j): | for k, col in enumerate(seq): | def __setitem__(self, index, x): try: assert len(index) == 2 except (AssertionError, TypeError): raise IndexError, "invalid index" i, j = index if isinstance(i, int): if not (i>=0 and i<self.shape[0]): raise IndexError, "lil_matrix index out of range" else: if isinstance(i, slice): seq = xrange(i.start or 0, i.stop or ... |
a, axis = asarray(a, axis) | a, axis = _chk_asarray(a, axis) | def tmax(a,upperlimit,axis=0,inclusive=True): """Returns the maximum value of a, along axis, including only values greater than (or equal to, if inclusive is True) upperlimit. If the limit is set to None, a limit larger than the max value in the array is used. """ a, axis = asarray(a, axis) if inclusive: upperfc... |
assert_array_almost_equal(sort(roots(a3)),sort([-3,-2]),11) | assert_array_almost_equal(sort(roots(a3)),sort([-3,-2]),7) | def check_basic(self): a1 = [1,-4,4] a2 = [4,-16,16] a3 = [1,5,6] assert_array_almost_equal(roots(a1),[2,2],11) assert_array_almost_equal(roots(a2),[2,2],11) assert_array_almost_equal(sort(roots(a3)),sort([-3,-2]),11) |
assert_array_almost_equal(sort(roots(poly(a))),sort(a),11) | assert_array_almost_equal(sort(roots(poly(a))),sort(a),5) | def check_inverse(self): a = rand(5) assert_array_almost_equal(sort(roots(poly(a))),sort(a),11) |
assert_array_equal(trapz(y,x,1),val) | assert_array_equal(trapz(y,x,axis=1),val) | def check_nd(self): x = sort(20*rand(10,20,30)) y = x**2 + 2*x + 1 dx = x[:,1:,:] - x[:,:-1,:] val = add.reduce(dx*(y[:,1:,:] + y[:,:-1,:])/2.0,1) assert_array_equal(trapz(y,x,1),val) |
"""blackman(M) returns the M-point Blackman window. | """The M-point Blackman window. | def blackman(M): """blackman(M) returns the M-point Blackman window. """ n = arange(0,M) return 0.42-0.5*cos(2.0*pi*n/(M-1)) + 0.08*cos(4.0*pi*n/(M-1)) |
"""bartlett(M) returns the M-point Bartlett window. | """The M-point Bartlett window. | def bartlett(M): """bartlett(M) returns the M-point Bartlett window. """ n = arange(0,M) return where(less_equal(n,(M-1)/2.0),2.0*n/(M-1),2.0-2.0*n/(M-1)) |
"""hanning(M) returns the M-point Hanning window. | """The M-point Hanning window. | def hanning(M): """hanning(M) returns the M-point Hanning window. """ n = arange(0,M) return 0.5-0.5*cos(2.0*pi*n/(M-1)) |
"""hamming(M) returns the M-point Hamming window. | """The M-point Hamming window. | def hamming(M): """hamming(M) returns the M-point Hamming window. """ n = arange(0,M) return 0.54-0.46*cos(2.0*pi*n/(M-1)) |
"""kaiser(M, beta) returns a Kaiser window of length M with shape parameter beta. It depends on the cephes module for the modified bessel function i0. | """Returns a Kaiser window of length M with shape parameter beta. | def kaiser(M,beta): """kaiser(M, beta) returns a Kaiser window of length M with shape parameter beta. It depends on the cephes module for the modified bessel function i0. """ n = arange(0,M) alpha = (M-1)/2.0 return special.i0(beta * sqrt(1-((n-alpha)/alpha)**2.0))/special.i0(beta) |
'csscal scopy ccopy sdot cdotu cdotc snrm2 scnrm2 sasum scasum'\ 'samax camax sgemv cgemv chemv ssymv strmv ctrmv sgemm cgemm'.split()) | ' csscal scopy ccopy sdot cdotu cdotc snrm2 scnrm2 sasum scasum'\ ' isamax icamax sgemv cgemv chemv ssymv strmv ctrmv'\ ' sgemm cgemm'.split()) | def configuration(parent_package=''): package = 'linalg' from interface_gen import generate_interface config = default_config_dict(package,parent_package) local_path = get_path(__name__) atlas_info = get_info('atlas') #atlas_info = {} # uncomment if ATLAS is available but want to use # Fortran LAPACK/BLAS; useful for ... |
entires = rows*cols | entries = rows*cols | def mmwrite(target,a,comment='',field=None,precision=None): """ Writes the sparse or dense matrix A to a Matrix Market formatted file. Inputs: target - Matrix Market filename (extension .mtx) or open file object a - sparse or full matrix comment - comments to be prepended to the Matrix Market file field ... |
target.write('%i %i %i\n' % (rows,cols,entires)) | target.write('%i %i %i\n' % (rows,cols,entries)) | def mmwrite(target,a,comment='',field=None,precision=None): """ Writes the sparse or dense matrix A to a Matrix Market formatted file. Inputs: target - Matrix Market filename (extension .mtx) or open file object a - sparse or full matrix comment - comments to be prepended to the Matrix Market file field ... |
new = zeros((newlen,), arr.dtype.char) | new = zeros((newlen,), arr.dtype) | def resize1d(arr, newlen): old = len(arr) new = zeros((newlen,), arr.dtype.char) new[:old] = arr return new |
(self.shape + (self.dtype.char, self.getnnz(), self.nzmax, \ | (self.shape + (self.dtype.type, self.getnnz(), self.nzmax, \ | def __repr__(self): format = self.getformat() return "<%dx%d sparse matrix of type '%s'\n\twith %d stored "\ "elements (space for %d)\n\tin %s format>" % \ (self.shape + (self.dtype.char, self.getnnz(), self.nzmax, \ _formats[format][1])) |
csc.dtype.char = csc.data.dtype.char | csc.dtype = csc.data.dtype | def _real(self): csc = self.tocsc() csc.data = real(csc.data) csc.dtype.char = csc.data.dtype.char csc.ftype = _transtabl[csc.dtype.char] return csc |
csc.dtype.char = csc.data.dtype.char | csc.dtype = csc.data.dtype | def _imag(self): csc = self.tocsc() csc.data = imag(csc.data) csc.dtype.char = csc.data.dtype.char csc.ftype = _transtabl[csc.dtype.char] return csc |
self.dtype.char = self.data.dtype.char | self.dtype = self.data.dtype | def _check(self): M, N = self.shape nnz = self.indptr[-1] nzmax = len(self.rowind) |
new.dtype.char = new.data.dtype.char | new.dtype = new.data.dtype | def __mul__(self, other): """ Scalar, vector, or matrix multiplication """ if isscalar(other) or (isdense(other) and rank(other)==0): new = self.copy() new.data *= other new.dtype.char = new.data.dtype.char new.ftype = _transtabl[new.dtype.char] return new else: return self.dot(other) #else: # return TypeError, "unk... |
new.dtype.char = new.data.dtype.char | new.dtype = new.data.dtype | def __rmul__(self, other): # other * self if isscalar(other) or (isdense(other) and rank(other)==0): new = self.copy() new.data = other * new.data new.dtype.char = new.data.dtype.char new.ftype = _transtabl[new.dtype.char] return new else: other = asarray(other) return self.transpose().dot(other.transpose()).transpose... |
new.dtype.char = new.data.dtype.char | new.dtype = new.data.dtype | def __pow__(self, other): """ Element-by-element power (unless other is a scalar, in which case return the matrix power.) """ if isscalar(other) or (isdense(other) and rank(other)==0): new = self.copy() new.data = new.data ** other new.dtype.char = new.data.dtype.char new.ftype = _transtabl[new.dtype.char] return new e... |
new = csr_matrix((N, M), nzmax=self.nzmax, dtype=self.dtype.char) | new = csr_matrix((N, M), nzmax=self.nzmax, dtype=self.dtype) | def transpose(self, copy=False): M, N = self.shape new = csr_matrix((N, M), nzmax=self.nzmax, dtype=self.dtype.char) if copy: new.data = self.data.copy() new.colind = self.rowind.copy() new.indptr = self.indptr.copy() else: new.data = self.data new.colind = self.rowind new.indptr = self.indptr new._check() return new |
new = csc_matrix(self.shape, nzmax=self.nzmax, dtype=self.dtype.char) | new = csc_matrix(self.shape, nzmax=self.nzmax, dtype=self.dtype) | def conj(self, copy=False): new = csc_matrix(self.shape, nzmax=self.nzmax, dtype=self.dtype.char) if copy: new.data = self.data.conj().copy() new.rowind = self.rowind.conj().copy() new.indptr = self.indptr.conj().copy() else: new.data = self.data.conj() new.rowind = self.rowind.conj() new.indptr = self.indptr.conj() ne... |
new = csc_matrix(self.shape, nzmax=self.nzmax, dtype=self.dtype.char) | new = csc_matrix(self.shape, nzmax=self.nzmax, dtype=self.dtype) | def copy(self): new = csc_matrix(self.shape, nzmax=self.nzmax, dtype=self.dtype.char) new.data = self.data.copy() new.rowind = self.rowind.copy() new.indptr = self.indptr.copy() new._check() return new |
self.dtype.char = self.data.dtype.char | self.dtype = self.data.dtype | def _check(self): M, N = self.shape nnz = self.indptr[-1] nzmax = len(self.colind) if (rank(self.data) != 1) or (rank(self.colind) != 1) or \ (rank(self.indptr) != 1): raise ValueError, "data, colind, and indptr arrays "\ "should be rank 1" if (len(self.data) != nzmax): raise ValueError, "data and row list should have... |
new.dtype.char = new.data.dtype.char | new.dtype = new.data.dtype | def __mul__(self, other): """ Scalar, vector, or matrix multiplication """ if isscalar(other) or (isdense(other) and rank(other)==0): new = self.copy() new.data = other * new.data # allows type conversion new.dtype.char = new.data.dtype.char new.ftype = _transtabl[new.dtype.char] return new else: return self.do... |
new.dtype.char = new.data.dtype.char | new.dtype = new.data.dtype | def __rmul__(self, other): # other * self if isscalar(other) or (isdense(other) and rank(other)==0): new = self.copy() new.data = other * new.data # allows type conversion new.dtype.char = new.data.dtype.char new.ftype = _transtabl[new.dtype.char] return new else: other = asarray(other) return self.transpose()... |
new.dtype.char = new.data.dtype.char | new.dtype = new.data.dtype | def __pow__(self, other): """ Element-by-element power (unless other is a scalar, in which case return the matrix power.) """ if isscalar(other) or (isdense(other) and rank(other)==0): new = self.copy() new.data = new.data ** other new.dtype.char = new.data.dtype.char new.ftype = _transtabl[new.dtype.char] return new e... |
new = csc_matrix((N, M), nzmax=self.nzmax, dtype=self.dtype.char) | new = csc_matrix((N, M), nzmax=self.nzmax, dtype=self.dtype) | def transpose(self, copy=False): M, N = self.shape new = csc_matrix((N, M), nzmax=self.nzmax, dtype=self.dtype.char) if copy: new.data = self.data.copy() new.rowind = self.colind.copy() new.indptr = self.indptr.copy() else: new.data = self.data new.rowind = self.colind new.indptr = self.indptr new._check() return new |
new = csr_matrix(self.shape, nzmax=self.nzmax, dtype=self.dtype.char) | new = csr_matrix(self.shape, nzmax=self.nzmax, dtype=self.dtype) | def copy(self): new = csr_matrix(self.shape, nzmax=self.nzmax, dtype=self.dtype.char) new.data = self.data.copy() new.colind = self.colind.copy() new.indptr = self.indptr.copy() new._check() return new |
self.dtype.char = self.data.dtype.char | self.dtype = self.data.dtype | def __init__(self, obj, ij_in, dims=None, nzmax=None, dtype=None): spmatrix.__init__(self) try: # Assume the first calling convention # assert len(ij) == 2 if len(ij_in) != 2: if isdense( ij_in ) and (ij_in.shape[1] == 2): ij = (ij_in[:,0], ij_in[:,1]) else: raise AssertionError else: ij = ij_in if dims is N... |
self.data = array(data, self.dtype.char) | self.data = array(data, self.dtype) | def _normalize(self, rowfirst=False): if rowfirst: l = zip(self.row, self.col, self.data) l.sort() row, col, data = list(itertools.izip(*l)) return data, row, col if getattr(self, '_is_normalized', None): return self.data, self.row, self.col l = zip(self.col, self.row, self.data) l.sort() col, row, data = list(itertool... |
if xb is None: xb=x[0] if xe is None: xe=x[-1] | if xb is None: xb=x.min() if xe is None: xe=x.max() | def splrep(x,y,w=None,xb=None,xe=None,k=3,task=0,s=None,t=None, full_output=0,nest=None,per=0,quiet=1): """Find the B-spline representation of 1-D curve. Description: Given the set of data points (x[i], y[i]) determine a smooth spline approximation of degree k on the interval xb <= x <= xe. The coefficients, c, and ... |
if xb is None: xb=x[0] if xe is None: xe=x[-1] if yb is None: yb=y[0] if ye is None: ye=y[-1] | if xb is None: xb=x.min() if xe is None: xe=x.max() if yb is None: yb=y.min() if ye is None: ye=y.max() | def bisplrep(x,y,z,w=None,xb=None,xe=None,yb=None,ye=None,kx=3,ky=3,task=0,s=None, eps=1e-16,tx=None,ty=None,full_output=0,nxest=None,nyest=None,quiet=1): """Find a bivariate B-spline representation of a surface. Description: Given a set of data points (x[i], y[i], z[i]) representing a surface z=f(x,y), compute a B-s... |
self.file.tell() | return self.file.tell() | def tell(self): self.file.tell() |
if result[:11] == 'Bad command' and sys.platform == 'win32': | res = bbox_re.search(result) if res is None and sys.platform=='win32': | def convert_bounding_box(inname, outname): fid = open(inname,'r') oldfile = fid.read() fid.close() gsargs = '-dNOPAUSE -dBATCH -sDEVICE=bbox' # use cygwin gs if present cmd = 'gs %s %s' % (gsargs, inname) w, r = os.popen4(cmd) w.close() result = r.read() r.close() if result[:11] == 'Bad command' and sys.platform == 'wi... |
if result[:11] == 'Bad command': | res = bbox_re.search(result) if res is None: sys.stderr.write('To fix bounding box install ghostscript in the PATH') | def convert_bounding_box(inname, outname): fid = open(inname,'r') oldfile = fid.read() fid.close() gsargs = '-dNOPAUSE -dBATCH -sDEVICE=bbox' # use cygwin gs if present cmd = 'gs %s %s' % (gsargs, inname) w, r = os.popen4(cmd) w.close() result = r.read() r.close() if result[:11] == 'Bad command' and sys.platform == 'wi... |
res = bbox_re.search(result) | def convert_bounding_box(inname, outname): fid = open(inname,'r') oldfile = fid.read() fid.close() gsargs = '-dNOPAUSE -dBATCH -sDEVICE=bbox' # use cygwin gs if present cmd = 'gs %s %s' % (gsargs, inname) w, r = os.popen4(cmd) w.close() result = r.read() r.close() if result[:11] == 'Bad command' and sys.platform == 'wi... | |
print diff | def kmeans_(obs,guess,thresh=1e-5): """* See kmeans Outputs: code_book -- the lowest distortion codebook found. avg_dist -- the average distance a observation is from a code in the book. Lower means the code_book matches the data better. Test: Note: not whitened in this example. >>> features = array([[ 1.9,2.3], ...... | |
[0,1,1,1], | [1,1,1,1], | def check_diag(self): assert_equal(tri(4,k=1),array([[1,1,0,0], [1,1,1,0], [0,1,1,1], [1,1,1,1]])) assert_equal(tri(4,k=-1),array([[0,0,0,0], [1,0,0,0], [1,1,0,0], [1,1,1,0]])) |
assert_equal(tril(a,k=-2),b) | assert_equal(triu(a,k=-2),b) | def check_diag(self): a = (100*get_mat(5)).astype('f') b = a.copy() for k in range(5): for l in range(max((k-1,0)),5): b[l,k] = 0 assert_equal(triu(a,k=2),b) b = a.copy() for k in range(5): for l in range(k+3,5): b[l,k] = 0 assert_equal(tril(a,k=-2),b) |
def _check_bdtrik(self): assert_equal(cephes.bdtrik(1,3,0.5),3.0) | def check_bdtrik(self): cephes.bdtrik(1,3,0.5) | def _check_bdtrik(self): assert_equal(cephes.bdtrik(1,3,0.5),3.0) |
def _check_chndtrix(self): | def check_chndtrix(self): | def _check_chndtrix(self): assert_equal(cephes.chndtrix(0,1,0),0.0) |
def _check_gdtrib(self): assert_equal(cephes.gdtrib(1,0,1),5.0) | def check_gdtrib(self): cephes.gdtrib(1,0,1) | def _check_gdtrib(self): assert_equal(cephes.gdtrib(1,0,1),5.0) |
def _check_hankel1(self): | def check_hankel1(self): | def _check_hankel1(self): cephes.hankel1(1,1) |
def _check_hankel1e(self): | def check_hankel1e(self): | def _check_hankel1e(self): cephes.hankel1e(1,1) |
def _check_hankel2(self): | def check_hankel2(self): | def _check_hankel2(self): cephes.hankel2(1,1) |
def _check_hankel2e(self): | def check_hankel2e(self): | def _check_hankel2e(self): cephes.hankel2e(1,1) |
def _check_it2i0k0(self): | def check_it2i0k0(self): | def _check_it2i0k0(self): cephes.it2i0k0(1) |
def _check_it2j0y0(self): | def check_it2j0y0(self): | def _check_it2j0y0(self): cephes.it2j0y0(1) |
def _check_itairy(self): | def check_itairy(self): | def _check_itairy(self): cephes.itairy(1) |
def check_ive(self): | def _check_ive(self): | def check_ive(self): assert_equal(cephes.ive(1,0),0.0) |
def check_jve(self): | def _check_jve(self): | def check_jve(self): assert_equal(cephes.jve(0,0),1.0) |
def _check_kei(self): | def check_kei(self): | def _check_kei(self): cephes.kei(2) |
def _check_ker(self): | def check_ker(self): | def _check_ker(self): cephes.ker(2) |
def _check_kerp(self): | def check_kerp(self): | def _check_kerp(self): cephes.kerp(2) |
def _check_mathieu_modcem2(self): | def check_mathieu_modcem2(self): | def _check_mathieu_modcem2(self): cephes.mathieu_modcem2(1,1,1) |
def _check_mathieu_modsem2(self): | def check_mathieu_modsem2(self): | def _check_mathieu_modsem2(self): cephes.mathieu_modsem2(1,1,1) |
def check_modstruve(self): | def _check_modstruve(self): | def check_modstruve(self): assert_equal(cephes.modstruve(1,0),0.0) |
cephes.nbdtrik(1,1,1) | cephes.nbdtrik(1,.4,.5) | def __check_nbdtrik(self): cephes.nbdtrik(1,1,1) |
def _check_ncfdtr(self): | def check_ncfdtr(self): | def _check_ncfdtr(self): assert_equal(cephes.ncfdtr(1,1,1,0),0.0) |
def _check_ncfdtri(self): | def check_ncfdtri(self): | def _check_ncfdtri(self): assert_equal(cephes.ncfdtri(1,1,1,0),0.0) |
def _check_ncfdtridfd(self): | def check_ncfdtridfd(self): | def _check_ncfdtridfd(self): cephes.ncfdtridfd(1,0.5,0,1) |
def _check_nctdtrit(self): | def check_nctdtrit(self): | def _check_nctdtrit(self): cephes.nctdtrit(.1,0.2,.5) |
def _check_nrdtrimn(self): | def check_nrdtrimn(self): | def _check_nrdtrimn(self): assert_equal(cephes.nrdtrimn(0.5,1,1),1.0) |
def _check_nrdtrisd(self): | def check_nrdtrisd(self): | def _check_nrdtrisd(self): assert_equal(cephes.nrdtrisd(0.5,0.5,0.5),0.0) |
def _check_obl_ang1(self): | def check_obl_ang1(self): | def _check_obl_ang1(self): cephes.obl_ang1(1,1,1,0) |
def _check_obl_ang1_cv(self): assert_equal(cephes.obl_ang1_cv(1,1,1,1,0),(1.0,0.0)) def check_obl_cv(self): | def check_obl_ang1_cv(self): result = cephes.obl_ang1_cv(1,1,1,1,0) assert_almost_equal(result[0],1.0) assert_almost_equal(result[1],0.0) def _check_obl_cv(self): | def _check_obl_ang1_cv(self): assert_equal(cephes.obl_ang1_cv(1,1,1,1,0),(1.0,0.0)) |
def _check_obl_rad1(self): | def check_obl_rad1(self): | def _check_obl_rad1(self): cephes.obl_rad1(1,1,1,0) |
def _check_obl_rad1_cv(self): | def check_obl_rad1_cv(self): | def _check_obl_rad1_cv(self): cephes.obl_rad1_cv(1,1,1,1,0) |
def _check_pbdv(self): | def check_pbdv(self): | def _check_pbdv(self): assert_equal(cephes.pbdv(1,0),(0.0,0.0)) |
def _check_pbvv(self): | def check_pbvv(self): | def _check_pbvv(self): cephes.pbvv(1,0) |
def _check_pdtrik(self): | def check_pdtrik(self): | def _check_pdtrik(self): cephes.pdtrik(0.5,1) |
def _check_pro_ang1(self): | def check_pro_ang1(self): | def _check_pro_ang1(self): cephes.pro_ang1(1,1,1,0) |
def _check_pro_ang1_cv(self): | def check_pro_ang1_cv(self): | def _check_pro_ang1_cv(self): assert_equal(cephes.pro_ang1_cv(1,1,1,1,0),(1.0,0.0)) |
def check_pro_cv(self): | def _check_pro_cv(self): | def check_pro_cv(self): assert_equal(cephes.pro_cv(1,1,0),2.0) |
cephes.pro_rad1(1,1,1,0) | cephes.pro_rad1(1,1,1,0.1) | def check_pro_rad1(self): # x>1 gives segfault with ifc, but not with gcc # x<1 returns nan, no segfault cephes.pro_rad1(1,1,1,0) |
assert_equal(cephes.smirnov(1,1),0.0) | assert_equal(cephes.smirnov(1,.1),0.9) | def check_smirnov(self): assert_equal(cephes.smirnov(1,1),0.0) |
assert_equal(cephes.smirnovi(1,0),1.0) | def check_smirnovi(self): assert_almost_equal(cephes.smirnov(1,cephes.smirnovi(1,0.4)),0.4) assert_almost_equal(cephes.smirnov(1,cephes.smirnovi(1,0.6)),0.6) assert_equal(cephes.smirnovi(1,0),1.0) | |
def _check_stdtridf(self): | def check_stdtridf(self): | def _check_stdtridf(self): cephes.stdtridf(0.7,1) |
def _check_stdtrit(self): | def check_stdtrit(self): | def _check_stdtrit(self): cephes.stdtrit(1,0.7) |
val *= exp(0.5*gammaln(n-m+1)-gammaln(n+m+1)) | val *= exp(0.5*(gammaln(n-m+1)-gammaln(n+m+1))) | def _sph_harmonic(m,n,theta,phi): """inputs of (m,n,theta,phi) returns spherical harmonic of order m,n (|m|<=n) and argument theta and phi: Y^m_n(theta,phi) """ x = cos(phi) m,n = int(m), int(n) Pmn,Pmnd = lpmn(m,n,x) val = Pmn[m,n] val *= sqrt((2*n+1)/4.0/pi) val *= exp(0.5*gammaln(n-m+1)-gammaln(n+m+1)) val *= exp(1... |
"""inputs of (m,n,theta,phi) returns spherical harmonic of order m,n (|m|<=n) and argument theta and phi: Y^m_n(theta,phi) | """Spherical harmonic of order m,n (|m|<=n) and argument theta and phi: Y^m_n(theta,phi) | def _sph_harmonic(m,n,theta,phi): """inputs of (m,n,theta,phi) returns spherical harmonic of order m,n (|m|<=n) and argument theta and phi: Y^m_n(theta,phi) """ x = cos(phi) m,n = int(m), int(n) Pmn,Pmnd = lpmn(m,n,x) val = Pmn[m,n] val *= sqrt((2*n+1)/4.0/pi) val *= exp(0.5*(gammaln(n-m+1)-gammaln(n+m+1))) val *= exp... |
val = Pmn[m,n] | val = Pmn[-1, -1] | def _sph_harmonic(m,n,theta,phi): """inputs of (m,n,theta,phi) returns spherical harmonic of order m,n (|m|<=n) and argument theta and phi: Y^m_n(theta,phi) """ x = cos(phi) m,n = int(m), int(n) Pmn,Pmnd = lpmn(m,n,x) val = Pmn[m,n] val *= sqrt((2*n+1)/4.0/pi) val *= exp(0.5*(gammaln(n-m+1)-gammaln(n+m+1))) val *= exp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.