Is there a method to linear index to a transpose matrix without taking the transpose?

10 vues (au cours des 30 derniers jours)
Is there a method to linear index to a transpose matrix without taking the transpose?
  5 commentaires
Image Analyst
Image Analyst le 19 Juin 2019
What code is that? Where did you attach it? Who wrote it?
And what is wrong with using the transpose operator '? Why do you need a different way?
Douglas Farinelli
Douglas Farinelli le 19 Juin 2019
The matrix is rather large ... did not desire a copy of it.

Connectez-vous pour commenter.

Réponse acceptée

Douglas Farinelli
Douglas Farinelli le 18 Juin 2019
Yes want to index the matrix by rows vs columns. I suppose i can use the function ind2sub and switch the row and col.
  2 commentaires
Douglas Farinelli
Douglas Farinelli le 18 Juin 2019
The matrix is not square so the ind2sub would not work.
Walter Roberson
Walter Roberson le 18 Juin 2019
Yes.
Note: for a 2D matrix, ind2sub is (column_number - 1) * number_of_rows + row_number .
You can therefore optimize the access (row_number, column_number) to the transpose (column_number, row_number) as
(row_number - 1) * number_of_rows + column_number

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by