SVD·Ö½âCʵÏÖ
int svd(int m,int n,int withu,int withv,double eps,double tol,
double *a, double *q, double *u, double *v, double *vt)
{
int i,j,k,l,l1,iter,retval;
double c,f,g,h,s,x,y,z;
double *e;
e = (double *)calloc(n,sizeof(double));
retval = 0;
/* Copy 'a' to 'u' */
for (i=0;i<m;i++) {
for (j=0;j<n;j++)
u[i*n + j] = a[i*n + j];
}
/* Householder's reduction to bidiagonal form. */
g = x = 0.0;
for (i=0;i<n;i++) {
e[i] = g;
s = 0.0;
l = i+1;
for (j=i;j<m;j++)
s += (u[j*n+i]*u[j*n+i]);
if (s < tol)
g = 0.0;
else {
f = u[i*n+i];
g = (f < 0) ? sqrt(s) : -sqrt(s);
h = f * g - s;
u[i*n+i] = f - g;
for (j=l;j<n;j++) {
s = 0.0;
for (k=i;k<m;k++)
s += (u[k*n+i] * u[k*n+j]);
f = s / h;
for (k=i;k<m;k++)
u[k*n+j] += (f * u[k*n+i]);
}
/* end j */
}
/* end s */
q[i] = g;
s = 0.0;
for (j=l;j<n;j++)
s += (u[i*n+j] * u[i*n+j]);
if (s < tol)
g = 0.0;
else {
f = u[i*n+i+1];
g = (f < 0) ? sqrt(s) : -sqrt(s);
h = f * g - s;
u[i*n+i+1] = f - g;
for (j=l;j<n;j++)
e[j] = u[i*n+j]/h;
for (j=l;j<m;j++) {
s = 0.0;
Ïà¹ØÎĵµ£º
ÈçºÎÖÕÖ¹Ï̵߳ÄÔËÐУ¨C/C++£©
ÏëÒªÖÕÖ¹Ï̵߳ÄÔËÐУ¬¿ÉÒÔʹÓÃÒÔÏ·½·¨£º
1¡¢Ï̺߳¯Êý·µ»Ø£¨×îºÃʹÓø÷½·¨£©¡£
2¡¢Í¨¹ýµ÷ÓÃExitThreadº¯Êý£¬Ï߳̽«×ÔÐг·Ïû£¨×îºÃ²»Ê¹Óø÷½·¨£©¡£
3¡¢Í¬Ò»¸ö½ø³Ì»òÁíÒ»¸ö½ø³ÌÖеÄÏ̵߳÷ÓÃTerminateThreadº¯Êý£¨Ó¦±ÜÃâʹÓø÷½·¨£©¡£
4¡¢ExitProcessºÍTerminateProcessº¯ÊýÒ²¿ÉÒÔÓÃÀ ......
ÔÚÉÏһƪÖÐÎÒÃÇÒѾʹÓÃcÓïÑÔʵÏÖÁËÒ»¸ö×î¼òµ¥µÄÀ©Õ¹Ä£¿é£¬ÕâһƪÖн«ÔÚÆä»ù´¡ÉϽøÐй¦Äܵķḻ¡£Ê×ÏÈÀ´¿¼ÂÇÈçºÎ´ÓÍⲿµÄPythonÏòCÄ£¿é´«µÝ½ø²ÎÊý£¬foo_bar2չʾÁËÈçºÎÏòCÄ£¿é´«µÝÕûÊý£¬¸¡µãÊý£¬×Ö·û´®Èý¸ö²ÎÊý£¬ÆäÖÐ"ids"Ö¸Ã÷ÁË´«Èë²ÎÊýµÄÊý¾ÝÀàÐÍ¡£PyArg_ParseTuple¸ºÔð¶Ôargs½øÐнâÎö£¬Èô½âÎöʧ°ÜÔò·µ»Ø0.´úÂë#include&n ......
¹þ¹þ£¡ÓÐÐÒÔÚijÍøÕ¾·¢ÏÖÕâƪÎÄÕ£¬¶Á°Õ£¬¾õµÃÂùÓеÀÀí£¬·¢À´´ó¼ÒÒ»Æð¹²ÃãÖ®
×ÜÊDZ»Í¬Ñ§ÃÇÎʵ½£¬ÈçºÎѧϰCºÍC++²Å²»Ã£È»£¬²Å²»ÊÇÂÒѧ£¬ÏëÁËһϣ¬ÕâÀï¸ø³öÒ»¸ö×ܵĻظ´¡£
' J$ |0 ?! p% w" t5 D6 D: c9 |0 B
¡¡¡¡Ò»¼ÒÖ®ÑÔ£¬»¶ÓÅÄש¹þ¡£
¡¡¡¡1¡¢¿ÉÒÔ¿¼ÂÇÏÈѧϰC.
/ U$ X+ X/ P; Y ......
Ö¸Õë,ÖÚËùÖÜÖª,ʱΪһÄÚ´æµØÖ·.Å׿ªOS¼¶±ð»ò¸üµÍµÄÓ²¼þ¼¶±ð²»Ëµ,½ö¶ÔÓ¦ÓÃÄÚµÄʹÓýøÐÐССµÄÒܲâÌÖÂÛ.
Ê×ÏÈ,ÔÚÓ¦ÓÃÄÚ,ÓÃmallocÉêÇëµ½µÄÒ»¿éµØÖ·Ó¦¸ÃÊÇÁ¬ÐøµÄ(²Â²â,Âß¼ÉÏÁ¬Ðø,ʵ¼ÊÉÏÎïÀíÈçºÎ·Ö²¼²»Óè¹Ø×¢).
Æä´Î,Êý¾Ý´æÔÚÔÚÄÚ´æÖж¼ÊÇÒÔ2½øÖÆÐÎʽ´æ·Å.²»´æÔÚÊý¾ÝÀàÐÍ,Òò´Ë,¶ÔÄÚ´æÊý¾ÝµÄ²Ù×÷,Ö»Òª×ñѽø³öÀàÐÍÒ»Ö¼´¿É.
´ ......
ÉÏһƪÀïµÄLAMEÏîÄ¿ÒѾչʾÁËpythonÈçºÎÓëCÓïÑÔ½»»¥£¬µ«³ÌÐòÈÔ²»¹»ÀíÏ룬ÔÚpythonÕâÒ»¶Ë½ö½öÊÇ´«µÝÔ´ÎļþºÍÄ¿±êÎļþµÄ·¾¶£¬ÔÙµ÷ÓÃCÄ£¿éµÄencode·½·¨À´½øÐбàÂ룬µ«ÎÊÌâÔÚÓÚÄãÎÞ·¨¿ØÖÆencodeº¯Êý£¬±ÈÈçÄãÏë±àÂëµÄÔ´ÎļþÈç¹û²»ÊÇÔʼÊý¾Ý£¬¶øÊÇwavÎļþ»òÕßÆäËû¸ñʽÄØ£¿¶ÔÓÚÕâ¸öÎÊÌ⣬ÓÐÁ½ÖÖ·½·¨¿ÉÒÔÑ¡Ôñ£¬Ò»ÖÖÄ£·ÂÇ°ÃæµÄCÄ£ ......