<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18702">
<STYLE>@font-face {
        font-family: 宋体;
}
@font-face {
        font-family: Verdana;
}
@font-face {
        font-family: @宋体;
}
@page Section1 {size: 595.3pt 841.9pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; layout-grid: 15.6pt; }
P.MsoNormal {
        TEXT-JUSTIFY: inter-ideograph; TEXT-ALIGN: justify; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; FONT-SIZE: 10.5pt
}
LI.MsoNormal {
        TEXT-JUSTIFY: inter-ideograph; TEXT-ALIGN: justify; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; FONT-SIZE: 10.5pt
}
DIV.MsoNormal {
        TEXT-JUSTIFY: inter-ideograph; TEXT-ALIGN: justify; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"; FONT-SIZE: 10.5pt
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
        FONT-STYLE: normal; FONT-FAMILY: Verdana; COLOR: windowtext; FONT-WEIGHT: normal; TEXT-DECORATION: none; mso-style-type: personal-compose
}
DIV.Section1 {
        page: Section1
}
UNKNOWN {
        FONT-SIZE: 10pt
}
BLOCKQUOTE {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 2em
}
OL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
UL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</STYLE>
</HEAD>
<BODY style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE: 10pt">
<DIV><FONT color=#000080 size=2 face=Verdana>Most of the time, it just needs the 
largest or smallest eigenvalues/vectors. But unfortunately, it needs 
more.</FONT></DIV>
<DIV><FONT color=#000080></FONT>&nbsp;</DIV>
<DIV><FONT color=#000080>Thanks.</FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Verdana></FONT>&nbsp;</DIV>
<DIV><FONT color=#000080 size=2 face=Verdana></FONT>&nbsp;</DIV>
<DIV><FONT color=#c0c0c0 size=2 face=Verdana>2009-04-29 </FONT></DIV><FONT 
color=#000080 size=2 face=Verdana>
<HR style="WIDTH: 100px" align=left color=#b5c4df SIZE=1>
</FONT>
<DIV><FONT color=#c0c0c0 size=2 face=Verdana><SPAN>Zhenxin Zhan</SPAN> 
</FONT></DIV>
<HR color=#b5c4df SIZE=1>

