Are the values in each compressed column of a sparse matrix stored in order?

조회 수: 4 (최근 30일)
Oliver Woodford
Oliver Woodford 2015년 11월 20일
답변: Oliver Woodford 2015년 11월 20일
If I have a sparse column vector (e.g. a column of a sparse matrix), and I'm accessing the elements of that vector in a mex file, are the row indices guaranteed to be sorted in order, lowest row index first?

답변 (1개)

Oliver Woodford
Oliver Woodford 2015년 11월 20일
Since it is possible to write the column data in any order from a mex file, I would say no.
However, I tried three methods of sparse matrix generation:
  • sparse(ceil(rand(10000, 1)*1000), ceil(rand(10000, 1)*1000), 1, 1000, 1000)
  • sprand(1000, 1000, 0.01)
  • sparse(A)
and these all provided sorted columns.

카테고리

Help CenterFile Exchange에서 Sparse Matrices에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by