MATLAB中的最大数组大小? [英] Maximum array size in MATLAB?

查看:2242
本文介绍了MATLAB中的最大数组大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个MATLAB程序,该程序将生成具有一百万行和一列未知数(最大为一百万)的矩阵.

I'm writing a MATLAB program that will generate a matrix with 1 million rows and an unknown amount of columns (at max 1 million).

我尝试预分配此矩阵:

a=zeros(1000000,1000000)

但是我收到错误:

超出了程序允许的最大变量大小."

"Maximum variable size allowed by the program is exceeded."

我觉得不预先分配此矩阵会严重降低代码速度.

I have a feeling that not pre-allocating this matrix will seriously slow the code down.

这让我感到好奇:MATLAB中最大的数组大小是多少?

This made me curious: What is the maximum array size in MATLAB?

更新:我将研究稀疏矩阵,因为在这个特定问题中,我要瞄准的结果将是一个由大部分零组成的矩阵.

Update: I'm going to look into sparse matrices, because the result I am aiming for in this particular problem will be a matrix consisting for the larger part of zeros.

推荐答案

看看此页面,它列出了最大大小:

Take a look at this page, it lists the maximum sizes: Max sizes

看起来大约是几亿美元.请注意,您要在此处创建的矩阵为:10e6 * 10e6 = 10e12元素.这比提供的最大大小大了多个数量级,并且您的系统上没有太多RAM.

It looks to be on the order of a few hundred million. Note that the matrix you're trying to create here is: 10e6 * 10e6 = 10e12 elements. This is many orders of magnitude greater than the max sizes provided and you also do not have that much RAM on your system.

我的建议是针对您要完成的工作寻找一种不同的算法.

My suggestion is to look into a different algorithm for what you are trying to accomplish.

这篇关于MATLAB中的最大数组大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