summaryrefslogtreecommitdiff
path: root/macros/bitrevorder.sci
blob: a4b6da8dfa95fa476e27c2631628a7999e575648 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function [y,i]=bitrevorder(x)

// Returns input data in bit-reversed order 
// Calling Sequence
//	[y,i]=bitrevorder(x)
// Parameters
//	x: Vector of real or complex values
// Description
//	This is an Octave function. 
//	This function returns the input data after reversing the bits of the indices and reordering the elements of the input array.
// Examples
// 1.	[y]=bitrevorder ([i,1,3,6i])
//	y =   [0 + 1i   3 + 0i   1 + 0i   0 + 6i]
// 2.	[y,i]=bitrevorder (['a','b','c','d'])
//	y = acbd
//	i =   [1   3   2   4]

funcprot(0);
[lhs,rhs]=argn(0);
if (rhs<1) then
	error ("Wrong number of input arguments.")
end
[y,i]=callOctave("bitrevorder",x)

endfunction