matrix reshape

126 views
Skip to first unread message

Dave Mazzoni

unread,
May 17, 2016, 10:01:13 AM5/17/16
to gonum-dev
Hello All - Do any of the gonum matrix packages support Matlab's "reshape" function? This is the header that describes the function:
% @deftypefn {Function File} {} reshape (@var{a}, @var{m}, @var{n})
% Return a matrix with @var{m} rows and @var{n} columns whose elements are
% taken from the matrix @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
% @group
% reshape ([1, 2, 3, 4], 2, 2)
%      @result{}  1  3
%          2  4
% @end group
% @end example
%
% If the variable @code{do_fortran_indexing} is nonzero, the
% @code{reshape} function is equivalent to
%
% @example
% @group
% retval = zeros (m, n);
% retval (:) = a;
% @end group
% @end example

Brendan Tracey

unread,
May 17, 2016, 10:04:24 AM5/17/16
to Dave Mazzoni, gonum-dev
I don’t think so at the moment. Please open an issue. 

The signature would likely be

(*Dense).Reshape(a mat64.Matrix, r, c int)

and would assume that the data is row-major (like mat64 arrays are stored). 

--
You received this message because you are subscribed to the Google Groups "gonum-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gonum-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages