[Scipy-svn] r3116 - trunk/Lib/cluster/src

scipy-svn@scip... scipy-svn@scip...
Fri Jun 22 04:10:00 CDT 2007


Author: cdavid
Date: 2007-06-22 04:09:20 -0500 (Fri, 22 Jun 2007)
New Revision: 3116

Modified:
   trunk/Lib/cluster/src/vq.c
   trunk/Lib/cluster/src/vq.h
   trunk/Lib/cluster/src/vq.tpl
Log:
Convert index to npy_intp to avoid problems betweem 32 and 64 bits.

Modified: trunk/Lib/cluster/src/vq.c
===================================================================
--- trunk/Lib/cluster/src/vq.c	2007-06-22 08:55:20 UTC (rev 3115)
+++ trunk/Lib/cluster/src/vq.c	2007-06-22 09:09:20 UTC (rev 3116)
@@ -8,6 +8,7 @@
 #include <stddef.h>
 #include <math.h>
 
+#include "vq.h"
 /*
  * results is put into code, which contains initially the initial code
  *
@@ -16,9 +17,10 @@
 const static double rbig = 1e100;
 
 
+#if 0
 static int float_vq_1d(const float *in, int n, 
     const float *init, int ncode, 
-    long long *code, float *mdist)
+    npy_intp *code, float *mdist)
 {
     int i, j;
     float m, d;
@@ -38,10 +40,11 @@
     }
     return 0;
 }
+#endif
 
 static int float_vq_obs(const float *obs,
     float *code_book, int Ncodes, int Nfeatures,
-       long long* code, float *lowest_dist)
+       npy_intp* code, float *lowest_dist)
 {
 	int i,j,k=0;
 	float dist, diff;
@@ -68,7 +71,7 @@
     float* obs,
     float* code_book, 
     int Nobs, int Ncodes, int Nfeatures,
-    long long* codes, float* lowest_dist)
+    npy_intp* codes, float* lowest_dist)
 {
     int i;
 	for( i = 0; i < Nobs; i++) {		
@@ -80,9 +83,10 @@
     return 0;
 }
 
+#if 0
 static int double_vq_1d(const double *in, int n, 
     const double *init, int ncode, 
-    long long *code, double *mdist)
+    npy_intp *code, double *mdist)
 {
     int i, j;
     double m, d;
@@ -102,10 +106,11 @@
     }
     return 0;
 }
+#endif
 
 static int double_vq_obs(const double *obs,
     double *code_book, int Ncodes, int Nfeatures,
-       long long* code, double *lowest_dist)
+       npy_intp* code, double *lowest_dist)
 {
 	int i,j,k=0;
 	double dist, diff;
@@ -132,7 +137,7 @@
     double* obs,
     double* code_book, 
     int Nobs, int Ncodes, int Nfeatures,
-    long long* codes, double* lowest_dist)
+    npy_intp* codes, double* lowest_dist)
 {
     int i;
 	for( i = 0; i < Nobs; i++) {		

Modified: trunk/Lib/cluster/src/vq.h
===================================================================
--- trunk/Lib/cluster/src/vq.h	2007-06-22 08:55:20 UTC (rev 3115)
+++ trunk/Lib/cluster/src/vq.h	2007-06-22 09:09:20 UTC (rev 3116)
@@ -1,10 +1,14 @@
 #ifndef _VQ_H_
 #define _VQ_H
 
+#include <Python.h>
+
+#include <numpy/arrayobject.h>
+
 int double_tvq(double* obs, double* code_book, int Nobs, int Ncodes, 
-        int Nfeatures, long long* codes, double* lowest_dist);
+        int Nfeatures, npy_intp* codes, double* lowest_dist);
 
 int float_tvq(float* obs, float* code_book, int Nobs, int Ncodes, 
-        int Nfeatures, long long* codes, float* lowest_dist);
+        int Nfeatures, npy_intp* codes, float* lowest_dist);
 
 #endif

Modified: trunk/Lib/cluster/src/vq.tpl
===================================================================
--- trunk/Lib/cluster/src/vq.tpl	2007-06-22 08:55:20 UTC (rev 3115)
+++ trunk/Lib/cluster/src/vq.tpl	2007-06-22 09:09:20 UTC (rev 3116)
@@ -9,6 +9,7 @@
 #include <stddef.h>
 #include <math.h>
 
+#include "vq.h"
 /*
  * results is put into code, which contains initially the initial code
  *
@@ -17,9 +18,10 @@
 const static double rbig = 1e100;
 
 [+ FOR data_type +]
+#if 0
 static int [+ (get "type_name") +]_vq_1d(const [+ (get "type_name") +] *in, int n, 
     const [+ (get "type_name") +] *init, int ncode, 
-    long long *code, [+ (get "type_name") +] *mdist)
+    npy_intp *code, [+ (get "type_name") +] *mdist)
 {
     int i, j;
     [+ (get "data_type") +] m, d;
@@ -39,10 +41,11 @@
     }
     return 0;
 }
+#endif
 
 static int [+ (get "type_name") +]_vq_obs(const [+ (get "data_type") +] *obs,
     [+ (get "data_type") +] *code_book, int Ncodes, int Nfeatures,
-       long long* code, [+ (get "data_type") +] *lowest_dist)
+       npy_intp* code, [+ (get "data_type") +] *lowest_dist)
 {
 	int i,j,k=0;
 	[+ (get "data_type") +] dist, diff;
@@ -69,7 +72,7 @@
     [+ (get "data_type") +]* obs,
     [+ (get "data_type") +]* code_book, 
     int Nobs, int Ncodes, int Nfeatures,
-    long long* codes, [+ (get "data_type") +]* lowest_dist)
+    npy_intp* codes, [+ (get "data_type") +]* lowest_dist)
 {
     int i;
 	for( i = 0; i < Nobs; i++) {		



More information about the Scipy-svn mailing list