Skip to content

Commit

Permalink
@sym/transpose: Make function Array-compatible.
Browse files Browse the repository at this point in the history
This is a prerequisite for making @sym/horzcat Array-compatible.

Partially fixes <#1215>.

* inst/@sym/transpose.m: Implement it.
  • Loading branch information
Alex Vong authored and cbm755 committed Nov 12, 2024
1 parent 5f171e7 commit 34c1f52
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion inst/@sym/transpose.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%% Copyright (C) 2014-2016, 2019 Colin B. Macdonald
%% Copyright (C) 2022 Alex Vong
%%
%% This file is part of OctSymPy.
%%
Expand Down Expand Up @@ -66,8 +67,11 @@
end

cmd = { 'x = _ins[0]'
'if x.is_Matrix:'
'if isinstance(x, MatrixBase):'
' return x.T'
'elif isinstance(x, NDimArray):'
' xx = x.tolist()'
' return make_matrix_or_array(list(zip(*xx)))'
'else:'
' return x' };

Expand All @@ -92,3 +96,8 @@
%!test
%! A = [1 2] + 1i;
%! assert(isequal( sym(A).' , sym(A.') ))

%!test
%! % see https://github.com/cbm755/octsympy/issues/1215
%! none = pycall_sympy__ ('return None');
%! assert (isequal (none.', none));

0 comments on commit 34c1f52

Please sign in to comment.