当前位置: 首页>>代码示例>>C++>>正文


C++ CArray::size方法代码示例

本文整理汇总了C++中CArray::size方法的典型用法代码示例。如果您正苦于以下问题:C++ CArray::size方法的具体用法?C++ CArray::size怎么用?C++ CArray::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CArray的用法示例。


在下文中一共展示了CArray::size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fft

void fft(CArray& x)
{
	const size_t N = x.size();
	if (N <= 1) return;

	CArray even = x[std::slice(0, N / 2, 2)];
	CArray odd = x[std::slice(1, N / 2, 2)];

	fft(even);
	fft(odd);

	for (size_t k = 0; k < N / 2; ++k)
	{
		Complex t = std::polar(1.0, -2 * PI * k / N) * odd[k];
		x[k] = even[k] + t;
		x[k + N / 2] = even[k] - t;
	}
}
开发者ID:agilul,项目名称:audio-visualization,代码行数:18,代码来源:FTT.cpp

示例2: findJavaInEnvPath

// Search java.exe in the environment
int findJavaInEnvPath(CPath *outJavaPath) {
    SetLastError(0);

    int currVersion = 0;

    const char* envPath = getenv("JAVA_HOME");
    if (envPath != NULL) {
        CPath p(envPath);
        currVersion = checkBinPath(&p);
        if (currVersion > 0) {
            if (gIsDebug) {
                fprintf(stderr, "Java %d found via JAVA_HOME: %s\n", currVersion, p.cstr());
            }
            *outJavaPath = p;
        }
        if (currVersion >= MIN_JAVA_VERSION) {
            // As an optimization for runtime, if we find a suitable java
            // version in JAVA_HOME we won't waste time looking at the PATH.
            return currVersion;
        }
    }

    envPath = getenv("PATH");
    if (!envPath) return currVersion;

    // Otherwise look at the entries in the current path.
    // If we find more than one, keep the one with the highest version.

    CArray<CString> *paths = CString(envPath).split(';');
    for(int i = 0; i < paths->size(); i++) {
        CPath p((*paths)[i].cstr());
        int v = checkPath(&p);
        if (v > currVersion) {
            if (gIsDebug) {
                fprintf(stderr, "Java %d found via env PATH: %s\n", v, p.cstr());
            }
            currVersion = v;
            *outJavaPath = p;
        }
    }

    delete paths;
    return currVersion;
}
开发者ID:acropolis98,项目名称:Project-M,代码行数:45,代码来源:find_java_lib.cpp

示例3: fft

void FftLib::fft(CArray &signal) {
  const size_t signal_size = signal.size();
  if (signal_size <= 1) return;

  // divide: Splitting in even and odd part of the signal
  CArray even = signal[std::slice(0, signal_size / 2, 2)];
  CArray odd = signal[std::slice(1, signal_size / 2, 2)];

  // conquer: Recursive call with the previously splitted signal.
  fft(even);
  fft(odd);

  // combine
  for (size_t k = 0; k < signal_size / 2; ++k) {
    ComplexDouble t = std::polar(1.0, -2 * kPI * k / signal_size) * odd[k];
    signal[k] = even[k] + t;
    signal[k + signal_size / 2] = even[k] - t;
  }
}
开发者ID:Dasug,项目名称:TaylorTrack,代码行数:19,代码来源:fft_lib.cpp

示例4: fft

// Cooley–Tukey FFT (in-place)
inline void fft(CArray& x)
{
    const size_t N = x.size();
    if (N <= 1) return;

    // divide
    CArray even = x[std::slice(0, N/2, 2)];
    CArray  odd = x[std::slice(1, N/2, 2)];

    // conquer
    fft(even);
    fft(odd);

    // combine
    for (size_t k = 0; k < N/2; ++k)
    {
        Complex t = std::polar(1.0f, -2 * float(M_PI) * k / N) * odd[k];
        x[k    ] = even[k] + t;
        x[k+N/2] = even[k] - t;
    }
}
开发者ID:xloem,项目名称:pothos,代码行数:22,代码来源:MyFFTUtils.hpp

示例5: while

int
Management_Connection::X_PropertyScan (Array < PropertyInfo > &p)
{
  p.resize (0);
  PropertyInfo p1;
  uchar obj, i;
  obj = 0;
  do
    {
      i = 0;
      do
	{
	  p1.obj = obj;
	  p1.property = 0;
	  if (A_Property_Desc
	      (obj, p1.property, i, p1.type, p1.count, p1.access) == -1)
	    return -1;
	  if (p1.property == 1 && p1.type == 4)
	    {
	      CArray a;
	      if (A_Property_Read (obj, 1, 1, 1, a) == -1)
		return -1;
	      if (a.size() != 2)
		return -1;
	      p1.count = (a[0] << 8) | (a[1]);
	    }
	  if (p1.property != 0)
	    p.push_back (p1);
	  i++;
	}
      while (p1.property != 0);
      obj++;
    }
  while (i != 1);
  return 0;
}
开发者ID:ascillato,项目名称:knxd,代码行数:36,代码来源:management.cpp

示例6: ifft

void ifft(CArray& x){
    x = x.apply(std::conj);
    fft(x);
    x= x.apply(std::conj);
    x /= x.size();
}
开发者ID:rotkreis,项目名称:NAnalysis_Homework_3,代码行数:6,代码来源:prob4.cpp

示例7: ParseCommandLineFile

st_bool CCommandLineParser::ParseCommandLineFile(const char* pFilename, const char* pExeName, SUserSettings& sConfig)
{
    st_bool bSuccess = false;

    FILE* pFile = fopen(pFilename, "r");
    if (pFile)
    {
        // parse the cmd-line options in the file and store in an array of arguments
        CArray<CFixedString> aArguments;
        CFixedString strTemp;
        st_bool bInQuotes = false;

        while (!feof(pFile))
        {
            st_char chTemp = (st_char)fgetc(pFile);

            st_bool bSaveString = false;
            if (chTemp == '#')
            {
                // skip rest of comment line
                while (!feof(pFile) && (chTemp != '\r' && chTemp != '\n'))
                    chTemp = (st_char)fgetc(pFile);
                bSaveString = true;
            }
            else if (chTemp == '\"')
            {
                // quote delimited string
                if (bInQuotes)
                    bSaveString = true;
                bInQuotes = !bInQuotes;
            }
            else if (!bInQuotes && (chTemp == ' ' || chTemp == '\r' || chTemp == '\n'))
            {
                // other whitespace
                bSaveString = true;             
            }
            else
            {
                strTemp += chTemp;
            }

            if (bSaveString && !strTemp.empty( ))
            {
                // save this string as an argument
                aArguments.push_back(strTemp);
                strTemp.resize(0);
            }
        }

        fclose(pFile);

        // convert the array to a standard argv-type data structure
        const st_int32 c_nNumArgs = st_int32(aArguments.size( ) + 1);
        char** argv = new char*[c_nNumArgs];
        for (st_int32 i = 1; i < c_nNumArgs; ++i)
            argv[i] = (char*) aArguments[i - 1].c_str( );
        argv[0] = (char*) pExeName; // normally contains the exe name

        // feed back into the parse routine 
        bSuccess = Parse(c_nNumArgs, argv, sConfig);

        delete [] argv;
    }

    return bSuccess;
}
开发者ID:DanielNeander,项目名称:my-3d-engine,代码行数:66,代码来源:UserConfig.cpp


注:本文中的CArray::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。