Non integer results when generating sparse matrix indicies
조회 수: 1 (최근 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!