Guest User

Untitled

a guest
Jul 16th, 2018
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. A=At+Transpose[At]-DiagonalMatrix[Flatten[MapIndexed[#1[[#2]]&,At]]];
  2. B=Bt+Transpose[Bt]-DiagonalMatrix[Flatten[MapIndexed[#1[[#2]]&,Bt]]];
  3. Clear[At,Bt];
  4.  
  5. P=A.B;
  6. Ev=Eigenvalues[P];
  7. Clear[P];
  8.  
  9. Ev=Eigenvalues[(At+Transpose[At]-DiagonalMatrix[Flatten[MapIndexed[#1[[#2]]&,At]]]).(Bt+Transpose[Bt]-DiagonalMatrix[Flatten[MapIndexed[#1[[#2]]&,Bt]]])];
  10.  
  11. In[1]:= 30000^2*8
  12.  
  13. Out[1]= 7,200,000,000
  14.  
  15. In[2]:= MemoryInUse[]
  16.  
  17. Out[2]= 69,949,408
  18.  
  19. In[4]:= A = RandomReal[{0, 1}, {30000, 30000}];
  20.  
  21. In[5]:= MemoryInUse[]
  22.  
  23. Out[5]= 7,269,042,248
  24.  
  25. In[6]:= B = RandomReal[{0, 1}, {30000, 30000}]; // AbsoluteTiming
  26.  
  27. Out[6]= {6.63369, Null}
  28.  
  29. In[7]:= Ad = A + Transpose[A] - DiagonalMatrix[Diagonal[A]]; // AbsoluteTiming
  30.  
  31. Out[7]= {18.252, Null}
  32.  
  33. In[8]:= MemoryInUse[]
  34.  
  35. Out[8]= 21,669,092,880
  36.  
  37. In[9]:= Bd = B + Transpose[B] - DiagonalMatrix[Flatten[MapIndexed[#1[[#2]] &, B]]]; // AbsoluteTiming
  38.  
  39. Out[9]= {21.0884, Null}
  40.  
  41. In[10]:= MemoryInUse[]
  42.  
  43. Out[10]= 28,869,136,696
  44.  
  45. In[11]:= Clear[Ad, Bd]
  46.  
  47. In[12]:= MemoryInUse[]
  48.  
  49. Out[12]= 14,469,140,224
  50.  
  51. In[13]:= Bd = B + Transpose[B] - DiagonalMatrix[Flatten[MapIndexed[#1[[#2]] &, B]]]; // AbsoluteTiming
  52. Ad = A + Transpose[A] - DiagonalMatrix[Diagonal[A]]; // AbsoluteTiming
  53.  
  54. Out[13]= {22.4654, Null}
  55.  
  56. Out[14]= {18.5374, Null}
  57.  
  58. In[15]:= MemoryInUse[]
  59.  
  60. Out[15]= 28,869,161,856
  61.  
  62. In[17]:= Clear[Ad, Bd]
  63.  
  64. In[18]:= MemoryInUse[]
  65.  
  66. Out[18]= 14,469,218,792
  67.  
  68. In[21]:= Bdiag = Flatten[MapIndexed[#1[[#2]] &, B]]; // AbsoluteTiming
  69. Adiag = Diagonal[A]; // AbsoluteTiming
  70.  
  71. Out[21]= {4.16035, Null}
  72.  
  73. Out[22]= {0.0036089, Null}
  74.  
  75. In[23]:= Clear[A, B, Adiag, Bdiag]; MemoryInUse[]
  76.  
  77. Out[23]= 7269530192
  78.  
  79. In[25]:= ByteCount /@ {A, B, Ad, Bd, Adiag, Bdiag}
  80.  
  81. Out[25]= {0, 0, 0, 0, 0, 0}
  82.  
  83. In[26]:= MaxMemoryUsed[]
  84.  
  85. Out[26]= 43,269,149,384
  86.  
  87. 30000^2*8
  88. MemoryInUse[]
  89. A = RandomReal[{0, 1}, {30000, 30000}]; // AbsoluteTiming
  90. ByteCount[A]
  91. MemoryInUse[]
  92. B = RandomReal[{0, 1}, {30000, 30000}]; // AbsoluteTiming
  93. MemoryInUse[]
  94. Ad = A + Transpose[A] - DiagonalMatrix[Diagonal[A]]; // AbsoluteTiming
  95. MemoryInUse[]
  96. Bd = B + Transpose[B] - DiagonalMatrix[Flatten[MapIndexed[#1[[#2]] &, B]]]; // AbsoluteTiming
  97. MemoryInUse[]
  98. Clear[Ad, Bd]
  99. MemoryInUse[]
  100. Bd = B + Transpose[B] - DiagonalMatrix[Flatten[MapIndexed[#1[[#2]] &, B]]]; // AbsoluteTiming
  101. Ad = A + Transpose[A] - DiagonalMatrix[Diagonal[A]]; // AbsoluteTiming
  102. MemoryInUse[]
  103. Clear[Ad, Bd]
  104. MemoryInUse[]
  105. Bdiag = Flatten[MapIndexed[#1[[#2]] &, B]]; // AbsoluteTiming
  106. Adiag = Diagonal[A]; // AbsoluteTiming
  107. Clear[A, B, Adiag, Bdiag];
  108. MemoryInUse[]
  109. ByteCount /@ {A, B, Ad, Bd, Adiag, Bdiag}
  110. MaxMemoryUsed[]
Add Comment
Please, Sign In to add comment