public MatrixElement GetValue(string xAxisName, string yAxisName) { if (_axisKeys == null) { SetAxisKeys(); } var x = _axisKeys[xAxisName]; var y = _axisKeys[yAxisName]; if (Matrix[x, y] == null) { Matrix[x, y] = new MatrixElement { XAxisName = xAxisName, YAxisName = yAxisName, ValuesAsString = "", Value = 0 } } ; return(Matrix[x, y]); }
public double SetValue(string xAxisName, string yAxisName, double?value, int?numberOfSamples, double correlationThreshold = 0.2) { var x = _axisKeys[xAxisName]; var y = _axisKeys[yAxisName]; Matrix[x, y] = new MatrixElement { XAxisName = xAxisName, YAxisName = yAxisName, ValuesAsString = (value?.ToString(CultureInfo.InvariantCulture) ?? "null") + (numberOfSamples.HasValue ? "(Antall=" + numberOfSamples.Value + ")" : ""), Value = value ?? 0 }; return(Matrix[x, y].Value); }
public CorrelationMatrix(int length, string[] headers) { Matrix = new MatrixElement[length + 1, length + 1]; _axisKeys = new Dictionary <string, int>(); for (int i = 0; i < headers.Length; i++) { Matrix[0, i + 1] = new MatrixElement { ValuesAsString = headers[i] }; Matrix[i + 1, 0] = new MatrixElement { ValuesAsString = headers[i] }; _axisKeys.Add(headers[i], i + 1); } }