示例#1
0
文件: Spectrum.cs 项目: terasato/Xbrt
        public static Spectrum ByFunc([NotNull] Func<double, double> func, Region region, int n)
        {
            if (func == null) throw new ArgumentNullException("func");
            if (n <= 0) throw new ArgumentOutOfRangeException("n");

            var a = new double[n];
            foreach (var i in Enumerable.Range(0, n)) {
                var x = region.GetValue(((double) i)/n);
                a[i] = func(x);
            }

            return new Spectrum(a, region);
        }
示例#2
0
 public void GetValueは領域での与えられた比での値を返す(double ratio, double expected)
 {
     var r = new Region(0, 10);
     Assert.AreEqual(expected, r.GetValue(ratio));
 }