- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
32 位 Octave 对数组中元素的最大数量有限制。我已经从源代码重新编译(按照 https://github.com/calaba/octave-3.8.2-enable-64-ubuntu-14.04 处的脚本),现在有了 64 位索引。
然而,当我尝试使用广播函数执行逐元素乘法时,我得到了错误:内存不足或维度对于 Octave 的索引类型而言太大
这是错误还是未记录的功能?如果这是一个错误,有人有合理有效的解决方法吗?
重现问题的最少代码:
function indexerror();
% both of these are formed without error
% a = zeros (2^32, 1, 'int8');
% b = zeros (1024*1024*1024*3, 1, 'int8');
% sizemax % returns 9223372036854775806
nnz = 1000 % number of non-zero elements
rowmax = 250000
colmax = 100000
irow = zeros(1,nnz);
icol = zeros(1,nnz);
for ind =1:nnz
irow(ind) = round(rowmax/nnz*ind);
icol(ind) = round(colmax/nnz*ind);
end
sparseMat = sparse(irow,icol,1,rowmax,colmax);
% column vector to be broadcast
broad = 1:rowmax;
broad = broad(:);
% this gives "dimension too large" error
toobig = bsxfun(@times,sparseMat,broad);
% so does this
toobig2 = sparse(repmat(broad,1,size(sparseMat,2)));
mult = sparse( sparseMat .* toobig2 ); % never made it this far
end
编辑:好吧,我有一个效率低下的解决方法。它比使用 bsxfun
慢 3 倍左右(取决于详细信息),但比必须对库中的错误进行排序要好。希望有一天有人会发现这很有用。
% loop over rows, instead of using bsxfun
mult_loop = sparse([],[],[],rowmax,colmax);
for ind =1:length(broad);
mult_loop(ind,:) = broad(ind) * sparseMat(ind,:);
end
最佳答案
不幸的是,是的,这是一个错误。显然 @bsxfun
和 repmat
正在返回完整矩阵而不是稀疏矩阵。错误已在此处提交: http://savannah.gnu.org/bugs/index.php?47175
关于octave - "dimension too large"广播到 Octave 稀疏矩阵时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35421967/
假设我们在 Octave 中运行以下命令集: pkg load symbolic %loads the symbolic math package syms x y %declare x and y
Octave中vec的逆运算是什么? 例如。如果我需要将12x1向量转换成3x4矩阵,该怎么办? 最佳答案 我不知道Octave,但我认为您正在寻找 reshape 。 — Built-in Func
我试图在向量中找到一个字符串。 例如:query = "ab"in vector = ["ab", "cd", "abc", "cab"] 问题是:当我使用函数 strfind(vector,quer
对于练习,我必须以 Octave 为单位创建函数 x^i 从 i=1 到 i=10 的动画图。绘图必须有一个动态的标题,曲线的颜色必须改变。目前我的代码如下: function exercicequa
有没有一种方法可以让 Octave 矩阵将字符串和数字放在一起? 我想要一个休闲类型的矩阵: A=["A","B","C","D";1,2,3,4;2,3,4,5;3,4,5,6;4,5,6,7];
事实上,我已经为此奋斗了大约两个月。是什么让这些有所不同? hypotheses= X * theta temp=(hypotheses-y)' temp=X(:,1) * temp temp=tem
我想在我的绘图中添加带有注释的文本或图例框。 目前我的图例绘制在东北外,我想将新的图例(或文本框)添加到东南外的位置。 谢谢! 最佳答案 缺乏有关您的案例的更多信息: 据我所知,一个坐标区对象只能有一
我想在我的绘图中添加带有注释的文本或图例框。 目前我的图例绘制在东北外,我想将新的图例(或文本框)添加到东南外的位置。 谢谢! 最佳答案 缺乏有关您的案例的更多信息: 据我所知,一个坐标区对象只能有一
我想在 Octave 中执行整数除法(我使用的是最新版本 5.1.0)。我厌倦了 idivide(5, 2, "round") 应该产生 3。 Documentation表示将 idivide 与 r
我正在尝试从矩阵中按行获取最大索引。为此,我正在做: [throwaway, indexes] = max(blah, [], 2); 变量“throwaway”会存储我不再需要且永远不会使用的值,我
我在启动 Octave 后收到以下警告。我使用了来自 here 的安装说明. 可能是什么问题?这些是主要警告吗?我正在使用 Windows。 warning: gmsh does not seem t
我一直在学习机器学习类(class),目前学习分类。我实现了分类算法并获得了参数和成本。该作业已经具有绘制决策边界的功能并且可以正常工作,但我试图阅读他们的代码但无法理解这些行。 plot_x = [
我正在尝试更改 octave 中的polar 图中标记的外观。 r = rand(1,10); % the radius t = 30*rand(1,10); % the angles polar(t
我正在尝试从 Octave 中的文件读取矩阵,但我找不到解决方案。 输入文件是: 4 1 4 2 3 1 4 2 1 4 2 1 4 1 2 1 3 其中 4 是行数和列数。我希望能够将该信息存储在矩
我正在运行 Octave 3.4.0 并想创建一个透明的曲面图。但是,我在处理 facealpha 时无法这样做。 , edgealpha , alphadata和 alphadatamapping
安装一个包后,查找该包中有哪些功能的命令是什么? 例如,我有 control安装包。但是如何找到关于这个包的帮助,比如它包含哪些函数等等,就像使用 Matlab 一样? 是否必须去http://oct
我正在尝试在 Octave 音程终端中打印一长串数字。 disp(vec); 我得到的 7.0931e-01 6.2041e-05 9.7740e-01 9.9989e-01 8.8428e-01 9
我试图在OS X上安装Octave。执行brew install octave时,出现以下错误: octave: A LaTeX distribution is required to install
有人知道如何在 Octave 中增加图例字体大小吗? 最佳答案 这对我有用(kubuntu 9.04, Octave 3.2.2) print("plot.eps","-deps", "-F:30")
我试图弄清楚如何增加命令窗口文本。 我想出了legend: legend('{\fontsize{10} Low }', '{\fontsize{10} Medium }', '{\fontsize{
我是一名优秀的程序员,十分优秀!