X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fcommunications-1.1.1%2F%40galois%2Freshape.m;fp=octave_packages%2Fcommunications-1.1.1%2F%40galois%2Freshape.m;h=4af21451e7d637f6cc18ba7f5b92a48bc6b860b9;hp=0000000000000000000000000000000000000000;hb=f5f7a74bd8a4900f0b797da6783be80e11a68d86;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/communications-1.1.1/@galois/reshape.m b/octave_packages/communications-1.1.1/@galois/reshape.m new file mode 100644 index 0000000..4af2145 --- /dev/null +++ b/octave_packages/communications-1.1.1/@galois/reshape.m @@ -0,0 +1,56 @@ +## Copyright (C) 2011 David Bateman +## +## This program is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free Software +## Foundation; either version 3 of the License, or (at your option) any later +## version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public License along with +## this program; if not, see . + +## -*- texinfo -*- +## @deftypefn {Loadable Function} {} reshape (@var{a}, @var{m}, @var{n}) +## Return a matrix with @var{m} rows and @var{n} columns whose elements are +## taken from the Galois array @var{a}. To decide how to order the elements, +## Octave pretends that the elements of a matrix are stored in column-major +## order (like Fortran arrays are stored). +## +## For example, +## +## @example +## reshape (gf([1, 2, 3, 4],3), 2, 2) +## ans = +## GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11) +## +## Array elements = +## +## 1 3 +## 2 4 +## @end example +## +## The @code{reshape} function is equivalent to +## +## @example +## @group +## retval = gf(zeros (m, n), a.m, a.prim_poly); +## retval (:) = a; +## @end group +## @end example +## +## @noindent +## but it is somewhat less cryptic to use @code{reshape} instead of the +## colon operator. Note that the total number of elements in the original +## matrix must match the total number of elements in the new matrix. +## @end deftypefn +## @seealso{`:'} + +function varargout = reshape (varargin) + varargout = cell (1, max(1, nargout)); + [varargout{:}] = greshape (varargin{:}); +endfunction +