/// <summary>
 /// Initializes a new instance of the <see cref="ImmutableIntegrationSettings"/> class from an instance of
 /// <see cref="IntegrationSettings"/>.
 /// </summary>
 /// <param name="settings">The values to use.</param>
 /// <param name="isExplicitlyDisabled">If true forces the setting Enabled = false. Otherwise, uses <see cref="IntegrationSettings.Enabled"/></param>
 internal ImmutableIntegrationSettings(IntegrationSettings settings, bool isExplicitlyDisabled)
 {
     IntegrationName     = settings.IntegrationName;
     Enabled             = isExplicitlyDisabled ? false : settings.Enabled;
     AnalyticsEnabled    = settings.AnalyticsEnabled;
     AnalyticsSampleRate = settings.AnalyticsSampleRate;
 }
Пример #2
0
        public void SeperableIntegrals()
        {
            // Integrates \Pi_{j=0}^{d-1} \int_0^1 \! dx \, x_j^j = \Pi_{j=0}^{d-1} \frac{1}{j+1} = \frac{1}{d!}

            // This is a simple test of a seperable integral

            Func <IReadOnlyList <double>, double> f = delegate(IReadOnlyList <double> x) {
                double y = 1.0;
                for (int j = 0; j < x.Count; j++)
                {
                    y *= MoreMath.Pow(x[j], j);
                }
                return(y);
            };

            for (int d = 1; d <= 10; d++)
            {
                Console.WriteLine(d);
                // Result gets very small, so rely on relative rather than absolute precision.
                IntegrationSettings s = new IntegrationSettings()
                {
                    AbsolutePrecision = 0, RelativePrecision = Math.Pow(10.0, -(6.0 - d / 2.0))
                };
                IntegrationResult r = MultiFunctionMath.Integrate(f, UnitCube(d), s);
                Assert.IsTrue(r.Estimate.ConfidenceInterval(0.95).ClosedContains(1.0 / AdvancedIntegerMath.Factorial(d)));
            }
        }
Пример #3
0
        public void IntegrationSettings_GetValueOrDefault_Bool()
        {
            // Setup
            IntegrationSettings testSubject = this.CreateTestSubject();

            // Test case 1: exists -> value
            // Setup
            bool expected1 = false;

            this.settingsStore.SetBoolean(IntegrationSettings.SettingsRoot, "key1", expected1);

            // Act
            bool actual1 = testSubject.GetValueOrDefault("key1", true);

            // Verify
            Assert.AreEqual(expected1, actual1, "Did not load existing value");

            // Test case 2: does NOT exist -> default
            // Setup
            bool expected2 = true;

            // Act
            bool actual2 = testSubject.GetValueOrDefault("key2", expected2);

            // Verify
            Assert.AreEqual(expected2, actual2, "Did not return default value");
        }
Пример #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 public IntegrationFileStorageCommandHandler(IRepository <UsuarioWorkDay> repository, IRepository <Empleado> empleadoRepository,
                                             IRepository <Departamento> departamentoRepository, IRepository <Localizacion> localizacionRepository, IRepository <Division> divisionRepository,
                                             IRepository <EstadoPasaporte> estadoPasaporteRepository, IRepository <FichaLaboral> fichaLaboralRepository,
                                             IRepository <FichaMedica> fichaMedicaRepository, IRepository <Role> roleRepository, IRepository <EmpleadoRole> empleadoRoleRepository,
                                             IResultadosIntegracionRepository resultadosIntegracionRepository,
                                             IRepository <Area> areaRepository, IRepository <Region> regionRepository, IRepository <Pais> paisRepository,
                                             IRepository <Tecnologia> tecnologiaRepository, IFileStorageService fileStorageService,
                                             IZipFilesRepository zipFilesRepository, IntegrationSettings integrationSettings)
 {
     this.repository                      = repository ?? throw new ArgumentNullException(nameof(repository));
     this.empleadoRepository              = empleadoRepository ?? throw new ArgumentNullException(nameof(empleadoRepository));
     this.departamentoRepository          = departamentoRepository ?? throw new ArgumentNullException(nameof(departamentoRepository));
     this.localizacionRepository          = localizacionRepository ?? throw new ArgumentNullException(nameof(localizacionRepository));
     this.divisionRepository              = divisionRepository ?? throw new ArgumentNullException(nameof(divisionRepository));
     this.estadoPasaporteRepository       = estadoPasaporteRepository ?? throw new ArgumentNullException(nameof(estadoPasaporteRepository));
     this.roleRepository                  = roleRepository ?? throw new ArgumentNullException(nameof(roleRepository));
     this.fichaLaboralRepository          = fichaLaboralRepository ?? throw new ArgumentNullException(nameof(fichaLaboralRepository));
     this.fichaMedicaRepository           = fichaMedicaRepository ?? throw new ArgumentNullException(nameof(fichaMedicaRepository));
     this.empleadoRoleRepository          = empleadoRoleRepository ?? throw new ArgumentNullException(nameof(empleadoRoleRepository));
     this.resultadosIntegracionRepository = resultadosIntegracionRepository ?? throw new ArgumentNullException(nameof(resultadosIntegracionRepository));
     this.tecnologiaRepository            = tecnologiaRepository ?? throw new ArgumentNullException(nameof(tecnologiaRepository));
     this.areaRepository                  = areaRepository ?? throw new ArgumentNullException(nameof(areaRepository));
     this.regionRepository                = regionRepository ?? throw new ArgumentNullException(nameof(regionRepository));
     this.paisRepository                  = paisRepository ?? throw new ArgumentNullException(nameof(paisRepository));
     this.fileStorageService              = fileStorageService ?? throw new ArgumentNullException(nameof(fileStorageService));
     this.integrationSettings             = integrationSettings ?? throw new ArgumentNullException(nameof(integrationSettings));
     this.zipFilesRepository              = zipFilesRepository ?? throw new ArgumentNullException(nameof(zipFilesRepository));
 }
Пример #5
0
        public void IntegrationSettings_SetValue_Bool()
        {
            // Setup
            const string        propertyKey = "key1";
            const string        collection  = IntegrationSettings.SettingsRoot;
            IntegrationSettings testSubject = this.CreateTestSubject();

            // Sanity
            this.settingsStore.AssertCollectionPropertyCount(collection, 0);

            // Test case 1: new property
            // Act
            testSubject.SetValue(propertyKey, true);

            // Verify
            this.settingsStore.AssertCollectionPropertyCount(collection, 1);
            this.settingsStore.AssertBoolean(collection, propertyKey, true);

            // Test case 2: overwrite existing property
            // Act
            testSubject.SetValue(propertyKey, false);

            // Verify
            this.settingsStore.AssertCollectionPropertyCount(collection, 1);
            this.settingsStore.AssertBoolean(collection, propertyKey, false);
        }
Пример #6
0
        public override void Given()
        {
            base.Given();

            WorkItemStore = TimedAction(() => IntegrationSettings.CreateRestStore(), "REST", "WIS Create");

            ConfigureOptions();

            var pr         = new PropertyReflector();
            var pi         = new PropertyInspector(pr);
            var attMapper  = new AttributeMapperStrategy(pi);
            var mapper     = new WorkItemMapper(attMapper);
            var translator = new WiqlTranslator();
            var pe         = new PartialEvaluator();
            var qr         = new QueryRewriter();
            var wqb        = new WiqlQueryBuilder(translator, pe, qr);
            var qp         = new MapperTeamFoundationServerWorkItemQueryProvider(
                WorkItemStore,
                wqb,
                mapper);

            Query = new Query <Bug>(qp, wqb);

            _ids = new[]
            {
                8663955
            };
        }
Пример #7
0
        public static IContainer UseDatenMeisterDotNet(this ContainerBuilder kernel, IntegrationSettings settings)
        {
            settings.Hooks = new DotNetIntegrationHooks();

            var integration = new Integration(settings);
            return integration.UseDatenMeister(kernel);
        }
