How to generate a set of N mutually orthogonal (N being a power of 2) N-dimensional binary vectors [+1,-1]?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Shlomo Geva
am 31 Jan. 2018
Kommentiert: Matt J
am 30 Apr. 2023
For instance:
with N=2 we could have [1 1; 1 -1]
with N=4, we could have [1 1 1 1; 1 1 -1 -1; 1 -1 1 -1; 1 -1 -1 1]
How to efficiently generate N mutually orthogonal binary vectors for larger N (8,16,32,64,...,4096,...)?
0 Kommentare
Akzeptierte Antwort
Matt J
am 8 Mär. 2021
Bearbeitet: Matt J
am 8 Mär. 2021
N=4096;
[C,C0]=deal([1 1;1 -1]);
tic;
for i=1:log2(N/2)
C=kron(C0,C);
end
toc
isOrthogonal=isequal(C*C.', N*speye(N))
C
3 Kommentare
Matt J
am 30 Apr. 2023
This line was used above to verify mutual orthogonality:
isOrthogonal=isequal(C*C.', N*speye(N))
Weitere Antworten (2)
Steven Lord
am 8 Mär. 2021
See the hadamard function.
1 Kommentar
Matt J
am 8 Mär. 2021
For some reason, I find this a fair bit slower than the kron-based solution
N=4096;
tic;
[C,C0]=deal([1 1;1 -1]);
for i=1:log2(N/2)
C=kron(C0,C);
end
toc
tic; hadamard(N); toc
Siehe auch
Kategorien
Mehr zu Logical 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!