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
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.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!