📄 sparsematrixongpu2.h
字号:
// SparseMatrixOnGPU2.h: interface for the SparseMatrixOnGPU2 class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_SPARSEMATRIXONGPU2_H__8DE5B509_126A_4B21_90F4_E5484A06AE2B__INCLUDED_)
#define AFX_SPARSEMATRIXONGPU2_H__8DE5B509_126A_4B21_90F4_E5484A06AE2B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "extgl.h"
/////////////////////////////////////////////////////////////////////////////////
//// Paper : from Brook system 2003
//// -Standford University
//// -Writen by Youquan Liu 2003/12
//// http://lcs.ios.ac.cn/~lyq/
//// Sparse Matrix represent on GPU
//// Sparse Matrix Operation
/////////////////////////////////////////////////////////////////////////////////
class CBrookMatrix
{
private:
int _iDim, _iMaxPassNum;
int _iDataWidth, _iDataHeight; //Texture size of Element, IPos
int _iIndexWidth, _iIndexHeight; //Texture size of Start, Len
GLenum _iTextureTarget;
unsigned int _iDataTexID; // record the non zero elements
unsigned int _iPosTexID; // record the accordingly position(Column J)of each non zero element
unsigned int _iStartTexID; // record the first non zero element's position(Column J) of each row
unsigned int _iLenTexID; // record the length of each row which sum non zero
public:
bool _bInitialized;
bool _bFloat;
int _iChannelsNum;
public:
CBrookMatrix();
virtual ~CBrookMatrix();
void SetData(float *M, int DimSize);
// Returns the Matrix's size
int GetDim() const {return _iDim;}
// Returns the Max Number of these rows
inline int GetPassNum() const {return _iMaxPassNum;}
// Returns the Matrix's Data Texture Size
inline int GetDataWidth() const {return _iDataWidth;}
inline int GetDataHeight() const {return _iDataHeight; }
// Returns the Matrix's Packed Index Texture Size
inline int GetIndexWidth() const {return _iIndexWidth;}
inline int GetIndexHeight() const {return _iIndexHeight; }
// Returns the texture ID for matrix operation
unsigned int GetDataTextureID() const { return _iDataTexID; }
unsigned int GetPosTextureID() const { return _iPosTexID; }
unsigned int GetStartTextureID() const { return _iStartTexID; }
unsigned int GetLenTextureID() const { return _iLenTexID; }
//////////////////////////////////////////////////////////////////////////
//// Arrange data into ONE texture
void SetMultiData(float *M, int DimSize);
};
#endif // !defined(AFX_SPARSEMATRIXONGPU2_H__8DE5B509_126A_4B21_90F4_E5484A06AE2B__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -