diff src/expm.cc @ 519:b9284136189a

[project @ 1994-07-19 14:40:20 by jwe]
author jwe
date Tue, 19 Jul 1994 14:42:19 +0000
parents 309fc59f66ee
children 20fbad23ae51
line wrap: on
line diff
--- a/src/expm.cc	Tue Jul 19 14:31:14 1994 +0000
+++ b/src/expm.cc	Tue Jul 19 14:42:19 1994 +0000
@@ -1,4 +1,4 @@
-// tc-expm.cc                                           -*- C++ -*-
+// f-expm.cc                                           -*- C++ -*-
 /*
 
 Copyright (C) 1993, 1994 John W. Eaton
@@ -40,17 +40,7 @@
 #include "user-prefs.h"
 #include "gripes.h"
 #include "error.h"
-#include "f-expm.h"
-
-#ifdef WITH_DLD
-Octave_object
-builtin_matrix_exp_2 (const Octave_object& args, int nargout)
-{
-  Octave_object retval (1);
-  retval(0) = matrix_exp (args(1));
-  return retval;
-}
-#endif
+#include "defun-dld.h"
 
 extern "C"
 {
@@ -61,11 +51,20 @@
 			   const Complex*, const int*, double*);
 }
 
-tree_constant
-matrix_exp (const tree_constant& a)
+DEFUN_DLD ("expm", Fexpm, Sexpm, 2, 1,
+  "expm (X): matrix exponential, e^A")
 {
-  tree_constant retval;
-  tree_constant tmp = a.make_numeric ();
+  Octave_object retval;
+
+  int nargin = args.length ();
+
+  if (nargin != 2)
+    {
+      print_usage ("expm");
+      return retval;
+    }
+
+  tree_constant tmp = args(1).make_numeric ();
 
 // Constants for matrix exponential calculation.
 
@@ -88,8 +87,8 @@
 	{
 	  if (flag < 0)
 	    gripe_empty_arg ("expm", 0);
-	  Matrix m;
-	  retval = m;
+
+	  retval.resize (1, Matrix ());
 	}
       else gripe_empty_arg ("expm", 1);
     }