<DIV><FONT size=2 face=Verdana><STRONG>发件人:</STRONG> Sebastian Walter 
</FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>发送时间:</STRONG> 2009-04-29&nbsp; 02:17:38 
</FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>收件人:</STRONG> Discussion of Numerical 
Python </FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>抄送:</STRONG> </FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>主题:</STRONG> Re: [Numpy-discussion] 
MemoryError for computing eigen-vector on 10,000*10, 000 matrix </FONT></DIV>
<DIV><FONT size=2 face=Verdana></FONT> </DIV>
<DIV><FONT size=2 face=Verdana>
<DIV>+1&nbsp;to&nbsp;that</DIV>
<DIV></DIV>
<DIV>Often,&nbsp;one&nbsp;is&nbsp;only&nbsp;interested&nbsp;in&nbsp;the&nbsp;largest&nbsp;or&nbsp;smallest</DIV>
<DIV>eigenvalues/vectors&nbsp;of&nbsp;a&nbsp;problem.&nbsp;Then&nbsp;the&nbsp;method&nbsp;of&nbsp;choice&nbsp;are</DIV>
<DIV>iterative&nbsp;solvers,&nbsp;e.g.&nbsp;Lanczos&nbsp;algorithm.</DIV>
<DIV>If&nbsp;only&nbsp;the&nbsp;largest&nbsp;eigenvalue/vector&nbsp;is&nbsp;needed,&nbsp;&nbsp;you&nbsp;could&nbsp;try&nbsp;the</DIV>
<DIV>power&nbsp;iteration.</DIV>
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>
<DIV>On&nbsp;Wed,&nbsp;Apr&nbsp;29,&nbsp;2009&nbsp;at&nbsp;7:49&nbsp;AM,&nbsp;Zhenxin&nbsp;Zhan&nbsp;&lt;andyjian430074@gmail.com&gt;&nbsp;wrote:</DIV>
<DIV>&gt;&nbsp;Thanks.&nbsp;My&nbsp;mistake.</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;&nbsp;The&nbsp;os&nbsp;is&nbsp;32-bit.&nbsp;I&nbsp;am&nbsp;doing&nbsp;a&nbsp;network-simulation&nbsp;for&nbsp;my&nbsp;teacher.&nbsp;The</DIV>
<DIV>&gt;&nbsp;average&nbsp;degree&nbsp;of&nbsp;the&nbsp;network&nbsp;topology&nbsp;is&nbsp;about&nbsp;6.0.&nbsp;So&nbsp;I&nbsp;think&nbsp;it&nbsp;is</DIV>
<DIV>&gt;&nbsp;sparse.</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;&nbsp;The&nbsp;paper&nbsp;needs&nbsp;the&nbsp;eigen&nbsp;values&nbsp;and&nbsp;the&nbsp;eigen&nbsp;vectors&nbsp;which&nbsp;are&nbsp;necessary</DIV>
<DIV>&gt;&nbsp;for&nbsp;the&nbsp;further&nbsp;simulation.&nbsp;&nbsp;I&nbsp;use&nbsp;the&nbsp;following&nbsp;procedure:</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;&nbsp;1.&nbsp;&nbsp;read&nbsp;the&nbsp;network&nbsp;vertices&nbsp;information&nbsp;from&nbsp;a&nbsp;txt&nbsp;file&nbsp;to&nbsp;a&nbsp;10,000*10,000</DIV>
<DIV>&gt;&nbsp;list&nbsp;'lists'.</DIV>
<DIV>&gt;&nbsp;2.&nbsp;&nbsp;And&nbsp;then&nbsp;use&nbsp;numpy.array(lits,&nbsp;dtype=float)&nbsp;to&nbsp;get&nbsp;a&nbsp;array&nbsp;object&nbsp;'A'</DIV>
<DIV>&gt;&nbsp;3.&nbsp;Finally,&nbsp;use&nbsp;numpy.linalg.eig(A)&nbsp;to&nbsp;get&nbsp;the&nbsp;eigen&nbsp;values&nbsp;and&nbsp;eigen</DIV>
<DIV>&gt;&nbsp;vectors.</DIV>
<DIV>&gt;&nbsp;4.&nbsp;Using&nbsp;'tofile'&nbsp;function&nbsp;to&nbsp;write&nbsp;them&nbsp;to&nbsp;local&nbsp;file.</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;&nbsp;I&nbsp;will&nbsp;refer&nbsp;to&nbsp;scipy.</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;&nbsp;Thanks&nbsp;so&nbsp;much.</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;&nbsp;2009-04-29</DIV>
<DIV>&gt;&nbsp;________________________________</DIV>
<DIV>&gt;&nbsp;Zhenxin&nbsp;Zhan</DIV>
<DIV>&gt;&nbsp;________________________________</DIV>
<DIV>&gt;&nbsp;发件人:&nbsp;Charles&nbsp;R&nbsp;Harris</DIV>
<DIV>&gt;&nbsp;发送时间:&nbsp;2009-04-29&nbsp;&nbsp;00:36:03</DIV>
<DIV>&gt;&nbsp;收件人:&nbsp;Discussion&nbsp;of&nbsp;Numerical&nbsp;Python</DIV>
<DIV>&gt;&nbsp;抄送:</DIV>
<DIV>&gt;&nbsp;主题:&nbsp;Re:&nbsp;[Numpy-discussion]&nbsp;MemoryError&nbsp;for&nbsp;computing&nbsp;eigen-vector&nbsp;on</DIV>
<DIV>&gt;&nbsp;10,000*10,&nbsp;000&nbsp;matrix</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;&nbsp;2009/4/28&nbsp;Zhenxin&nbsp;Zhan&nbsp;&lt;andyjian430074@gmail.com&gt;</DIV>
<DIV>&gt;&gt;</DIV>
<DIV>&gt;&gt;&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;reply.</DIV>
<DIV>&gt;&gt;</DIV>
<DIV>&gt;&gt;&nbsp;My&nbsp;os&nbsp;is&nbsp;Windows&nbsp;XP&nbsp;SP3.&nbsp;I&nbsp;tried&nbsp;to&nbsp;use&nbsp;array(ojb,&nbsp;dtype=float),&nbsp;but&nbsp;it</DIV>
<DIV>&gt;&gt;&nbsp;didn't&nbsp;work.&nbsp;And&nbsp;I&nbsp;tried&nbsp;'float32'&nbsp;as&nbsp;you&nbsp;told&nbsp;me.&nbsp;And&nbsp;here&nbsp;is&nbsp;the&nbsp;error</DIV>
<DIV>&gt;&gt;&nbsp;message:</DIV>
<DIV>&gt;&gt;</DIV>
<DIV>&gt;&gt;</DIV>
<DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;File&nbsp;"C:\Python26\Lib\site-packages\numpy\linalg\linalg.py",&nbsp;line&nbsp;791,&nbsp;in&nbsp;eig</DIV>
<DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a,&nbsp;t,&nbsp;result_t&nbsp;=&nbsp;_convertarray(a)&nbsp;#&nbsp;convert&nbsp;to&nbsp;double&nbsp;or&nbsp;cdouble&nbsp;type</DIV>
<DIV>&gt;&gt;</DIV>
<DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;File&nbsp;"C:\Python26\Lib\site-packages\numpy\linalg\linalg.py",&nbsp;line&nbsp;727,&nbsp;in&nbsp;_con</DIV>
<DIV>&gt;&gt;&nbsp;vertarray</DIV>
<DIV>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&nbsp;=&nbsp;_fastCT(a.astype(t))</DIV>
<DIV>&gt;&gt;&nbsp;MemoryError</DIV>
<DIV>&gt;&gt;</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;&nbsp;Looks&nbsp;like&nbsp;only&nbsp;a&nbsp;double&nbsp;routine&nbsp;is&nbsp;available&nbsp;for&nbsp;eig.&nbsp;Eigh&nbsp;is&nbsp;better&nbsp;for</DIV>
<DIV>&gt;&nbsp;symmetric&nbsp;routines&nbsp;and&nbsp;if&nbsp;you&nbsp;only&nbsp;want&nbsp;the&nbsp;eigenvalues&nbsp;and&nbsp;not&nbsp;the</DIV>
<DIV>&gt;&nbsp;eigenvectors&nbsp;then&nbsp;you&nbsp;should&nbsp;use&nbsp;eigvals&nbsp;or&nbsp;eigvalsh&nbsp;and&nbsp;save&nbsp;the&nbsp;space</DIV>
<DIV>&gt;&nbsp;devoted&nbsp;to&nbsp;the&nbsp;eigenvectors,&nbsp;which&nbsp;in&nbsp;themselves&nbsp;will&nbsp;put&nbsp;you&nbsp;over&nbsp;the</DIV>
<DIV>&gt;&nbsp;memory&nbsp;limit.</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;&nbsp;The&nbsp;os&nbsp;question&nbsp;is&nbsp;whether&nbsp;or&nbsp;not&nbsp;you&nbsp;are&nbsp;running&nbsp;a&nbsp;64&nbsp;bit&nbsp;or&nbsp;32&nbsp;bit&nbsp;os.&nbsp;A</DIV>
<DIV>&gt;&nbsp;64&nbsp;bit&nbsp;os&nbsp;could&nbsp;use&nbsp;swap,&nbsp;although&nbsp;the&nbsp;routine&nbsp;would&nbsp;take&nbsp;forever&nbsp;to&nbsp;finish.</DIV>
<DIV>&gt;&nbsp;Really,&nbsp;you&nbsp;don't&nbsp;have&nbsp;enough&nbsp;memory&nbsp;for&nbsp;a&nbsp;problem&nbsp;that&nbsp;size.&nbsp;Perhaps&nbsp;if&nbsp;you</DIV>
<DIV>&gt;&nbsp;tell&nbsp;us&nbsp;what&nbsp;you&nbsp;want&nbsp;to&nbsp;achieve&nbsp;we&nbsp;can&nbsp;suggest&nbsp;a&nbsp;better&nbsp;approach.&nbsp;Also,&nbsp;if</DIV>
<DIV>&gt;&nbsp;your&nbsp;matrix&nbsp;is&nbsp;sparse&nbsp;other&nbsp;algorithms&nbsp;might&nbsp;be&nbsp;more&nbsp;appropriate.</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;&nbsp;Chuck</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;&nbsp;_______________________________________________</DIV>
<DIV>&gt;&nbsp;Numpy-discussion&nbsp;mailing&nbsp;list</DIV>
<DIV>&gt;&nbsp;Numpy-discussion@scipy.org</DIV>
<DIV>&gt;&nbsp;http://mail.scipy.org/mailman/listinfo/numpy-discussion</DIV>
<DIV>&gt;</DIV>
<DIV>&gt;</DIV>
<DIV>_______________________________________________</DIV>
<DIV>Numpy-discussion&nbsp;mailing&nbsp;list</DIV>
<DIV>Numpy-discussion@scipy.org</DIV>
<DIV>http://mail.scipy.org/mailman/listinfo/numpy-discussion</DIV></FONT></DIV></BODY></HTML>