Non integer results when generating sparse matrix indicies

조회 수: 1 (최근 30일)
Mat
Mat 2020년 5월 15일
댓글: Mat 2020년 5월 25일
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