# HG changeset patch # User John W. Eaton # Date 1304559845 14400 # Node ID eaba9d671fb7e9f5dba15fe371b246e901157036 # Parent d3ccd2e37de62b7239e65ec44b9bd3196c5c5a0b 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. diff -r d3ccd2e37de6 -r eaba9d671fb7 src/OPERATORS/op-struct.cc --- a/src/OPERATORS/op-struct.cc Wed May 04 13:59:34 2011 -0400 +++ b/src/OPERATORS/op-struct.cc Wed May 04 21:44:05 2011 -0400 @@ -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);