Пример #8
0
        public void Initialize(IBuildServerWatcher buildServerWatcher, ISettingsSource config, Func <ObjectId, bool> isCommitInRevisionGrid = null)
        {
            if (_buildServerWatcher != null)
            {
                throw new InvalidOperationException("Already initialized");
            }

            _buildServerWatcher = buildServerWatcher;
            _settings           = IntegrationSettings.ReadFrom(config);

            if (!_settings.IsValid())
            {
                return;
            }

            _projectUrl = _buildServerWatcher.ReplaceVariables(_settings.ProjectUrl);

            if (!Uri.IsWellFormedUriString(_projectUrl, UriKind.Absolute) || string.IsNullOrWhiteSpace(_settings.ApiToken))
            {
                return;
            }

            _apiClient = new ApiClient(_projectUrl, _settings.ApiToken);
            if (CacheAzureDevOps == null || CacheAzureDevOps.Id != CacheKey)
            {
                CacheAzureDevOps      = null;
                _buildDefinitionsTask = _apiClient.GetBuildDefinitionsAsync(_settings.BuildDefinitionFilter);
            }
            else
            {
                _buildDefinitions = CacheAzureDevOps.BuildDefinitions;
            }
        }
Пример #9
0
        public void MoreBox()
        {
            // 8-D integral!
            IntegrationSettings settings = new IntegrationSettings()
            {
                RelativePrecision = 1.0E-3
            };

            Console.WriteLine(BoxIntegralD(4, -1, settings));

            /*
             * double K1 = FunctionMath.Integrate(Math.Asec)
             * double alpha = Math.Asin(2.0 / 3.0 - 1.0 / 6.0 / Math.Sqrt(2.0));
             * double d41 = 26.0 / 15.0 * AdvancedMath.Catalan - 380.0 / 6237.0 * Math.Sqrt(5.0) +
             *  568.0 / 3465.0 * Math.Sqrt(3.0) - 4.0 / 189.0 * Math.PI - 449.0 / 3465.0 -
             *  73.0 / 63.0 * Math.Sqrt(2.0) * Math.Atan(Math.Sqrt(2.0) / 4.0) -
             *  184.0 / 189.0 * Math.Log(2.0) + 64.0 / 189.0 * Math.Log(Math.Sqrt(5.0) + 1.0) +
             *  1.0 / 54.0 * Math.Log(1.0 + Math.Sqrt(2.0)) + 40.0 / 63.0 * Math.Log(Math.Sqrt(2.0) + Math.Sqrt(6.0)) -
             *  5.0 / 28.0 * Math.PI * Math.Log(1.0 + Math.Sqrt(2.0)) + 52.0 / 63.0 * Math.PI * Math.Log(2.0) +
             *  295.0 / 252.0 * Math.Log(3.0) + 4.0 / 315.0 * Math.PI * Math.PI + 3239.0 / 62370.0 * Math.Sqrt(2.0) -
             *  8.0 / 21.0 * Math.Sqrt(3.0) * Math.Atan(1.0 / Math.Sqrt(15.0)) -
             *  52.0 / 63.0 * Math.PI * Math.Log(Math.Sqrt(2.0) + Math.Sqrt(6.0)) +
             *  5.0 / 7.0 * alpha * Math.Log(1.0 + Math.Sqrt(2.0)) - 5.0 / 7.0 * AdvancedMath.Clausen(alpha)
             *  - 5.0 / 7.0 * AdvancedMath.Clausen(alpha + Math.PI / 2.0) + 52.0 / 63.0 * K1;
             */
        }
Пример #10
0
        public virtual IActionResult ResetIntegrations()
        {
            var model = new IntegrationSettings();

            Engine.Settings.Set(model);
            return(RedirectWithResetMessage("Integrations"));
        }
Пример #11
0
        public void DistributionProbabilityIntegral()
        {
            Random rng = new Random(1);

            // if integral is very small, we still want to get it very accurately
            IntegrationSettings settings = new IntegrationSettings()
            {
                AbsolutePrecision = 0.0
            };

            foreach (ContinuousDistribution distribution in distributions)
            {
                if (distribution is BetaDistribution b && ((b.Alpha < 1.0) || (b.Beta < 1.0)))
                {
                    continue;
                }

                for (int i = 0; i < 4; i++)
                {
                    double x;
                    if (Double.IsNegativeInfinity(distribution.Support.LeftEndpoint) && Double.IsPositiveInfinity(distribution.Support.RightEndpoint))
                    {
                        // pick an exponentially distributed random point with a random sign
                        double y = rng.NextDouble();
                        x = -Math.Log(y);
                        if (rng.NextDouble() < 0.5)
                        {
                            x = -x;
                        }
                    }
                    else if (Double.IsPositiveInfinity(distribution.Support.RightEndpoint))
                    {
                        // pick an exponentially distributed random point
                        double y = rng.NextDouble();
                        x = distribution.Support.LeftEndpoint - Math.Log(y);
                    }
                    else
                    {
                        // pick a random point within the support
                        x = distribution.Support.LeftEndpoint + rng.NextDouble() * distribution.Support.Width;
                    }
                    double P = FunctionMath.Integrate(distribution.ProbabilityDensity, Interval.FromEndpoints(distribution.Support.LeftEndpoint, x), settings).Value;
                    double Q = FunctionMath.Integrate(distribution.ProbabilityDensity, Interval.FromEndpoints(x, distribution.Support.RightEndpoint), settings).Value;
                    if (!TestUtilities.IsNearlyEqual(P + Q, 1.0))
                    {
                        // the numerical integral for the triangular distribution can be inaccurate, because
                        // its locally low-polynomial behavior fools the integration routine into thinking it need
                        // not integrate as much near the inflection point as it must; this is a problem
                        // of the integration routine (or arguably the integral), not the triangular distribution,
                        // so skip it here
                        continue;
                    }

                    Assert.IsTrue(TestUtilities.IsNearlyEqual(P, distribution.LeftProbability(x)));
                    Assert.IsTrue(TestUtilities.IsNearlyEqual(Q, distribution.RightProbability(x)));
                }
            }
        }
Пример #12
0
        public void SteinmetzVolume()
        {
            // Steinmetz solid is intersection of unit cylinders along all axes. This is another hard-edged integral.
            // Analytic values are known for d=2-5.
            // http://www.math.illinois.edu/~hildebr/ugresearch/cylinder-spring2013report.pdf
            // http://www.math.uiuc.edu/~hildebr/igl/nvolumes-fall2012report.pdf

            IntegrationSettings settings = new IntegrationSettings()
            {
                RelativePrecision = 1.0E-2
            };

            for (int d = 2; d <= 5; d++)
            {
                IntegrationResult v1 = MultiFunctionMath.Integrate((IReadOnlyList <double> x) => {
                    for (int i = 0; i < d; i++)
                    {
                        double s = 0.0;
                        for (int j = 0; j < d; j++)
                        {
                            if (j != i)
                            {
                                s += x[j] * x[j];
                            }
                        }
                        if (s > 1.0)
                        {
                            return(0.0);
                        }
                    }
                    return(1.0);
                }, SymmetricUnitCube(d), settings);

                double v2 = 0.0;
                switch (d)
                {
                case 2:
                    // trivial square
                    v2 = 4.0;
                    break;

                case 3:
                    v2 = 16.0 - 8.0 * Math.Sqrt(2.0);
                    break;

                case 4:
                    v2 = 48.0 * (Math.PI / 4.0 - Math.Atan(Math.Sqrt(2.0)) / Math.Sqrt(2.0));
                    break;

                case 5:
                    v2 = 256.0 * (Math.PI / 12.0 - Math.Atan(1.0 / (2.0 * Math.Sqrt(2.0))) / Math.Sqrt(2.0));
                    break;
                }

                Console.WriteLine("{0} {1} {2}", d, v1.Value, v2);
                Assert.IsTrue(v1.Estimate.ConfidenceInterval(0.99).ClosedContains(v2));
            }
        }
        /// <inheritdoc />
        public override void Given()
        {
            base.Given();

            var wis     = TimedAction(() => IntegrationSettings.CreateSoapStore(), "SOAP", "WIS Create");
            var soapIms = TimedAction(() => wis.GetIdentityManagementService(), "SOAP", "IMS Create");

            Instance = new IdentityAliasValueConverter(soapIms, IntegrationSettings.TenantId, IntegrationSettings.Domains);
        }
Пример #14
0
 public IntegrationService(NRZContext context,
                           IOptions <RegiXCertificateSettings> regixSettings,
                           IOptions <IntegrationSettings> integrationSettings,
                           IStringLocalizer <SharedResources> localizer = null)
     : base(context, localizer)
 {
     _regixCertificateSettings = regixSettings.Value;
     _integrationSettings      = integrationSettings.Value;
 }
        public IntegrationHelper(IntegrationSettings settings)
        {
            this.Settings = settings;

            var context     = new IntegrationDBContext(this.Settings.DBContextSettings);
            var servicesMgr = new IntegrationServicesMgr(this.Settings.RsapiSettings);

            base.Add(context);
            base.Add(servicesMgr);
        }
        public override void Given()
        {
            SoapResult = new Result {
                WorkItemStore = TimedAction(() => IntegrationSettings.CreateSoapStore(), "SOAP", "Create WIS")
            };

            RestResult = new Result {
                WorkItemStore = TimedAction(() => IntegrationSettings.CreateRestStore(), "REST", "Create WIS")
            };
        }
Пример #17
0
        public void IntegrationAnalyticsSampleRate(string settingName, string settingValue, double expected)
        {
            var source = new NameValueConfigurationSource(new NameValueCollection
            {
                { settingName, settingValue }
            });

            var settings = new IntegrationSettings("FOO", source);

            Assert.Equal(expected, settings.AnalyticsSampleRate);
        }
Пример #18
0
        public void GetInstanceOfExtractorRegullarExpressionTest()
        {
            IntegrationSettings testSettings = new IntegrationSettings();

            IntegrationServicesMgr testServiceManager = new IntegrationServicesMgr(testSettings.RsapiSettings);

            ArtifactQueries artifactQueries = new ArtifactQueries();
            ArtifactFactory artifactFactory = new ArtifactFactory(artifactQueries, testServiceManager, null);

            var extractorRegEx = artifactFactory.GetInstanceOfExtractorRegullarExpression(ExecutionIdentity.System, 1016201, 1043028);
        }
Пример #19
0
        public virtual IActionResult Integrations()
        {
            _cache.Remove(typeof(IntegrationSettings).ToString());
            IntegrationSettings model = Engine.Settings.Integrations;

            if (model == null)
            {
                model = new IntegrationSettings();
            }
            return(View(model));
        }
Пример #20
0
        public void IntegrationEnabled(string settingName, string settingValue, bool expected)
        {
            var source = new NameValueConfigurationSource(new NameValueCollection
            {
                { settingName, settingValue }
            });

            var settings = new IntegrationSettings("FOO", source);

            Assert.Equal(expected, settings.Enabled);
        }
Пример #21
0
        public void IntegrationSettings_Ctor_InitializesStore()
        {
            // Sanity - should be empty store
            this.settingsStore.AssertCollectionDoesNotExist(IntegrationSettings.SettingsRoot);

            // Act
            IntegrationSettings testSubject = this.CreateTestSubject();

            // Verify
            this.settingsStore.AssertCollectionExists(IntegrationSettings.SettingsRoot);
        }
Пример #22
0
 private IntegrationResult RambleIntegral(int d, int s, IntegrationSettings settings)
 {
     return(MultiFunctionMath.Integrate((IReadOnlyList <double> x) => {
         Complex z = 0.0;
         for (int k = 0; k < d; k++)
         {
             z += ComplexMath.Exp(2.0 * Math.PI * Complex.I * x[k]);
         }
         return (MoreMath.Pow(ComplexMath.Abs(z), s));
     }, UnitCube(d), settings));
 }
Пример #23
0
 public double BoxIntegralB(int d, int r, IntegrationSettings settings)
 {
     return(MultiFunctionMath.Integrate((IReadOnlyList <double> x) => {
         double s = 0.0;
         for (int k = 0; k < d; k++)
         {
             s += x[k] * x[k];
         }
         return (Math.Pow(s, r / 2.0));
     }, UnitCube(d), settings).Value);
 }
Пример #24
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            IntegrationSettings.ReadSettings();

            LogManager.GetCurrentClassLogger().Log(LogLevel.Info, "Started callback receiver");
        }
Пример #25
0
 public double BoxIntegralD(int d, int r, IntegrationSettings settings)
 {
     return(MultiFunctionMath.Integrate((IList <double> x) => {
         double s = 0.0;
         for (int k = 0; k < d; k++)
         {
             double z = x[k] - x[k + d];
             s += z * z;
         }
         return (Math.Pow(s, r / 2.0));
     }, UnitCube(2 * d), settings).Value);
 }
            internal BoardSubscription(LeanKitAccountAuth auth, long boardId, int pollingFrequency)
            {
                _boardId    = boardId;
                LkClientApi = new LeanKitClientFactory().Create(auth);
                var settings = new IntegrationSettings {
                    CheckForUpdatesIntervalSeconds = pollingFrequency
                };

                Integration = new LeanKitIntegrationFactory().Create(_boardId, auth, settings);

                new Thread(WatchThread).Start();
            }
Пример #27
0
        public void ImmutableSettingsRespectsOriginalIfNotOverridden(bool initiallyEnabled)
        {
            var name     = nameof(IntegrationId.Kafka);
            var settings = new IntegrationSettings(name, source: null)
            {
                Enabled = initiallyEnabled
            };

            var immutableSettings = new ImmutableIntegrationSettings(settings, isExplicitlyDisabled: false);

            immutableSettings.Enabled.Should().Be(initiallyEnabled);
        }
Пример #28
0
        public void GaussianIntegrals()
        {
            Random rng = new Random(1);

            for (int d = 2; d < 8; d++)
            {
                Console.WriteLine(d);

                // Create a symmetric matrix
                SymmetricMatrix A = new SymmetricMatrix(d);
                for (int r = 0; r < d; r++)
                {
                    for (int c = 0; c < r; c++)
                    {
                        A[r, c] = rng.NextDouble();
                    }
                    // Ensure it is positive definite by diagonal dominance
                    A[r, r] = r + 1.0;
                }

                // Compute its determinant, which appears in the analytic value of the integral
                CholeskyDecomposition CD = A.CholeskyDecomposition();
                double detA = CD.Determinant();

                // Compute the integral
                Func <IReadOnlyList <double>, double> f = (IReadOnlyList <double> x) => {
                    ColumnVector v = new ColumnVector(x);
                    double       s = v.Transpose * (A * v);
                    return(Math.Exp(-s));
                };

                Interval[] volume = new Interval[d];
                for (int i = 0; i < d; i++)
                {
                    volume[i] = Interval.FromEndpoints(Double.NegativeInfinity, Double.PositiveInfinity);
                }

                // These are difficult integrals; demand reduced precision.
                IntegrationSettings settings = new IntegrationSettings()
                {
                    RelativePrecision = Math.Pow(10.0, -(4.0 - d / 2.0))
                };

                IntegrationResult I = MultiFunctionMath.Integrate(f, volume, settings);

                // Compare to the analytic result
                Assert.IsTrue(I.Estimate.ConfidenceInterval(0.95).ClosedContains(Math.Sqrt(MoreMath.Pow(Math.PI, d) / detA)));
            }
        }
