comparison src/data.cc @ 6156:a46f14cdbecd

[project @ 2006-11-13 19:20:23 by jwe]
author jwe
date Mon, 13 Nov 2006 19:20:23 +0000
parents e0065af38cf4
children d3c599afc455
comparison
equal deleted inserted replaced
6155:ab5008998876 6156:a46f14cdbecd
1079 print_usage (); 1079 print_usage ();
1080 1080
1081 return retval; 1081 return retval;
1082 } 1082 }
1083 1083
1084 DEFUN (size_equal, args, ,
1085 "-*- texinfo -*-\n\
1086 @deftypefn {Built-in Function} {} size_equal (@var{a}, @var{b})\n\
1087 Return true if the dimensions of @var{a} and @var{b} agree.\n\
1088 Trailing singleton dimensions are ignored.\n\
1089 @seealso{size, numel}\n\
1090 @end deftypefn")
1091 {
1092 octave_value retval;
1093
1094 if (args.length () == 2)
1095 {
1096 dim_vector a_dims = args(0).dims ();
1097 dim_vector b_dims = args(1).dims ();
1098
1099 a_dims.chop_trailing_singletons ();
1100 b_dims.chop_trailing_singletons ();
1101
1102 retval = a_dims == b_dims;
1103 }
1104 else
1105 print_usage ();
1106
1107 return retval;
1108 }
1109
1084 DEFUN (nnz, args, , 1110 DEFUN (nnz, args, ,
1085 "-*- texinfo -*-\n\ 1111 "-*- texinfo -*-\n\
1086 @deftypefn {Loadable Function} {@var{scalar} =} nnz (@var{a})\n\ 1112 @deftypefn {Built-in Function} {@var{scalar} =} nnz (@var{a})\n\
1087 returns number of non zero elements in @var{a}.\n\ 1113 Returns the number of non zero elements in @var{a}.\n\
1088 @seealso{sparse}\n\ 1114 @seealso{sparse}\n\
1089 @end deftypefn") 1115 @end deftypefn")
1090 { 1116 {
1091 octave_value retval; 1117 octave_value retval;
1092 1118
1098 return retval; 1124 return retval;
1099 } 1125 }
1100 1126
1101 DEFUN (nzmax, args, , 1127 DEFUN (nzmax, args, ,
1102 "-*- texinfo -*-\n\ 1128 "-*- texinfo -*-\n\
1103 @deftypefn {Loadable Function} {@var{scalar} =} nzmax (@var{SM})\n\ 1129 @deftypefn {Built-in Function} {@var{scalar} =} nzmax (@var{SM})\n\
1104 Return the amount of storage allocated to the sparse matrix @var{SM}.\n\ 1130 Return the amount of storage allocated to the sparse matrix @var{SM}.\n\
1105 Note that Octave tends to crop unused memory at the first oppurtunity\n\ 1131 Note that Octave tends to crop unused memory at the first oppurtunity\n\
1106 for sparse objects. There are some cases of user created sparse objects\n\ 1132 for sparse objects. There are some cases of user created sparse objects\n\
1107 where the value returned by @dfn{nzmaz} will not be the same as @dfn{nnz},\n\ 1133 where the value returned by @dfn{nzmaz} will not be the same as @dfn{nnz},\n\
1108 but in general they will give the same result.\n\ 1134 but in general they will give the same result.\n\