genalg.h

来自「这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数」· C头文件 代码 · 共 68 行

H
68
字号
/* ////////////////////////////////////////////////////////////////////////////                  INTEL CORPORATION PROPRIETARY INFORMATION//     This software is supplied under the terms of a license agreement or//     nondisclosure agreement with Intel Corporation and may not be copied//     or disclosed except in accordance with the terms of that agreement.//          Copyright(c) 2004-2005 Intel Corporation. All Rights Reserved.//////*/#ifndef __GENALG_H__#define __GENALG_H__// SrcVector and DstVector should support operator[unsigned int] consttemplate<class SrcVector, class DstVector>void Copy(const SrcVector &src, const DstVector &dst, unsigned int size){    for(unsigned int i = 0; i < size; i++) dst[i] = src[i];}template<class T>void Swap(T &a, T &b) { T tmp = a; a = b; b = tmp; }template<class Vector>inline void Reverse(const Vector &srcDst, unsigned int size){    for(unsigned int i = 0u; i < size / 2u; i++)        Swap(srcDst[size - i - 1], srcDst[i]);}template<class T> const T& Max(const T& x, const T& y) { return (x > y) ? x : y; }template<class T> const T& Min(const T& x, const T& y) { return (x < y) ? x : y; }template<class Element, class Vector>Element Max(const Element &lowBound, const Vector &src, unsigned int size){    Element max = lowBound;    for(unsigned int i = 0; i < size; i++)        max = Max<Element>(src[i], max);    return max;}template<class Element, class Vector>Element Min(const Element &highBound, const Vector &src, unsigned int size){    Element min = highBound;    for(unsigned int i = 0; i < size; i++)        min = Min<Element>(src[i], min);    return min;}template<class Element, class Vector>void SetValue(const Element &value, const Vector &dst, unsigned int size){    for(unsigned int i = 0; i < size; i++) dst[i] = value;}#endif // __GENALG_H__

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?