Пример #29
0
        public void CreateExtractorRegularExpressionRecordTest()
        {
            IntegrationSettings    testSettings        = new IntegrationSettings();
            IntegrationDBContext   testDBContext       = new IntegrationDBContext(testSettings.DBContextSettings);
            IntegrationServicesMgr testServiceManager  = new IntegrationServicesMgr(testSettings.RsapiSettings);
            SqlQueryHelper         testSqlQueryHelpers = new SqlQueryHelper();
            ArtifactQueries        artifactQueries     = new ArtifactQueries();

            Int32  workspaceArtifactId = 1016201;
            string regExName           = "RegEx created from Unit Test";
            string regEx       = @"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?";
            string description = "Matches emails";

            artifactQueries.CreateExtractorRegularExpressionRecord(testServiceManager, ExecutionIdentity.CurrentUser, workspaceArtifactId, regExName, regEx, description);
        }
Пример #30
0
 public virtual IActionResult Integrations(IntegrationSettings model)
 {
     try
     {
         Engine.Settings.Set(model);
         SaveMessage = "Settings saved!";
         MessageType = AlertType.Success;
     }
     catch (Exception ex)
     {
         SaveMessage = "Error saving: " + ex.Message;
         MessageType = AlertType.Danger;
     }
     return(View(model));
 }
        public void AssociatedLaguerreOrthonormality()
        {
            // don't let orders get too big, or (1) the Gamma function will overflow and (2) our integral will become highly oscilatory
            foreach (int n in TestUtilities.GenerateIntegerValues(1, 10, 3))
            {
                foreach (int m in TestUtilities.GenerateIntegerValues(1, 10, 3))
                {
                    foreach (double a in TestUtilities.GenerateRealValues(0.1, 10.0, 5))
                    {
                        //int n = 2;
                        //int m = 4;
                        //double a = 3.5;

                        Console.WriteLine("n={0} m={1} a={2}", n, m, a);

                        // evaluate the orthonormal integral
                        Func <double, double> f = delegate(double x) {
                            return(Math.Pow(x, a) * Math.Exp(-x) *
                                   OrthogonalPolynomials.LaguerreL(m, a, x) *
                                   OrthogonalPolynomials.LaguerreL(n, a, x)
                                   );
                        };
                        Interval r = Interval.FromEndpoints(0.0, Double.PositiveInfinity);

                        // need to loosen default evaluation settings in order to get convergence in some of these cases
                        // seems to have most convergence problems for large a
                        IntegrationSettings e = new IntegrationSettings();
                        e.AbsolutePrecision = TestUtilities.TargetPrecision;
                        e.RelativePrecision = TestUtilities.TargetPrecision;

                        double I = FunctionMath.Integrate(f, r, e).Value;
                        Console.WriteLine(I);

                        // test for orthonormality
                        if (n == m)
                        {
                            Assert.IsTrue(TestUtilities.IsNearlyEqual(
                                              I, AdvancedMath.Gamma(n + a + 1) / AdvancedIntegerMath.Factorial(n)
                                              ));
                        }
                        else
                        {
                            Assert.IsTrue(Math.Abs(I) < TestUtilities.TargetPrecision);
                        }
                    }
                }
            }
        }
Пример #32
0
 public static IContainer UseDatenMeister(this ContainerBuilder kernel, IntegrationSettings settings)
 {
     var integration = new Integration(settings);
     return integration.UseDatenMeister(kernel);
 }
Пример #33
0
        private IContainer CreateKernel(IAppBuilder app)
        {
            var settings = new IntegrationSettings
            {
                PathToXmiFiles = "App_Data/Xmi",
                EstablishDataEnvironment = true
            };

            var kernel = new ContainerBuilder();
            var container = kernel.UseDatenMeisterDotNet(settings);

            // Defines the shutdown
            var properties = new AppProperties(app.Properties);
            var token = properties.OnAppDisposing;
            token.Register(() =>
            {
                _lifetimeScope.UnuseDatenMeister();
            });

            return container;
        }
