changeset 4714:4302ab3fefd7

[project @ 2004-01-22 20:50:18 by jwe]
author jwe
date Thu, 22 Jan 2004 20:50:18 +0000
parents d803e4187494
children 7bed0ef1a6ad
files liboctave/ChangeLog liboctave/mx-inlines.cc
diffstat 2 files changed, 5 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Thu Jan 22 20:31:55 2004 +0000
+++ b/liboctave/ChangeLog	Thu Jan 22 20:50:18 2004 +0000
@@ -1,5 +1,8 @@
 2004-01-22  Petter Risholm  <risholm@stud.ntnu.no>
 
+	* mx-inlines.cc	(MX_ND_REDUCTION, MX_ND_CUMULATIVE_OP):
+	Simplify calculation of number of elements in retval.
+
 	* Array.cc (Array<T>::assignN): Eliminate unnecessray code for
 	filling when RHS is scalar and dimension lengths agree.
 
--- a/liboctave/mx-inlines.cc	Thu Jan 22 20:31:55 2004 +0000
+++ b/liboctave/mx-inlines.cc	Thu Jan 22 20:50:18 2004 +0000
@@ -452,17 +452,8 @@
   if (dim > -1) \
     dv(dim) = 1; \
  \
-  /* We need to find the number of elements we need to */ \
-  /* fill in retval. First we need to get last idx of  */ \
-  /* the dimension vector                              */ \
- \
-  Array<int> temp_dv (dv.length (), 0); \
- \
-  for (int x = 0; x < dv.length (); x++) \
-    temp_dv(x) = dv(x) - 1; \
- \
   /* This finds the number of elements in retval */ \
-  int num_iter = compute_index (temp_dv, dv) + 1; \
+  int num_iter = (numel () / dim_length); \
  \
   /* Make sure retval has correct dimensions */ \
   retval.resize (dv, false); \
@@ -582,18 +573,8 @@
  \
   dv (dim) = 1; \
  \
-  /* We need to find the number of elements we need to */ \
-  /* fill in retval. First we need to get last idx of  */ \
-  /* the dimension vector                              */ \
- \
-  /* This could be done faster */ \
-  Array<int> temp_dv (dv.length (), 0); \
- \
-  for (int x = 0; x < dv.length (); x++) \
-    temp_dv(x) = dv(x) - 1; \
- \
   /* This finds the number of elements in retval */ \
-  int num_iter = compute_index (temp_dv, dv) + 1; \
+  int num_iter = (numel () / dim_length); \
  \
   Array<int> iter_idx (dv.length (), 0); \
  \