Non integer results when generating sparse matrix indicies

2 次查看(过去 30 天)
Hello,
I am using a large integer data series to generate subscript indices for a sparse matrix using:
clear all
close all
data = randi(100,[2,10000000]); % Example data
[Nb,Nt] = size(data);
indx = 3*(data(:)'-1) + (1:3)';
Findx = reshape(indx,3*Nb,Nt); % An intermediate index used elsewhere
% sparse matrix indicies
Hindx1 = repmat(permute(Findx,[1 3 2]),1,3*Nb,1);
Hindx2 = permute(Hindx1,[2 1 3]);
% Are the integer?
find(Findx~=round(Findx))
find(Hindx1~=round(Hindx1))
find(Hindx2~=round(Hindx2))
The Findx is normally clear but the Hindx don't conform, usually there are only one or two values that are non-integer.
Is this a bug or is it a problem with my machine:
MATLAB Version: 9.7.0.1247435 (R2019b) Update 2
MATLAB License Number: 345666
Operating System: Linux 5.3.0-51-generic #44~18.04.2-Ubuntu SMP Thu Apr 23 14:27:18 UTC 2020 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Thanks,
Mat
  4 个评论
Rashed Mohammed
Rashed Mohammed 2020-5-22
Hi Mat
I tried to reproduce the issue with your code on both 2019b Update 2 & Update 5 but I didn’t encounter the issue you mentioned. Try running the code on another machine or do a clean install of MATLAB to see if the issue occurs again.
Mat
Mat 2020-5-25
Hello Rashed,
I think it may have been related to some sort of memory llimit, my machine has 16gb RAM and If I increased the size of the arrays much larger it would crash matlab entirely. I have moved to 2020 now and all seems fine. Also being able to use unsigned integers as indicies for sparse is a nice feature. Thanks for responding, I may try a fresh install of 2019b if I have the time.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by