My memory is 4GB(2.99GB usable, but I don't know why).
When use Bluebit Library to deal with Matrix in project C# Visual Studio 2010, and when execute code in Windows Form Application and after connect with Database, appear NotEnoughMemoryException (There is not enough memory to continue the execution) and physically memory used is 2.14GB , but when use code alone in Console Application doesn't appear any exception.
StreamWriter aWr = new StreamWriter("aMatrix.mtx");
Matrix aMatrix = new Matrix(termsList.Count, Docs.Count);
/////load aMatrix from DataBase and aMatrix[8200, 40]
SVD svd = new SVD(aMatrix);
StreamWriter sWr = new StreamWriter("sMatrix.mtx");
Matrix S = svd.S.SubMatrix(0, k - 1, 0, k - 1);
for (int row = 0; row < S.Rows; row++)
{
for (int col = 0; col < S.Cols; col++)
sWr.Write(S[row, col] + "\t");
sWr.Write("\n");
}
sWr.Close();
StreamWriter uWr = new StreamWriter("uMatrix.mtx");
Matrix U = svd.U;
nt endRaws = U.Rows - 1;
U = U.SubMatrix(0, endRaws, 0, k - 1);
for (int row = 0; row < U.Rows; row++)
{
for (int col = 0; col < U.Cols; col++)
uWr.Write(U[row, col] + "\t");
uWr.Write("\n");
}
uWr.Close();
StreamWriter vWr = new StreamWriter("vMatrix.mtx");
Matrix V = svd.V;
endRaws = V.Rows - 1;
V = V.SubMatrix(0, endRaws, 0, k - 1);
for (int row = 0; row < V.Rows; row++)
{
for (int col = 0; col < V.Cols; col++)
vWr.Write(V[row, col] + "\t");
vWr.Write("\n");
}
vWr.Close();
StreamWriter vtWr = new StreamWriter("vtMatrix.mtx");
Matrix VT = new Matrix(V.Cols, V.Rows);
for (int row = 0; row < V.Rows; row++)
for (int col = 0; col < V.Cols; col++)
VT[col, row] = V[row, col];
for (int row = 0; row < VT.Rows; row++)
{
for (int col = 0; col < VT.Cols; col++)
vtWr.Write(VT[row, col] + "\t");
vtWr.Write("\n");
}
vtWr.Close();
How I can Manage my Memory?
No comments:
Post a Comment