Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A=At+Transpose[At]-DiagonalMatrix[Flatten[MapIndexed[#1[[#2]]&,At]]];
- B=Bt+Transpose[Bt]-DiagonalMatrix[Flatten[MapIndexed[#1[[#2]]&,Bt]]];
- Clear[At,Bt];
- P=A.B;
- Ev=Eigenvalues[P];
- Clear[P];
- Ev=Eigenvalues[(At+Transpose[At]-DiagonalMatrix[Flatten[MapIndexed[#1[[#2]]&,At]]]).(Bt+Transpose[Bt]-DiagonalMatrix[Flatten[MapIndexed[#1[[#2]]&,Bt]]])];
- In[1]:= 30000^2*8
- Out[1]= 7,200,000,000
- In[2]:= MemoryInUse[]
- Out[2]= 69,949,408
- In[4]:= A = RandomReal[{0, 1}, {30000, 30000}];
- In[5]:= MemoryInUse[]
- Out[5]= 7,269,042,248
- In[6]:= B = RandomReal[{0, 1}, {30000, 30000}]; // AbsoluteTiming
- Out[6]= {6.63369, Null}
- In[7]:= Ad = A + Transpose[A] - DiagonalMatrix[Diagonal[A]]; // AbsoluteTiming
- Out[7]= {18.252, Null}
- In[8]:= MemoryInUse[]
- Out[8]= 21,669,092,880
- In[9]:= Bd = B + Transpose[B] - DiagonalMatrix[Flatten[MapIndexed[#1[[#2]] &, B]]]; // AbsoluteTiming
- Out[9]= {21.0884, Null}
- In[10]:= MemoryInUse[]
- Out[10]= 28,869,136,696
- In[11]:= Clear[Ad, Bd]
- In[12]:= MemoryInUse[]
- Out[12]= 14,469,140,224
- In[13]:= Bd = B + Transpose[B] - DiagonalMatrix[Flatten[MapIndexed[#1[[#2]] &, B]]]; // AbsoluteTiming
- Ad = A + Transpose[A] - DiagonalMatrix[Diagonal[A]]; // AbsoluteTiming
- Out[13]= {22.4654, Null}
- Out[14]= {18.5374, Null}
- In[15]:= MemoryInUse[]
- Out[15]= 28,869,161,856
- In[17]:= Clear[Ad, Bd]
- In[18]:= MemoryInUse[]
- Out[18]= 14,469,218,792
- In[21]:= Bdiag = Flatten[MapIndexed[#1[[#2]] &, B]]; // AbsoluteTiming
- Adiag = Diagonal[A]; // AbsoluteTiming
- Out[21]= {4.16035, Null}
- Out[22]= {0.0036089, Null}
- In[23]:= Clear[A, B, Adiag, Bdiag]; MemoryInUse[]
- Out[23]= 7269530192
- In[25]:= ByteCount /@ {A, B, Ad, Bd, Adiag, Bdiag}
- Out[25]= {0, 0, 0, 0, 0, 0}
- In[26]:= MaxMemoryUsed[]
- Out[26]= 43,269,149,384
- 30000^2*8
- MemoryInUse[]
- A = RandomReal[{0, 1}, {30000, 30000}]; // AbsoluteTiming
- ByteCount[A]
- MemoryInUse[]
- B = RandomReal[{0, 1}, {30000, 30000}]; // AbsoluteTiming
- MemoryInUse[]
- Ad = A + Transpose[A] - DiagonalMatrix[Diagonal[A]]; // AbsoluteTiming
- MemoryInUse[]
- Bd = B + Transpose[B] - DiagonalMatrix[Flatten[MapIndexed[#1[[#2]] &, B]]]; // AbsoluteTiming
- MemoryInUse[]
- Clear[Ad, Bd]
- MemoryInUse[]
- Bd = B + Transpose[B] - DiagonalMatrix[Flatten[MapIndexed[#1[[#2]] &, B]]]; // AbsoluteTiming
- Ad = A + Transpose[A] - DiagonalMatrix[Diagonal[A]]; // AbsoluteTiming
- MemoryInUse[]
- Clear[Ad, Bd]
- MemoryInUse[]
- Bdiag = Flatten[MapIndexed[#1[[#2]] &, B]]; // AbsoluteTiming
- Adiag = Diagonal[A]; // AbsoluteTiming
- Clear[A, B, Adiag, Bdiag];
- MemoryInUse[]
- ByteCount /@ {A, B, Ad, Bd, Adiag, Bdiag}
- MaxMemoryUsed[]
Add Comment
Please, Sign In to add comment