📄 cvect.h
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -