KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21585/root/usr/lib64/python2.4/site-packages/Numeric/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21585/root/usr/lib64/python2.4/site-packages/Numeric/Numeric.pyo
m
aAc@s3dZdkZeiZ[dkZdkTdkTdkZdkZdk	Z	dk
Z
dZei
ZeiZeiZeiZdddZdddZeiZeiZeiZeiZeiZddZdZdZd	d
ZeiZee Z!dZ"eiZddZ#dd
Z$ddZ%ddZ&ddZ'ddZ(ei)Z*dZ+dZ,dZ-dZ.ydk/l-Z-l+Z+l.Z.Wne0j
onXe-Z1dk2l3Z3ddddZ4ddddZ5ei6e5dei6e4deddddddjZ7d Z8dd!Z9d"Z:dddd#Z;dddd$Z<d%Z=d&Z>dk?Z?dk@Z@d'e?iAfd(YZAd)e?iBfd*YZBd+kClCZCd,ZDd-ZEd.ZFd/ZGdkHZHe7d0ZId1ZJeHi?eeJeId2ZKd3ZLd4ZMd5ZNdd6ZOd7ZPd8dd9ZQd8d:ZRdd;ZSdd<ZTdd=ZUdd>ZVdd?ZWdd@ZXei
Z
ddAZYdBZZdCdDdEZ[dFZ\dGZMddHZ]ddddIZ^dS(JsNumeric module defining a multi-dimensional array and useful procedures for
   Numerical computation.

Functions

-   array                      - NumPy Array construction
-   zeros                      - Return an array of all zeros
-   empty                      - Return an unitialized array (200x faster than zeros)
-   shape                      - Return shape of sequence or array
-   rank                       - Return number of dimensions
-   size                       - Return number of elements in entire array or a
                                 certain dimension
-   fromstring                 - Construct array from (byte) string
-   take                       - Select sub-arrays using sequence of indices
-   put                        - Set sub-arrays using sequence of 1-D indices
-   putmask                    - Set portion of arrays using a mask 
-   reshape                    - Return array with new shape
-   repeat                     - Repeat elements of array
-   choose                     - Construct new array from indexed array tuple
-   cross_correlate            - Correlate two 1-d arrays
-   searchsorted               - Search for element in 1-d array
-   sum                        - Total sum over a specified dimension
-   average                    - Average, possibly weighted, over axis or array.
-   cumsum                     - Cumulative sum over a specified dimension
-   product                    - Total product over a specified dimension
-   cumproduct                 - Cumulative product over a specified dimension
-   alltrue                    - Logical and over an entire axis
-   sometrue                   - Logical or over an entire axis
-   allclose		       - Tests if sequences are essentially equal

More Functions:

-   arrayrange (arange)        - Return regularly spaced array
-   asarray                    - Guarantee NumPy array
-   sarray                     - Guarantee a NumPy array that keeps precision 
-   convolve                   - Convolve two 1-d arrays
-   swapaxes                   - Exchange axes
-   concatenate                - Join arrays together
-   transpose                  - Permute axes
-   sort                       - Sort elements of array
-   argsort                    - Indices of sorted array
-   argmax                     - Index of largest value                      
-   argmin                     - Index of smallest value
-   innerproduct               - Innerproduct of two arrays
-   dot                        - Dot product (matrix multiplication)
-   outerproduct               - Outerproduct of two arrays
-   resize                     - Return array with arbitrary new shape
-   indices                    - Tuple of indices
-   fromfunction               - Construct array from universal function
-   diagonal                   - Return diagonal array
-   trace                      - Trace of array
-   dump                       - Dump array to file object (pickle)
-   dumps                      - Return pickled string representing data
-   load                       - Return array stored in file object
-   loads                      - Return array from pickled string
-   ravel                      - Return array as 1-D 
-   nonzero                    - Indices of nonzero elements for 1-D array
-   shape                      - Shape of array
-   where                      - Construct array from binary result
-   compress                   - Elements of array where condition is true
-   clip                       - Clip array between two values
-   ones                       - Array of all ones
-   identity                   - 2-D identity array (matrix)

(Universal) Math Functions 

       add                    logical_or             exp        
       subtract               logical_xor            log        
       multiply               logical_not            log10      
       divide                 maximum                sin        
       divide_safe            minimum                sinh       
       conjugate              bitwise_and            sqrt       
       power                  bitwise_or             tan        
       absolute               bitwise_xor            tanh       
       negative               invert                 ceil       
       greater                left_shift             fabs       
       greater_equal          right_shift            floor      
       less                   arccos                 arctan2    
       less_equal             arcsin                 fmod       
       equal                  arctan                 hypot      
       not_equal              cos                    around     
       logical_and            cosh                   sign
       arccosh                arcsinh                arctanh

N(t*icCsti||ddd|S(s}asarray(a,typecode=None) returns a as a NumPy array.  Unlike array(),
    no copy is performed if a is already an array.
    tcopyit	savespaceN(t
multiarraytarraytattypecodeR(RRR((t5/usr/lib64/python2.4/site-packages/Numeric/Numeric.pytasarrayscCsti|||ddS(s>sarray(a, typecode=None, copy=0) calls array with savespace=1.RiN(RRRRR(RRR((RtsarrayscCst|dd}|i}t|tiot|g||}nt
|||jo
tdnti
|||}|S(sJrepeat elements of a repeats times along axis
       repeats is a sequence of length a.shape[axis]
       telling how many times to repeat each element.
       If repeats is an integer, it is interpreted as
       a tuple of length a.shape[axis] containing repeats.
       The argument a can be anything array(a) will accept.
    RisFrepeat requires second argument integer or of length of a.shape[axis].N(RRtshapetst
isinstancetrepeatsttypestIntTypettupletaxistlent
ValueErrorRtrepeattd(RR
RRR((RRs	
cCs2ti||t|ddi|idS(sput(a, ind, v) results in a[n] = v[n] for all n in ind
       If v is shorter than mask it will be repeated as necessary.
       In particular v can be a scalar or length 1 array.
       The routine put is the equivalent of the following (although the loop 
       is in C for speed): 

           ind = array(indices, copy=0) 
           v = array(values, copy=0).astype(a, typecode()) 
           for i in ind: a.flat[i] = v[i] 
       a must be a contiguous Numeric array.
    RiN(RtputRtindRtvtastypeR(RRR((RRscCs|i}t|it}t|ddi|}|t	jo|i
fjo
d|_
nt|}t|}t|}t||i
}xNtt|D]#}||o||||<qqWnti|||dS(sputmask(a, mask, v) results in a = v for all places mask is true.
       If v is shorter than mask it will be repeated as necessary.
       In particular v can be a scalar or length 1 array.
    RiiN(i(RRttcRtmaskRtIntRRtPyObjectR
traveltaxtmxtvxtresizetrangeRtiRtputmask(RRRR$R R!RR((RR%s 

icCsUt|t|jo|}|}|}~nt|t|ddd|S(sReturns the discrete, linear convolution of 1-D
    sequences a and v; mode can be 0 (valid), 1 (same), or 2 (full)
    to specify size of the resulting sequence.
    Ni(RRRttemptcross_correlateRtmode(RRR(R&((RtconvolvescCst|dd}t|i}|djo|Sn|djo||7}n|djo||7}n|djp
||jo
tdn|djp
||jo
tdnt|}|||<|||<t
i||S(sUswapaxes(a, axis1, axis2) returns array a with axis1 and axis2
    interchanged.
    RiisBad axis1 argument to swapaxes.sBad axis2 argument to swapaxes.N(RRRR
tntaxis1taxis2Rtarangetnew_axesRt	transpose(RR+R,R*R.((Rtswapaxess"






cCsg|djoti|Sn1g}x'|D]}|it||dq+Wtti||dS(s\concatenate(a, axis=0) joins the tuple of sequences in a into a single
    NumPy array.
    iN(RRtconcatenateRtnew_listtmtappendR0(RRR3R2((RR1s
cCsti||S(stranspose(a, axes=None) returns array with dimensions permuted
    according to axes.  If axes is None (default) returns array with
    dimensions reversed.
    N(RR/Rtaxes(RR5((RR/sicCst|dd}t|i}|djo||7}n|djp
||jo
tdn||djot|||d}nti	|}||djot||d}n|S(sIsort(a,axis=-1) returns array with elements sorted along given axis.
    Ris sort axis argument out of boundsiiN(RRRR
R*RRR0RtsortR(RRR*R((RR6s

cCst|dd}t|i}|djo||7}n|djp
||jo
tdn||djot|||d}nti	|}||djot||d}n|S(sargsort(a,axis=-1) return the indices into a of the sorted array
    along the given axis, so that take(a,result,axis) is the sorted array.
    Ris#argsort axis argument out of boundsiiN(RRRR
R*RRR0RtargsortR(RRR*R((RR7	s

cCst|dd}t|i}|djo||7}n|djp
||jo
tdn||djot|||d}nti	|}||djot||d}n|S(soargmax(a,axis=-1) returns the indices to the maximum value of the
    1-D arrays along the given axis.    
    Ris"argmax axis argument out of boundsiiN(RRRR
R*RRR0RtargmaxR(RRR*R((RR8s

cCst|dd}|i}td|}|dgjotd|}n||}t|i}|djo||7}n|djp
||jo
t
dn||djot|||d}nti
|}||djot||d}n|S(soargmin(a,axis=-1) returns the indices to the minimum value of the
    1-D arrays along the given axis.    
    Ritbwuis"argmin axis argument out of boundsiN(RRtarraRttypetnumRR
R*RRR0RR8R(RRR:R*RR<R;((Rtargmin%s$


cCsxyti||SWn]tj
oQ}t|ifjpt|ifjo||Sqtt|pdnXdS(sinnerproduct(a,b) returns the dot product of two arrays, which has
    shape a.shape[:-1] + b.shape[:-1] with elements computed by summing the
    product of the elements from the last dimensions of a and b.
    sinvalid types for dotN(RtinnerproductRtbt	TypeErrortdetailRR
(RR?RA((RR>;s,cCs:t|iddtft|itddfS(souterproduct(a,b) returns the outer product of two vectors.
      result(i,j) = a(i)*b(j) when a and b are vectors
      Will accept any arguments that can be made into vectors.
   N(RRtflattNewAxisR?(RR?((RtouterproductHscCsxyti||SWn]tj
oQ}t|ifjpt|ifjo||Sqtt|pdnXdS(sdot(a,b) returns matrix-multiplication between a and b.  The product-sum
    is over the last dimension of a and the second-to-last dimension of b.
    sinvalid types for dotN(Rt
matrixproductRR?R@RARR
(RR?RA((RtdotQs,cCs"titt|t|S(sReturns the dot product of 2 vectors (or anything that can be made into
       a vector). NB: this is not the same as `dot`, as it takes the conjugate
       of its first argument if complex and always returns a scalar.N(RREt	conjugateRRR?(RR?((Rtvdot]s(sdotsinnerproductsvdot(sarray2stringcCst||||ddS(Ns, i(tarray2stringRtmax_line_widtht	precisiontsuppress_small(RRJRKRL((Rt
array_reprnscCst||||ddS(Nt i(RIRRJRKRL(RRJRKRL((Rt	array_strqsistiR$cCst|}t|pt||iSnti|}t	|t|}|t|}|djo|d}t||}nt|f|}|djo|| }nt
||S(s{resize(a,new_shape) returns a new array with the specified shape.
    The original array's total size can be any size.
    iiN(RRRtzerost	new_shapeRtmultiplytreducet
total_sizetinttn_copiestextraR1treshape(RRRRXRURW((RR"{s



cCsYt||}g}x7tt|D]#}|it	i
||dq(Wt|S(sindices(dimensions,typecode=None) returns an array representing a grid
    of indices with row-only, and column-only variation.
    iN(tonest
dimensionsRttmptlstR#RR$R4taddt
accumulateR(R[RR\R$R]((Rtindicess!cCst|tt|S(sfromfunction(function, dimensions) returns an array constructed by
    calling function on a tuple of number grids.  The function should
    accept as many arguments as there are dimensions which is a list of
    numbers indicating the length of the desired output for each axis.
    N(tapplytfunctionRR`R[(RbR[((RtfromfunctionscCst|}||jo||}}n|djoItt|i}||=||=||g|dd+t||}n|i}t|djo|d}	|d}
|	|
}|f}t
||}|djoFt|t|
|t|
|	||
d|
||
ddSqt|t|t|	|
||
d||
ddSnFg}x2t|dD] }|it|||qyWt|SdS(s}diagonal(a, offset=0, axis1=0, axis2=1) returns the given diagonals
    defined by the last two dimensions of the array.
    iiiN(RRR,R+R#RR
R.R/Rtn1tn2R*RYtoffsetttaketmintmy_diagonalR$R4tdiagonal(RRfR+R,RiR$RR*R.RdRe((RRjs0

	


	
F=cCstit||||S(s~trace(a,offset=0, axis1=0, axis2=1) returns the sum along diagonals
    (defined by the last two dimenions) of the array.
    N(R^RTRjRRfR+R,(RRfR+R,((RttracescCs|idjo
tdn|i}to
d}nd}|id|i||i	fx|D]}|id|qmW|id|i|idS(NtOs.Numeric Pickler can't pickle arrays of ObjectstLtBsA%s%s%d s%d s
(R3RR@R
RtLittleEndiantendiantfptwritetitemsizeRttostring(R3RqRRRp((Rt	DumpArrays
	
&
c	Csti|i}|dddjo|dd|d<n|dd}|dd}td|d}ti	|dd}tt||}|i|}t||}t||}to
|djpto|djo|iSn|SdS(NitAicCs
ti|S(N(tstringtatoitx(Ry((Rt<lambda>siRnRm(RwtsplitRqtreadlinetlnRRptmapR
RxRsRTRStsztreadtdatat
fromstringR3RYRotbyteswapped(	RqRR}R3R
RRpRsR((Rt	LoadArrays)t	UnpicklercBs0tZdZeieiiZeed<RS(NcCs|iit|dS(N(tselftstackR4R(R((Rt
load_arraysRv(t__name__t
__module__RRtpickleRtdispatch(((RRs	tPicklercBs0tZdZeieiiZeee<RS(NcCst||dS(N(RutobjectR(RR((Rt
save_arrays(RRRRRRRt	ArrayType(((RRs	(sStringIOcCst|i|dS(sKdump(object, file) pickles (binary-writes) the object to an open file.
    N(RtfiletdumpR(RR((RRscCs&t}t|i||iS(sVdumps(object) pickles (binary-writes) the object and returns the byte
    stream.
    N(tStringIORRRRtgetvalue(RR((Rtdumpss	cCst|iS(sNload(file) returns an array from the open file pointing to pickled data. 
    N(RRtload(R((RR
scCst|}t|iS(s^loads(str) returns an array from a byte stream containing its pickled
    representation.
    N(RtstrRRR(RR((RtloadsscCs;t||}||_t|jo|iSn|SdS(N(RtthestrRRyR
RotEndianR(R
RRRRy((Rtarray_constructors
	
cCs%t|i|i|itffS(N(RRR
RRtRo(R((Rtpickle_array!scCs
t|dS(sXravel(m) returns a 1d array corresponding to all the elements of it's
    argument.
    iN(i(RYR3(R3((RR+scCs"ttt|t|dS(s]nonzero(a) returns the indices of the elements of a which are not zero,
    a must be 1d
    iN(RR-RRt	not_equal(R((Rtnonzero1scCs
t|iS(sfshape(a) returns the shape of a (as a function call which
       also works on nested sequences).
    N(RRR
(R((RR
7scCstt|d||fS(swhere(condition,x,y) is shaped like condition and has elements of x and
    y where condition is respectively true or false.
    iN(tchooseRt	conditiontyRy(RRyR((Rtwhere=scCst|t||S(scompress(condition, x, axis=-1) = those elements of x corresponding 
    to those elements of condition that are "true".  condition must be the
    same size as the given dimension of x.N(RgR3RRR(RR3R((RtcompressCscCs6t||dt||}t||||fS(sclip(m, m_min, m_max) = every entry in m that is less than m_min is
    replaced by m_min, and every entry greater than m_max is replaced by
    m_max.
    iN(tlessR3tm_mintgreatertm_maxtselectorR(R3RRR((RtclipIs tlcCs t|||}d|d<|S(s{ones(shape, typecode=Int, savespace=0) returns an array of the given
    dimensions which is initialized to all ones. 
    i.N(RQR
RRR(R
RRR((RRZQs
cCs-ttdg|dgd|||fS(s<identity(n) returns the identity matrix of shape n x n.
    iiRN(R"RR*R(R*R((RtidentityYscCst|dd}t|i}|djo||7}n|djo|ddgjo|dSn|djp
||jo
tdnti||S(s'Sum the array over the given axis.
    RiisImproper axis argument to sum.N(	RRyRR
R*RRR^RT(RyRR*((Rtsum^s
 
cCst|dd}t|i}|djo||7}n|djo|ddgjo|dSn|djp
||jotdfSnti||S(s2Product of the array elements over the given axis.Riis"Improper axis argument to product.N(	RRyRR
R*RRRSRT(RyRR*((Rtproductis
 cCst|dd}t|i}|djo||7}n|djo%|ddgjo|ddjSn|djp
||jotdfSnti||S(s)Perform a logical_or over the given axis.Riis#Improper axis argument to sometrue.N(	RRyRR
R*RRt
logical_orRT(RyRR*((Rtsometruess
 cCst|dd}t|i}|djo||7}n|djo%|ddgjo|ddjSn|djp
||jotdfSnti||S(s*Perform a logical_and over the given axis.Riis"Improper axis argument to product.N(	RRyRR
R*RRtlogical_andRT(RyRR*((Rtalltrue}s
 cCst|dd}t|i}|djo||7}n|djo|ddgjo|dSn|djp
||jotdfSnti||S(s"Sum the array over the given axis.Riis!Improper axis argument to cumsum.N(	RRyRR
R*RRR^R_(RyRR*((Rtcumsums
 cCst|dd}t|i}|djo||7}n|djo|ddgjo|dSn|djp
||jotdfSnti||S(s"Sum the array over the given axis.Riis%Improper axis argument to cumproduct.N(	RRyRR
R*RRRSR_(RyRR*((Rt
cumproducts
 cCst|}t|}|ot|d|}n
t|}|t|it}t	t
|dt|t|}|o||d|}n||}|S(swaround(m, decimals=0)     Round in the same way as standard python performs rounding. Returns 
    always a float.
    f10.0f0.5N(
RR3tsignRtdecimalstabsoluteRRtremRRtfloortceil(R3RRR((Rtarounds'
cCs6t|}tt|t|dt|dS(ssign(m) gives an array with shape of m with elements defined by sign
    function:  where m is less than 0 return -1, where m greater than 0, a=1,
    elsewhere a=0.
    iN(RR3RQR
RR(R3((RRsf1.0000000000000001e-05f1e-08cCs[t|dd}t|dd}tt||||t|}t
t|S(sU allclose(a,b,rtol=1.e-5,atol=1.e-8)
        Returns true if all components of a and b are equal
        subject to given tolerances.
        The relative error rtol must be positive and << 1.0
        The absolute error atol comes into play for those elements
        of y that are very small or zero; it says how small x must be also.
    RiN(RRRyR?RRRtatoltrtolRRR(RR?RRRRRy((Rtallcloses
'cCstt|S(srGet the rank of sequence a (the number of dimensions, not a matrix rank)
       The rank of a scalar is zero.
    N(RR
R(R((RtrankscCs&y|iSWnt|iSnXdS(sGet the shape of sequence aN(RR
R(R((RR
s
cCsTt|}|djo/t|djodSqPtd|Sn	||SdS(sBGet the number of elements in sequence a, or along a certain axis.iicCs||S(N(RyR(RyR((RRzsN(R
RRRtNoneRRT(RRR((Rtsizes
cCs^|d
joxt|i}|d
jo#ti|}	t	|d}qt|id}ti||}	ti|}nt|}|i}|fjo
d|_n|d
joEti||}	||d}|ott|	|}qnt|ddd}|i}|fjo
d}n||jo,ti|||}	ti||}n|||fjoy||}tg|}
td
d
d|
|<tdtt|
d}ti|||}	ti||}n
tdt|tp|djo
td	q9n|o|	||fSn	|	|Sd
S(
s(average(a, axis=0, weights=None)
       Computes average along indicated axis. 
       If axis is None, average over the entire array.
       Inputs can be integer or floating types; result is type Float.
   
       If weights are given, result is:
           sum(a*weights)/(sum(weights))
       weights must have a's shape or be the 1-d with length the size
       of a in the given axis. Integer weights are converted to Float.

       Not supplying weights is equivalent to supply weights that are
       all 1.

       If returned, return a tuple: the result and the sum of the weights 
       or count of values. The shape of these two results will be the same.

       raises ZeroDivisionError if appropriate when result is scalar.
       (The version in MA does not -- it returns masked values).
    f1.0iRisw[s]*ones(ash, Float)saverage: weights wrong shape.f0.0s!Numeric.average, zero denominatorN(i(i(RRRRRBtweightsR^RTR*RRtwR
tashtreturnedRZtwshtniRCtrtslicetevaltreprRtw1RRRtZeroDivisionError(RRRRRRRRRR*RR((RtaveragesN

	


	




 	
(_t__doc__tnumeric_versiontversiont__version__Rtumatht	Precisiont_numpyRwRtmathRRCR-t
arrayrangeRRQtemptyRR	RRgRYRR'RRR%R)t	arraytypeRR;tsint	UfuncTypeR0R1R/R6R7R8R=tbinarysearchtsearchsortedR>RDRFRHtdotblastImportErrortmatrixmultiplytArrayPrinterRIRMROtset_string_functionRoR"R`RcRjRkRuRRRRRRRRRRtcopy_regRRRRR
RRRRZRRRRRRRRRRRRR(SR%RRR
RoRRRRCRRwRZRR-RR)R`RRRRR8RRRRRRRRRR1RRHR/RIRjRRR7RRRRRR'RRQRRR6RRRRRR"RcR=RRRRuRRR>RRYRgRORR	RDRRkRRRRRRMR0RF((Rt?Us																			
		
				
!	
				
											




		
		

Anon7 - 2021