⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bolzmatvectorrect.fp

📁 PDE simulator on GPU.
💻 FP
字号:
!!FP1.0
#Date:2003/12/31
#try to compute sparse Matrix - Vector Multiplication Just For TEXRECT
# Vector X  ----TEX0 
# Diagonal Element   ----TEX1 -- AiiTexID  // record the diagonal elements
# NonZero NonDiagonal----TEX2 -- AijTexID; // record the nondiagonal & nonzero elements
# For reference in X ----TEX3 -- CTexID;   // record the according position for Vector X which multiply with Aij
# First NonZero Postion--TEX4 -- RTexID;   // record the first non zero & non diagonal element position J
# Previous  ====TEX5 //////record the previous result

#TexPARA.X = PassID;
#TexPARA.Y = NonDiagonal Texture Width;
#TexPARA.Z = 1.0/TexPARA.Y;
#TexPARA.W = 0;
DECLARE TexPARA = {0,0,0,0};

# fetch R[i] from TEX4
TEX R0, f[WPOS], TEX4, RECT;

#Note: RTexID.x = Index Position in 1D
#      RTexID.y = len[i]
#if pass - len >= 0, then kill the current fragment, just return result = prev

#SUBC R1.x, TexPARA.x, R0.y;
#KIL GE.x;

#for the reason of two pbuffers, the above changed to the following
SLT R4.x, TexPARA.x, R0.y;

# R0 ---- offset = start + pass
ADD R0, R0.xxxx, TexPARA.xxxx;

# Then to fetch Aj[j+c] from AijTexID(TEX2)
# But firstly we have to convert the 1D tex coord into 2D 
MUL R1.y, R0.x, TexPARA.z;
FLR R1.y, R1.y;
MUL R1.x, R1.y, TexPARA.y;
SUB R1.x, R0.x, R1.x;
FLR R1.x, R1.x;

# Now, we can fetch Aj[j+c]
TEX R2, R1, TEX2, RECT;

# Now, we can fetch C[j+c] from Tex3--C Texture
TEX R3, R1, TEX3, RECT;

# Then fetch according data from Vector X which in TEX0
# use C[j+c] to fetch X[C[j+c]]
TEX R3, R3, TEX0, RECT;

# fetch previous result
TEX R0, f[WPOS], TEX5, RECT;

# Aj[j+c]*X[C[j+c]] + PreviousResult
#MAD o[COLR], R2, R3, R0;

MUL R2, R2, R3;
MUL R2, R2, R4.xxxx;
ADD o[COLR], R2, R0;

END

⌨️ 快捷键说明

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