1 ## Copyright (C) 2011 David Bateman
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
17 ## @deftypefn {Loadable Function} {} reshape (@var{a}, @var{m}, @var{n})
18 ## Return a matrix with @var{m} rows and @var{n} columns whose elements are
19 ## taken from the Galois array @var{a}. To decide how to order the elements,
20 ## Octave pretends that the elements of a matrix are stored in column-major
21 ## order (like Fortran arrays are stored).
26 ## reshape (gf([1, 2, 3, 4],3), 2, 2)
28 ## GF(2^3) array. Primitive Polynomial = D^3+D+1 (decimal 11)
36 ## The @code{reshape} function is equivalent to
40 ## retval = gf(zeros (m, n), a.m, a.prim_poly);
46 ## but it is somewhat less cryptic to use @code{reshape} instead of the
47 ## colon operator. Note that the total number of elements in the original
48 ## matrix must match the total number of elements in the new matrix.
52 function varargout = reshape (varargin)
53 varargout = cell (1, max(1, nargout));
54 [varargout{:}] = greshape (varargin{:});