changeset 5455:ec44bd0917fe

[project @ 2005-09-19 16:07:56 by jwe]
author jwe
date Mon, 19 Sep 2005 16:07:56 +0000
parents a921c9c17ba5
children f315234695b1
files liboctave/ChangeLog liboctave/Makefile.in src/ChangeLog src/DLD-FUNCTIONS/__glpk__.cc src/Makefile.in src/syscalls.cc src/sysdep.cc
diffstat 7 files changed, 84 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Mon Sep 19 15:44:55 2005 +0000
+++ b/liboctave/ChangeLog	Mon Sep 19 16:07:56 2005 +0000
@@ -3,6 +3,8 @@
 	* oct-env.cc (octave_env::do_get_home_directory):
 	Also check HOMEDRIVE under mingw.
 
+	* Makefile.in (LINK_DEPS): Include UFsparse libraries.
+
 2005-09-16  John W. Eaton  <jwe@octave.org>
 
 	* oct-syscalls.cc: Include lo-utils.h here.
--- a/liboctave/Makefile.in	Mon Sep 19 15:44:55 2005 +0000
+++ b/liboctave/Makefile.in	Mon Sep 19 16:07:56 2005 +0000
@@ -20,8 +20,8 @@
 
 LINK_DEPS = \
   -L../libcruft -L. $(RLD_FLAG) \
-  $(LIBCRUFT) $(UMFPACK_LIBS) $(BLAS_LIBS) $(FFTW_LIBS) $(LIBREADLINE) \
-  $(LIBGLOB) $(LIBS) $(FLIBS)
+  $(LIBCRUFT) $(UMFPACK_LIBS)  $(AMD_LIBS) $(BLAS_LIBS) $(FFTW_LIBS) \
+  $(LIBREADLINE) $(LIBGLOB) $(LIBS) $(FLIBS)
 
 MATRIX_INC := Array.h Array2.h Array3.h ArrayN.h DiagArray2.h \
 	Array-flags.h Array-util.h ArrayN-idx.h MArray-defs.h \
--- a/src/ChangeLog	Mon Sep 19 15:44:55 2005 +0000
+++ b/src/ChangeLog	Mon Sep 19 16:07:56 2005 +0000
@@ -1,3 +1,13 @@
+2005-09-19  David Bateman  <dbateman@free.fr>
+
+	* Makefile.in (OCT_LINK_DEPS): Include UFsparse libraries.
+
+	* DLD_FUNCTIONS/__glpk__.cc (F__glpk__): Replace isinf with
+	xisinf. Allow sparse matrices as second argument.
+
+	* syscalls.cc: Typos.
+	* sysdep.cc: Typos.
+
 2005-09-16  John W. Eaton  <jwe@octave.org>
 
 	* syscalls.cc (Fwaitpid): Doc fix.  Expect WNOHANG, WUNTRACED,
--- a/src/DLD-FUNCTIONS/__glpk__.cc	Mon Sep 19 15:44:55 2005 +0000
+++ b/src/DLD-FUNCTIONS/__glpk__.cc	Mon Sep 19 16:07:56 2005 +0000
@@ -442,69 +442,76 @@
     }
 
   double *c = C.fortran_vec ();
+  Array<int> rn;
+  Array<int> cn;
+  ColumnVector a;
+  int mrowsA;
+  volatile int nz = 0;
 
   //-- 2nd Input. A matrix containing the constraints coefficients.
   // If matrix A is NOT a sparse matrix
