ó
    Û“,jÌ
  ã                   ó¤   • S SK 7  S SK7  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S r	0 r
S\
S'   S	\
S
'   S\
S'   S\
S'   S\
S'   S\
S'   SS jrg)é   )Ú*)Úminimize)Úextras)Útesting)Úversionc                  ó¶   • SSK Jn   SS KnUR                  5       nUR	                  U " [
        5      S   5      nUR                  5       nUR                  U5        g )Né    )Úsplit)Úos.pathr
   ÚunittestÚ
TestLoaderÚdiscoverÚ__file__ÚTextTestRunnerÚrun)r
   r   Útest_loaderÚtest_runners       Ú�C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\chumpy/__init__.pyÚtestr      sI   € ÝÛØ×$Ñ$Ó&€KØ×&Ñ&¡u¬X£°qÑ'9Ó:€KØ×)Ñ)Ó+€KØ‡O�O�[Õ"ó    z 
import chumpy as ch

[x1, x2, x3] = ch.array(10), ch.array(20), ch.array(30)
result = x1+x2+x3
print result # prints [ 60.]
print result.dr_wrt(x1) # prints 1
ÚscalaraP  
import chumpy as ch

[x1, x2, x3] = ch.array(10), ch.array(20), ch.array(30)
for i in range(3): x2 = x1 + x2 + x3

x2.dr_wrt(x1) # pull cache 
x2.dr_wrt(x3) # pull cache
x1.label='x1' # for clarity in show_tree()
x2.label='x2' # for clarity in show_tree()
x3.label='x3' # for clarity in show_tree()
x2.show_tree(cachelim=1e-4) # in MB
Ú	show_treez‡
import chumpy as ch

x1, x2, x3, x4 = ch.eye(10), ch.array(1), ch.array(5), ch.array(10)
y = x1*(x2-x3)+x4
print y
print y.dr_wrt(x2)
Úmatrixz¿
import chumpy as ch

m = [ch.random.randn(100).reshape((10,10)) for i in range(3)]
y = m[0].dot(m[1]).dot(ch.linalg.inv(m[2])) * ch.linalg.det(m[0])
print y.shape
print y.dr_wrt(m[0]).shape
ÚlinalgaÚ  
import chumpy as ch
import numpy as np

class Sin(ch.Ch):

    dterms = ('x',)

    def compute_r(self):
        return np.sin(self.x.r)

    def compute_dr_wrt(self, wrt):
        import scipy.sparse
        if wrt is self.x:
            result = np.cos(self.x.r)
            return scipy.sparse.diags([result.ravel()], [0]) if len(result)>1 else np.atleast_2d(result)

x1 = Ch([10,20,30])
result = Sin(x1) # or "result = Sin(x=x1)"
print result.r
print result.dr_wrt(x1)
Úinheritancea)  
import chumpy as ch

x = ch.zeros(10)
y = ch.zeros(10)

# Beale's function
e1 = 1.5 - x + x*y
e2 = 2.25 - x  + x*(y**2)
e3 = 2.625 - x + x*(y**3)

objective = {'e1': e1, 'e2': e2, 'e3': e3}
ch.minimize(objective, x0=[x,y], method='dogleg')
print x # should be all 3.0
print y # should be all 0.5
ÚoptimizationNc                 ó  • U [         ;  a)  [        S5        [          H  n[        SU< S35        M     g [        S5        [        [         U    5        [        S5        [        S[         U    -   [        5       [	        5       5        g )Nz0Please indicate which demo you want, as follows:z	demo('z')z4- - - - - - - - - - - <CODE> - - - - - - - - - - - -z6- - - - - - - - - - - </CODE> - - - - - - - - - - - -
z
global np
)ÚdemosÚprintÚexecÚglobalsÚlocals)ÚwhichÚkeys     r   Údemor%   k   sb   € Ø”EÓÜÐ@ÔAßˆCÝ£CÐ)Ö*ñ àä	Ð
@ÔAÜ	Œ%�‰,ÔÜ	Ð
CÔDÜˆœ˜u™Ñ	%¤w£y´&³(Õ;r   )N)ÚchÚlogicr   r   Ú r   r   r   Ú__version__r   r   r%   © r   r   Ú<module>r+      sp   ðÜ Ü å "Ý Ý Ý +å +ò#ð 	€ð€€h�ð€€kÑ ð€€h�ð€€h�ð€€mÑ ð.€€nÑ õ(
<r   