From c0c0582462720ed597b00e116506570577614e89 Mon Sep 17 00:00:00 2001 From: shamikam Date: Tue, 7 Nov 2017 15:59:48 +0530 Subject: initial commit --- macros/bitrevorder.sci | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 macros/bitrevorder.sci (limited to 'macros/bitrevorder.sci') diff --git a/macros/bitrevorder.sci b/macros/bitrevorder.sci new file mode 100644 index 0000000..a4b6da8 --- /dev/null +++ b/macros/bitrevorder.sci @@ -0,0 +1,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 -- cgit