c# - Showing 0 as index for output -
in following, shows 0
index values.format of output must like:
2352:0.45678 9878:0.23423 ..........
but after running, result like:
0:0.45678 0:0.23423 .........
after showing above result runs again , shows
0:0 0:0
var results = new list<float>(1143600); (int z = 0; z < 1143600; z++) { results.add(dotproduct(useridseq, z));//for multiply 2 vectors } var sb1 = new stringbuilder(); foreach (var resultwithindex in results.select((r, index) => new { result = r, index = index }).orderbydescending(r => r.result).take(n)) { int indexx = resultwithindex.index; (int yyyy = 0; yyyy <itemori.length; yyyy++) { lineitemori5 = fileitemori.readline(); if (!string.isnullorempty(lineitemori5)) { string[] values5 = lineitemori5.split('\t'); int itemidori5; foreach (string valuewoow in values5) { itemidori5 = convert.toint32(values5[0]); if (indexx == itemidori5) { itemidseq5 = convert.toint32(values5[1]); } } } } sb1.appendformat("{0}: {1}", itemidseq5, resultwithindex.result); sb1.appendline(); } messagebox.show(sb1.tostring()); }
ps: have 2 data sets worked 1 of them , calculate result each result has index not real,for getting real index, must use data set. idea?
thanks in advance
Comments
Post a Comment