cvect.h

来自「face recognition test source code」· C头文件 代码 · 共 51 行

H
51
字号
#ifndef CVECT_H
#define CVECT_H

#include "CMemory.h"
#include "CMat.h"

class CVect
	{
	protected:
		long li;	         						/*Number of rows of the vector*/
		CMemory *pMem;								/*Ptr to a CMemory obj containing the*/
													/*values : a(1,1) a(1,2) ... a(1,col) ... a(li,col)*/
		valtype *pData;								/*Pointer to the matrix's value if pMem is locked*/
		BOOL bLocked;								/*tells if pMem is locked */
	public:
		CVect();
		CVect(long c);
		~CVect();
		int Save(char *);							/*Save the vector in a text file*/
		int Load(char *);							/*Load the vector from a text file*/
		void Initialize();							/*Sets all the elements to 0*/
		long GetLi();
		void Lock();								/*Lock pMem and validate pData*/
		void Unlock();								/*Unlock pMem and Unvalidate pData*/
		void PowCmp(float exp);						/*Pow each individual composant of the vector*/
		
		void Allocate();							/*Allocate (or reallocate) the memory*/
													/*needed by pData; Call the CMemory's Allocate fct*/
		void Invert();								/* Invert the order of the columns, but keep the matrix diagonal*/
		void SwapCol(long l1, long l2);				/*Swap two elements*/
		void Discard(long l);						/*Discard one element*/	
		valtype GetAt(long l)
		 	{
#ifdef CHECK_BOUNDARY
		 	if (l <= 0 || l > li)
		 	 	Fail(NULL);
#endif
			return pData[l-1L];
		 	};
		void SetAt(long l, valtype value)
		 	{
#ifdef CHECK_BOUNDARY
		 	if (l <= 0 || l > li)
		 		Fail(NULL);
#endif		 
			pData[l-1L] = value;
		 	}; 
	};
	
#endif /* CVECT_H */

⌨️ 快捷键说明

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