2015-04-16 22 views
1

我下载了scilab源代码,我感兴趣的是conv2如何工作并希望将其转换为c#代码,但我不知道“C2F(ddot) “以及它是如何工作的。如果我将“C2F(ddot)”转换为c或c#代码,我应该如何实现它。这里是在SCILAB什么“C2F(ddot)”在scilab中的含义

extern double C2F(ddot)(int *n, double *A, int *iA, double *B, int *iB); 
/*--------------------------------------------------------------------------*/ 
void conv2_separable_R(double *R, int nR, double *C, int mC, double *A, int mA, int nA, double *Out, int mOut, int nOut, int edgM, int edgN, double *T) 
{ 
    int ai = 0, tj = 0, ci = 0, rj = 0; /*current index over A,T,C and R */ 
    int i = 0, j = 0; /* loop variables*/ 
    int l = 0; 
    int one = 1, minusone = -1; 

    for (i = 0; i < mOut; i++) 
    { 
     /*Compute the 1-D conv A(i,:) and C in T */ 
     ai = Max(0, i - edgM) ; 
     ci = mC - 1 - Max(0, edgM - i); 
     l = Min(ci + 1, mA - ai); 
     for (j = 0; j < nA; j++) 
     { 
      T[j] = C2F(ddot)(&l, A + ai + mA * j, &one, C + ci - l + 1, &minusone); 
     } 
     /*1-D convolution of T and R */ 
     for (j = 0; j < nOut; j++) 
     { 
      rj = nR - 1 - Max(0, edgN - j); 
      tj = Max(0, j - edgN) ; 
      l = Min(rj + 1, nA - tj); 
      Out[i + j * mOut] = C2F(ddot)(&l, T + tj, &one, R + rj - l + 1, &minusone); 
     } 
    } 
} 

一些一段源代码,如果我想变换分析的代码:” T [j]的= C2F(DDOT)(&升,A + AI +毫安*Ĵ,&一个,C + ci-1 + 1,& minusone);“进入C或C#,我应该怎么做?

回答

0

在SCILAB的来源,C2F是用于从C.

它宣布in machine.h调用Fortran函数的宏。

其实这段代码可能会打电话给the Blass ddot function

说它两个向量的点积Fortran语言做...

+0

感谢您的帮助 – 07012220

+0

可以给予好评/接受我对我的感谢响应:) – Orace