从TXT数据集创建矩阵时遇到问题 TXT数据集 1,2,-1
3,4,5
6,7,8
我使用CreateMatrixFromFile从txt文件创建矩阵 矩阵值已更改 e.x 矩阵[0,1] = 2 几次访问矩阵后 矩阵[0,1] = 2更改为0或接近零
2018/11/5 9:53:02 ----- 2 2018/11/5 9:53:02 ----- 2 2018/11/5 9:53:02 ----- 2 2018/11/5 9:53:02 ----- 2 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0 2018/11/5 9:53:02 ----- 0
2018/11/5 9:53:03 ----- 0 2018/11/5 9:53:03 ----- 0 2018/11/5 9:53:03 ----- 0
2018/11/5 9:53:03 ----- 0 2018/11/5 9:53:03 ----- 0 2018/11/5 9:53:03 ----- 0 2018/11/5 9:53:03 ----- 0 2018/11/5 9:53:03 ----- 0 2018/11/5 9:53:03 ----- 0 2018/11/5 9:53:03 ----- 0 2018/11/5 9:53:03 ----- 0 2018/11/5 9:53:03 ----- 0 2018/11/5 9:53:03 ----- 0 2018/11/5 9:53:03 ----- 8.90078774365775E-308 2018/11/5 9:53:03 ----- 8.90078774365775E-308 2018/11/5 9:53:03 ----- 8.90078774365775E-308 2018/11/5 9:53:03 ----- 8.90078774365775E-308 2018/11/5 9:53:03 ----- 8.90078774365775E-308 2018/11/5 9:53:03 ----- 8.90078774365775E-308 2018/11/5 9:53:03 ----- 8.90078774365775E-308 2018/11/5 9:53:03 ----- 8.90078774365775E-308 2018/11/5 9:53:03 ----- 8.90078774365775E-308 2018/11/5 9:53:03 ----- 8.90078774365775E-308 2018/11/5 9:53:03 ----- 8.90078774365775E-308
public static unsafe Matrix<double> CreateMatrixFromFile(string[] fileData, int pointCount)
{
List<double> rawdata = new List<double>();
int subLength = 0;
for (int i = 0; i < fileData.Length; i++)
{
string[] subData = fileData[i].Split(',');
subLength = subData.Length;
for (int j = 0; j < subLength; j++)
{
double temp = Convert.ToDouble(subData[j]);
rawdata.Add(temp);
}
}
double[] dataArray = rawdata.ToArray();
fixed (double* dataPtr = dataArray)
{
return new Matrix<double>(pointCount, subLength, (IntPtr)dataPtr);
}
}