Working with a set of matrices
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lorcan O'Connor
am 3 Apr. 2021
Kommentiert: Lorcan O'Connor
am 3 Apr. 2021
I want to generate a finite matrix group by starting with the S ={identity} and multiplying by some generators until S no longer grows in size.
Is there an efficient way to deal with a "set" like this, without manualling checking for duplicates? For example, it seems awkward if you use cell arrays to store the elements of S.
2 Kommentare
Matt J
am 3 Apr. 2021
For example, it seems awkward if you use cell arrays to store the elements of S.
Why?
Akzeptierte Antwort
Matt J
am 3 Apr. 2021
Bearbeitet: Matt J
am 3 Apr. 2021
I'm not sure I will fully understand the task without seeing an example. However, if S is organized as an MxNxP array,
[M,N]=deal(3,3);
S=cat(3,eye(M,N), randi(5,M,N), eye(M,N) )
then you can get rid of duplicate slices with
s=reshape(S,[],size(S,3));
S=reshape( unique(s.','rows').', M,N,[])
If S contains non-integer matrices, you will probably need to use uniquetol() instead of unique().
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!