Mercurial > hg > octave-terminal
changeset 12646:eaba9d671fb7 stable
Allow transpose to work for scalar structs (bug #33218)
* op-struct.cc (oct_op_scalar_transpose): New function.
(install_struct_ops): Install transpose and hermitian operators for
scalar structs.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 04 May 2011 21:44:05 -0400 |
parents | d3ccd2e37de6 |
children | e38fb1910563 |
files | src/OPERATORS/op-struct.cc |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/OPERATORS/op-struct.cc +++ b/src/OPERATORS/op-struct.cc @@ -34,7 +34,7 @@ // struct ops. -DEFUNOP (transpose, cell) +DEFUNOP (transpose, struct) { CAST_UNOP_ARG (const octave_struct&); @@ -47,6 +47,13 @@ return octave_value (v.map_value().transpose ()); } +DEFUNOP (scalar_transpose, scalar_struct) +{ + CAST_UNOP_ARG (const octave_scalar_struct&); + + return octave_value (v.scalar_map_value ()); +} + DEFNDCATOP_FN (struct_struct, struct, struct, map, map, concat) static octave_value @@ -85,6 +92,9 @@ INSTALL_UNOP (op_transpose, octave_struct, transpose); INSTALL_UNOP (op_hermitian, octave_struct, transpose); + INSTALL_UNOP (op_transpose, octave_scalar_struct, scalar_transpose); + INSTALL_UNOP (op_hermitian, octave_scalar_struct, scalar_transpose); + INSTALL_CATOP (octave_struct, octave_struct, struct_struct); INSTALL_CATOP (octave_struct, octave_matrix, struct_matrix); INSTALL_CATOP (octave_matrix, octave_struct, matrix_struct);