diff libinterp/corefcn/svd.cc @ 22204:469c817eb256

svd: reduce code duplication with more use of template and macro. * liboctave/numeric/svd.cc, liboctave/numeric/svd.h: remove unused constructor with reference for int (info). This allows to move all of the constructor into a single template, so remove init(). Two new methods, gesvd and gesdd, are fully specialized but the main hunck of code are the long list of arguments. Scope type and drive enums to the svd class for clarity, and rename member names. Add a new member for the drive used. * libinterp/corefcn/svd.cc: fix typenames for the svd enums which are now scoped. * CMatrix.cc, dMatrix.cc, fCMatrix.cc, fMatrix.cc: fix typenames for the svd enums which are now scoped.
author Carnë Draug <carandraug@octave.org>
date Thu, 04 Aug 2016 20:20:27 +0100
parents 112b20240c87
children 6ca3acf5fad8
line wrap: on
line diff
--- a/libinterp/corefcn/svd.cc	Wed Aug 03 10:23:41 2016 -0700
+++ b/libinterp/corefcn/svd.cc	Thu Aug 04 20:20:27 2016 +0100
@@ -37,19 +37,19 @@
 static std::string Vsvd_driver = "gesvd";
 
 template <typename T>
-static typename svd<T>::type
+static typename svd<T>::Type
 svd_type (int nargin, int nargout)
 {
   return ((nargout == 0 || nargout == 1)
-          ? svd<T>::sigma_only
-          : (nargin == 2) ? svd<T>::economy : svd<T>::std);
+          ? svd<T>::Type::sigma_only
+          : (nargin == 2) ? svd<T>::Type::economy : svd<T>::Type::std);
 }
 
 template <typename T>
-static typename svd<T>::driver
+static typename svd<T>::Driver
 svd_driver (void)
 {
-  return Vsvd_driver == "gesvd" ? svd<T>::GESVD : svd<T>::GESDD;
+  return Vsvd_driver == "gesvd" ? svd<T>::Driver::GESVD : svd<T>::Driver::GESDD;
 }
 
 DEFUN (svd, args, nargout,