Пример #34
0
 public Integration(IntegrationSettings settings)
 {
     _settings = settings;
 }
Пример #35
0
        public IContainer UseDatenMeister(ContainerBuilder kernel)
        {
            if (_settings == null)
            {
                Debug.WriteLine("No integration settings were given. Loading the default values.");
                _settings = new IntegrationSettings();
            }

            kernel.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource());

            var watch = new Stopwatch();
            watch.Start();

            // Defines the factory method for a certain extent type
            var factoryMapper = new DefaultFactoryMapper();
            kernel.RegisterInstance(factoryMapper).As<IFactoryMapper>();

            // Finds the loader for a certain extent type
            var storageMap = new ManualConfigurationToExtentStorageMapper();
            kernel.RegisterInstance(storageMap).As<IConfigurationToExtentStorageMapper>();

            // Workspace collection
            var workspaceCollection = new WorkspaceCollection();
            workspaceCollection.Init();
            kernel.RegisterInstance(workspaceCollection).As<IWorkspaceCollection>();

            // Defines the extent storage data
            var extentStorageData = new ExtentStorageData();
            kernel.RegisterInstance(extentStorageData).As<ExtentStorageData>();
            kernel.RegisterType<ExtentStorageLoader>().As<IExtentStorageLoader>();

            // Defines the datalayers
            var dataLayers = new DataLayers();
            kernel.RegisterInstance(dataLayers).As<DataLayers>();

            var dataLayerData = new DataLayerData(dataLayers);
            kernel.RegisterInstance(dataLayerData).As<DataLayerData>();
            kernel.RegisterType<DataLayerLogic>().As<IDataLayerLogic>();

            // Adds the name resolution
            kernel.RegisterType<UmlNameResolution>().As<IUmlNameResolution>();

            var builder = kernel.Build();
            using (var scope = builder.BeginLifetimeScope())
            {
                // Is used by .Net Provider to include the mappings for extent storages and factory types
                _settings?.Hooks?.OnStartScope(scope);

                var dataLayerLogic = scope.Resolve<IDataLayerLogic>();
                dataLayers.SetRelationsForDefaultDataLayers(dataLayerLogic);

                // Load the default extents

                // Performs the bootstrap
                var paths =
                    new Bootstrapper.FilePaths()
                    {
                        PathPrimitive = Path.Combine(_settings.PathToXmiFiles, "PrimitiveTypes.xmi"),
                        PathUml = Path.Combine(_settings.PathToXmiFiles, "UML.xmi"),
                        PathMof = Path.Combine(_settings.PathToXmiFiles, "MOF.xmi")
                    };

                if (_settings.PerformSlimIntegration)
                {
                    throw new InvalidOperationException("Slim integration is currently not supported");
                }
                else
                {
                    Bootstrapper.PerformFullBootstrap(
                        paths,
                        workspaceCollection.GetWorkspace("UML"),
                        dataLayerLogic,
                        dataLayers.Uml);
                    Bootstrapper.PerformFullBootstrap(
                        paths,
                        workspaceCollection.GetWorkspace("MOF"),
                        dataLayerLogic,
                        dataLayers.Mof);
                }

                // Creates the workspace and extent for the types layer which are belonging to the types
                var extentTypes = new MofUriExtent("dm:///types");
                var typeWorkspace = workspaceCollection.GetWorkspace("Types");
                typeWorkspace.AddExtent(extentTypes);
                dataLayerLogic.AssignToDataLayer(extentTypes, dataLayers.Types);

                // Boots up the typical DatenMeister Environment
                if (_settings.EstablishDataEnvironment)
                {
                    EstablishDataEnvironment(builder, scope);
                }
            }

            watch.Stop();
            Debug.WriteLine($"Elapsed time for bootstrap: {watch.Elapsed}");

            return builder;
        }