diff src/OPERATORS/op-struct.cc @ 5571:9fc532d861d4

[project @ 2005-12-12 20:45:16 by jwe]
author jwe
date Mon, 12 Dec 2005 20:45:17 +0000
parents 4c8a2e4e0717
children 93c65f2a5668
line wrap: on
line diff
--- a/src/OPERATORS/op-struct.cc	Thu Dec 08 21:01:50 2005 +0000
+++ b/src/OPERATORS/op-struct.cc	Mon Dec 12 20:45:17 2005 +0000
@@ -34,11 +34,27 @@
 
 // struct ops.
 
+DEFUNOP (transpose, cell)
+{
+  CAST_UNOP_ARG (const octave_struct&);
+
+  if (v.ndims () > 2)
+    {
+      error ("transpose not defined for N-d objects");
+      return octave_value ();
+    }
+  else
+    return octave_value (v.map_value().transpose ());
+}
+
 DEFNDCATOP_FN (struct_struct, struct, struct, map, map, concat)
 
 void
 install_struct_ops (void)
 {
+  INSTALL_UNOP (op_transpose, octave_struct, transpose);
+  INSTALL_UNOP (op_hermitian, octave_struct, transpose);
+
   INSTALL_CATOP (octave_struct, octave_struct, struct_struct);
 }