Ejemplo n.º 1
0
        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]);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
            }
        }