-  // if(!mxIsSparse(A_IN)){
-  Matrix A (args(1).matrix_value ()); // get the matrix
+  if( args(1).class_name () != "sparse")
+    {
+      Matrix A (args(1).matrix_value ()); // get the matrix
 
-  if (error_state)
-    {
-      error ("__glpk__: invalid value of A");
-      return retval;
-    }
+      if (error_state)
+	{
+	  error ("__glpk__: invalid value of A");
+	  return retval;
+	}
 
-  int mrowsA = A.rows ();
-  Array<int> rn (mrowsA*mrowsc+1);
-  Array<int> cn (mrowsA*mrowsc+1);
-  ColumnVector a (mrowsA*mrowsc+1, 0.0);
+      mrowsA = A.rows ();
+      rn.resize (mrowsA*mrowsc+1);
+      cn.resize (mrowsA*mrowsc+1);
+      a.resize (mrowsA*mrowsc+1, 0.0);
 
-  volatile int nz = 0;
-  for (int i = 0; i < mrowsA; i++)
-    {
-      for (int j = 0; j < mrowsc; j++)
+      for (int i = 0; i < mrowsA; i++)
 	{
-	  if (A(i,j) != 0)
+	  for (int j = 0; j < mrowsc; j++)
 	    {
-	      nz++;
-	      rn(nz) = i + 1;
-	      cn(nz) = j + 1;
-	      a(nz) = A(i,j);
+	      if (A(i,j) != 0)
+		{
+		  nz++;
+		  rn(nz) = i + 1;
+		  cn(nz) = j + 1;
+		  a(nz) = A(i,j);
+		}
 	    }
 	}
+
     }
+  else
+    {
+      SparseMatrix A (args(1).matrix_value ()); // get the sparse matrix
+
+      if (error_state)
+	{
+	  error ("__glpk__: invalid value of A");
+	  return retval;
+	}
 
-// DON'T DELETE THIS PART... REPRESENTS THE SPARSE MATRICES MANIPULATION
-//	  }else{
-//	    int i,j;
-//	    int *jc,*ir;
-//	    double *pr;
-//	    int nelc,count,row;
-//
-//	    /* NOTE: nnz is the actual number of nonzeros and is stored as the
-//       last element of the jc array where the size of the jc array is the
-//       number of columns + 1 */
-//	    nz = *(mxGetJc(A_IN) + mrowsc);
-//	    jc = mxGetJc(A_IN);
-//	    ir = mxGetIr(A_IN);
-//	    pr = mxGetPr(A_IN);
-//
-//       rn=(int *)calloc(nz+1,sizeof(int));
-//	    cn=(int *)calloc(nz+1,sizeof(int));
-//	    a=(double *)calloc(nz+1,sizeof(double));
-//
-//       count=0; row=0;
-//	    for(i=1;i<=mrowsc;i++){
-//	      nelc=jc[i]-jc[i-1];
-//	      for(j=0;j<nelc;j++){
-//		      count++;
-//		      rn[count]=ir[row]+1;
-//		      cn[count]=i;
-//		      a[count]=pr[row];
-//		      row++;
-//	      }
-//	    }
-//	  }
+      mrowsA = A.rows ();
+      octave_idx_type Anc = A.cols ();
+      octave_idx_type Anz = A.nnz ();
+      rn.resize (Anz+1);
+      cn.resize (Anz+1);
+      a.resize (Anz+1, 0.0);
+
+      if (Anc != mrowsc)
+	{
+	  error ("__glpk__: invalid value of A");
+	  return retval;
+	}
+
+      for (octave_idx_type j = 0; j < Anc; j++)
+	for (octave_idx_type i = A.cidx(j); i < A.cidx(j+1); i++)
+	  {
+	    nz++;
+	    rn(nz) = A.ridx(i) + 1;
+	    cn(nz) = j + 1;
+	    a(nz) = A(i,j);
+	  }
+    }
 
   //-- 3rd Input. A column array containing the right-hand side value
   //	           for each constraint in the constraint matrix.
@@ -534,7 +541,7 @@
   Array<int> freeLB (mrowsc);
   for (int i = 0; i < mrowsc; i++)
      {
-       if (isinf (lb[i]))
+       if (xisinf (lb[i]))
 	 {
 	   freeLB(i) = 1;
 	   lb[i] = -octave_Inf;
@@ -558,7 +565,7 @@
   Array<int> freeUB (mrowsc);
   for (int i = 0; i < mrowsc; i++)
     {
-      if (isinf (ub[i]))
+      if (xisinf (ub[i]))
 	{
 	  freeUB(i) = 1;
 	  ub[i] = octave_Inf;
--- a/src/Makefile.in	Mon Sep 19 15:44:55 2005 +0000
+++ b/src/Makefile.in	Mon Sep 19 16:07:56 2005 +0000
@@ -247,8 +247,8 @@
 
 OCT_LINK_DEPS = \
   -L../libcruft $(LIBCRUFT) -L../liboctave $(LIBOCTAVE) \
-  -L. $(LIBOCTINTERP) $(UMFPACK_LIBS) $(AMD_LIBS) $(COLAMD_LIBS) \
-   $(CHOLMOD_LIBS) $(CCOLAMD_LIBS) $(BLAS_LIBS) $(FFTW_LIBS) $(LIBS) $(FLIBS)
+  -L. $(LIBOCTINTERP) $(CHOLMOD_LIBS) $(UMFPACK_LIBS) $(AMD_LIBS) \
+   $(COLAMD_LIBS) $(CCOLAMD_LIBS) $(BLAS_LIBS) $(FFTW_LIBS) $(LIBS) $(FLIBS)
 
 DISTFILES = Makefile.in ChangeLog mkdefs mkops mkgendoc \
 	DOCSTRINGS mkbuiltins mk-oct-links \
--- a/src/syscalls.cc	Mon Sep 19 15:44:55 2005 +0000
+++ b/src/syscalls.cc	Mon Sep 19 16:07:56 2005 +0000
@@ -1018,7 +1018,7 @@
 	error ("WIFSIGNALED: expecting integer argument");
     }
 #else
-  warning ("WIFSIGNALED always returns false in this version of Octave")
+  warning ("WIFSIGNALED always returns false in this version of Octave");
 #endif
 
   return retval;
@@ -1046,7 +1046,7 @@
 	error ("WTERMSIG: expecting integer argument");
     }
 #else
-  warning ("WTERMSIG always returns false in this version of Octave")
+  warning ("WTERMSIG always returns false in this version of Octave");
 #endif
 
   return retval;
@@ -1076,7 +1076,7 @@
 	error ("WCOREDUMP: expecting integer argument");
     }
 #else
-  warning ("WCOREDUMP always returns false in this version of Octave")
+  warning ("WCOREDUMP always returns false in this version of Octave");
 #endif
 
   return retval;
@@ -1105,7 +1105,7 @@
 	error ("WIFSTOPPED: expecting integer argument");
     }
 #else
-  warning ("WIFSTOPPED always returns false in this version of Octave")
+  warning ("WIFSTOPPED always returns false in this version of Octave");
 #endif
 
   return retval;
@@ -1133,7 +1133,7 @@
 	error ("WSTOPSIG: expecting integer argument");
     }
 #else
-  warning ("WSTOPSIG always returns false in this version of Octave")
+  warning ("WSTOPSIG always returns false in this version of Octave");
 #endif
 
   return retval;
@@ -1160,7 +1160,7 @@
 	error ("WIFCONTINUED: expecting integer argument");
     }
 #else
-  warning ("WIFCONTINUED always returns false in this version of Octave")
+  warning ("WIFCONTINUED always returns false in this version of Octave");
 #endif
 
   return retval;
--- a/src/sysdep.cc	Mon Sep 19 15:44:55 2005 +0000
+++ b/src/sysdep.cc	Mon Sep 19 16:07:56 2005 +0000
@@ -121,9 +121,9 @@
 void
 MINGW_signal_cleanup (void)
 {
-  w32_set_quiet_shutdown (void);
+  w32_set_quiet_shutdown ();
 
-  w32_raise_final ():
+  w32_raise_final ();
 }
 #endif