我们如何在Matlab中处理大型矩阵(大于10000x10000) [英] How can we handle large matrices in matlab(larger than 10000x10000)
本文介绍了我们如何在Matlab中处理大型矩阵(大于10000x10000)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的程序中,我遇到了一些大于10000x10000的矩阵. 我无法对它们进行转置或反转,该如何解决?
In my program I am faced with some matrices that are larger than 10000x10000. I cannot transpose or inverse them, how can this problem be overcome?
??? Error using ==> ctranspose
Out of memory. Type HELP MEMORY for your options.
Error in ==> programname1 at 70
B = cell2mat(C(:,:,s))';
Out of memory. Type HELP MEMORY for your options.
Example 1: Run the MEMORY command on a 32-bit Windows system:
>> memory
Maximum possible array: 677 MB (7.101e+008 bytes) *
Memory available for all arrays: 1602 MB (1.680e+009 bytes) **
Memory used by MATLAB: 327 MB (3.425e+008 bytes)
Physical Memory (RAM): 3327 MB (3.489e+009 bytes)
* Limited by contiguous virtual address space available.
** Limited by virtual address space available.
Example 2: Run the MEMORY command on a 64-bit Windows system:
>> memory
Maximum possible array: 4577 MB (4.800e+009 bytes) *
Memory available for all arrays: 4577 MB (4.800e+009 bytes) *
Memory used by MATLAB: 330 MB (3.458e+008 bytes)
Physical Memory (RAM): 3503 MB (3.674e+009 bytes)
================================================ ==============================
==============================================================================
memory
% Maximum possible array: 1603 MB (1.681e+009 bytes) *
% Memory available for all arrays: 2237 MB (2.346e+009 bytes) **
% Memory used by MATLAB: 469 MB (4.917e+008 bytes)
% Physical Memory (RAM): 3002 MB (3.148e+009 bytes)
I have used sparse for C.
B = cell2mat(C);
clear C %# to reduce the allocated RAM
P=B\b;
Name Size Bytes Class Attributes
B 5697x5697 584165092 double sparse, complex
C 1899x1899 858213576 cell
b 5697x1 91152 double complex
==============================================================================
??? Error using ==> mldivide
Out of memory. Type HELP MEMORY for your options.
Error in ==> programname at 82
P=B\b;
==============================================================================
27.05.11
Name Size Bytes Class Attributes
C 997x997 131209188 cell
B 2991x2991 71568648 single complex
Bdp 2991x2991 143137296 double complex
Bsparse 2991x2991 156948988 double sparse, complex
Bdp=double(B);
Bsparse=sparse(Bdp);
我使用单精度,女巫的精度与双精度相同
I used single precision, witch gave the same accuracy as in double precision
更好,我对吗?
推荐答案
一些建议:
- 如果可能的话,如@yoda所建议,请使用稀疏矩阵
- 您真的需要逆运算吗?如果要求解线性系统(
Ax=b
),则应使用MATLAB的反斜杠运算符. - 如果您确实需要庞大的密集矩阵,则可以使用 MATLAB分布式计算服务器.
- If possible, as @yoda suggested, use sparse matrices
- Do you really need the inverse? If you're solving a linear system (
Ax=b
), you should use MATLAB's backslash operator. - If you really need huge dense matrices, you can harness the memory of several machines using distributed arrays and MATLAB distributed computing server.
这篇关于我们如何在Matlab中处理大型矩阵(大于10000x10000)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文