Octave &引用;“尺寸太大”;广播到八度稀疏矩阵时出错

Octave &引用;“尺寸太大”;广播到八度稀疏矩阵时出错,octave,Octave,32位倍频程对数组中元素的最大数量有限制。我已经从源代码处重新编译(按照中的脚本),现在有了64位索引 然而,当我尝试使用广播函数执行元素乘法时,我得到了错误:内存不足或对于Octave的索引类型来说维数太大 这是一个bug,还是一个未记录的特性?如果它是一个bug,是否有人有一个合理有效的解决方法 再现问题的最少代码: function indexerror(); % both of these are formed without error % a = zeros (2^32, 1,

32位倍频程对数组中元素的最大数量有限制。我已经从源代码处重新编译(按照中的脚本),现在有了64位索引

然而,当我尝试使用广播函数执行元素乘法时,我得到了
错误:内存不足或对于Octave的索引类型来说维数太大

这是一个bug,还是一个未记录的特性?如果它是一个bug,是否有人有一个合理有效的解决方法

再现问题的最少代码:

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

不幸的是,答案是肯定的,这是一个bug。显然,
@bsxfun
repmat
返回的是完整矩阵,而不是稀疏矩阵。错误已在此处存档:

您是否尝试过使用新的:
toobig=sparseMat.*rep?刚刚尝试过,但也出现了一个错误:
产品:不一致的参数(op1是250000x1000000,op2是250000x1)
应该可以工作。这似乎与