Non integer results when generating sparse matrix indicies
1 view (last 30 days)
Show older comments
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 Comments
Rashed Mohammed
on 22 May 2020
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.
Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!