Replacing Oslo DLL with code/projects (#8)

* Replacing Oslo DLL with project in all solution files
* Fixed some warnings in doc-strings for OSLO
* Removed app.config for some projects, to alleviate some reference warnings
This commit is contained in:
Neil Dalchau 2021-09-06 08:59:39 +01:00 коммит произвёл GitHub
Родитель 59a3accb2e
Коммит 1b4ed04394
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
151 изменённых файлов: 27108 добавлений и 790 удалений

4
.gitignore поставляемый
Просмотреть файл

@ -409,6 +409,10 @@ CRNEngine/CRNEngineDotNet/version.txt
/CRNEngine/HTML5CRN/lib/katex.css
/CRNEngine/CRNEngineTSWrapper/Local/
/CRNEngine/CRNEngineJSBench/CRNEngine
/CRNEngine/CRNEngineJSBench/Benchmark.d.ts
/CRNEngine/CRNEngineJSBench/BenchmarkApp.d.ts
/CRNEngine/CRNEngineJSBench/Tests.d.ts
/CRNEngine/CRNEngineJSBench/app.d.ts
# Shared GUI
/HTML5SharedGUI/SimulationViewer/Scripts/IDD

Просмотреть файл

@ -42,6 +42,8 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "CRNEngineRunAllExamples", "
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "StabilityZ3", "..\StabilityZ3\StabilityZ3\StabilityZ3.fsproj", "{D51E7B2F-86CC-473E-8251-C80792725E15}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Oslo.FSharp", "..\Oslo\Oslo.FSharp\Oslo.FSharp.fsproj", "{60A49E43-FB26-4F2F-B71F-BB34695EA47B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -100,6 +102,14 @@ Global
{0298CF1C-4A9B-48A6-B60A-9B3D42BB2502}.Debug|x64.Build.0 = Debug|x64
{0298CF1C-4A9B-48A6-B60A-9B3D42BB2502}.Release|x64.ActiveCfg = Release|x64
{0298CF1C-4A9B-48A6-B60A-9B3D42BB2502}.Release|x64.Build.0 = Release|x64
{D51E7B2F-86CC-473E-8251-C80792725E15}.Debug|x64.ActiveCfg = Debug|Any CPU
{D51E7B2F-86CC-473E-8251-C80792725E15}.Debug|x64.Build.0 = Debug|Any CPU
{D51E7B2F-86CC-473E-8251-C80792725E15}.Release|x64.ActiveCfg = Release|Any CPU
{D51E7B2F-86CC-473E-8251-C80792725E15}.Release|x64.Build.0 = Release|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Debug|x64.ActiveCfg = Debug|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Debug|x64.Build.0 = Debug|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Release|x64.ActiveCfg = Release|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -15,10 +15,5 @@
<ItemGroup>
<ProjectReference Include="..\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

Просмотреть файл

@ -117,14 +117,10 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Filzbach.FSharp\Filzbach.FSharp.Portable.fsproj" />
<ProjectReference Include="..\..\Oslo\Oslo.FSharp\Oslo.FSharp.fsproj" />
<ProjectReference Include="..\..\ParserCombinators\ParserCombinators\ParserCombinators.fsproj" />
<ProjectReference Include="..\..\PDESolvers\ReactionDiffusion\ReactionDiffusion.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="Making Version" BeforeTargets="BeforeBuild">
<Exec Command="git rev-parse --short HEAD &gt; $(ProjectDir)\version.txt" />
</Target>

Просмотреть файл

@ -22,11 +22,6 @@
<ProjectReference Include="..\CliLibrary\CliLibrary.fsproj" />
<ProjectReference Include="..\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>

Просмотреть файл

@ -20,14 +20,10 @@
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Oslo\Oslo.FSharp\Oslo.FSharp.fsproj" />
<ProjectReference Include="..\..\ParserCombinators\ParserCombinators\ParserCombinators.fsproj" />
<ProjectReference Include="..\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="Copying Sundials" AfterTargets="AfterBuild" Condition="$(OS) == Windows_NT">
<Exec Command="xcopy /y /q /d &quot;$(SolutionDir)x64\$(Configuration)\SundialsSolver15.dll&quot; &quot;$(OutDir)&quot;" />
<Exec Command="xcopy /y /q /d &quot;$(SolutionDir)x64\$(Configuration)\SundialsSolver15.pdb&quot; &quot;$(OutDir)&quot;" />

Просмотреть файл

@ -46,6 +46,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenericComponents", "..\HTM
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "CRNIntegrationTestLib", "CRNIntegrationTestLib\CRNIntegrationTestLib.fsproj", "{27071C91-2959-4C5D-9933-1120868665D2}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Oslo.FSharp.WebSharper", "..\Oslo\Oslo.FSharp.WebSharper\Oslo.FSharp.WebSharper.fsproj", "{C873802D-E33F-4E84-844A-C21DC3B7788D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -117,6 +119,10 @@ Global
{27071C91-2959-4C5D-9933-1120868665D2}.Debug|x64.Build.0 = Debug|Any CPU
{27071C91-2959-4C5D-9933-1120868665D2}.Release|x64.ActiveCfg = Release|Any CPU
{27071C91-2959-4C5D-9933-1120868665D2}.Release|x64.Build.0 = Release|Any CPU
{C873802D-E33F-4E84-844A-C21DC3B7788D}.Debug|x64.ActiveCfg = Debug|Any CPU
{C873802D-E33F-4E84-844A-C21DC3B7788D}.Debug|x64.Build.0 = Debug|Any CPU
{C873802D-E33F-4E84-844A-C21DC3B7788D}.Release|x64.ActiveCfg = Release|Any CPU
{C873802D-E33F-4E84-844A-C21DC3B7788D}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -316,13 +316,9 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Filzbach.FSharp.JS\Filzbach.FSharp.JS.fsproj" />
<ProjectReference Include="..\..\Oslo\Oslo.FSharp.WebSharper\Oslo.FSharp.WebSharper.fsproj" />
<ProjectReference Include="..\..\ParserCombinators\ParserCombinatorsJS\ParserCombinatorsJS.fsproj" />
<ProjectReference Include="..\..\PDESolvers\ReactionDiffusionJS\ReactionDiffusionJS.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp.WebSharper">
<HintPath>..\..\Lib\Oslo-FSharp.websharper\Oslo.FSharp.WebSharper.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

18
CRNEngine/CRNEngineJSBench/Benchmark.d.ts поставляемый
Просмотреть файл

@ -1,18 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
declare class BenchmarkResult {
Name: string;
Min: number;
Max: number;
Mean: number;
Median: number;
StdDev: number;
SampleCount: number;
constructor(Name: string, Min: number, Max: number, Mean: number, Median: number, StdDev: number, SampleCount: number);
}
declare function BenchmarkResultFactory(target: any): BenchmarkResult;
interface ITestStatusCallback {
(result: BenchmarkResult): void;
}
declare function RunAll(testCompleteCallback: ITestStatusCallback): void;

10
CRNEngine/CRNEngineJSBench/BenchmarkApp.d.ts поставляемый
Просмотреть файл

@ -1,10 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
declare var Microsoft: any;
declare var Benchmark: any;
declare var CVode: any;
declare var Module: any;
declare let CrnEngine: any;
declare var resultsTable: any;
declare function benchmarkJS(): void;

31
CRNEngine/CRNEngineJSBench/Tests.d.ts поставляемый
Просмотреть файл

@ -1,31 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
declare var Papa: any;
declare class Tests {
private static program_simulate_oslo_am;
private static program_simulate_oslo_am_sundials;
private static program_simulate_oslo_am_functional;
private static program_simulate_oslo_am_sundials_functional;
private static program_simulate_oslo_waves;
private static program_simulate_sundials_waves;
private static program_infer_oslo_am;
private static program_infer_sundials_am;
private static observation_am_noised;
private static ParseFile;
private static ConvertTable;
private static run_crn_oslo_simulate;
private static run_crn_sundials_simulate;
private static run_crm_inference;
private static run_crm_inference_10000;
static Simulate_Oslo_AM(): void;
static Simulate_Oslo_Waves(): void;
static Simulate_Oslo_AM_functional(): void;
static Simulate_Sundials_AM(): void;
static Simulate_Sundials_Waves(): void;
static Simulate_Sundials_AM_functional(): void;
static Infer_Oslo_AM_1000(): void;
static Infer_Sundials_AM_1000(): void;
static Infer_Oslo_AM_10000(): void;
static Infer_Sundials_AM_10000(): void;
}

6
CRNEngine/CRNEngineJSBench/app.d.ts поставляемый
Просмотреть файл

@ -1,6 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
declare var Microsoft: any;
declare let CRNEngine: any;
declare function benchmark(): void;

Просмотреть файл

@ -12,14 +12,10 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MomentClosure\MomentClosure\MomentClosure.fsproj" />
<ProjectReference Include="..\..\Oslo\Oslo.FSharp\Oslo.FSharp.fsproj" />
<ProjectReference Include="..\CliLibrary\CliLibrary.fsproj" />
<ProjectReference Include="..\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="Copying Sundials" AfterTargets="AfterBuild" Condition="$(OS) == Windows_NT">
<Exec Command="xcopy /y /q /d &quot;$(ProjectDir)..\x64\$(Configuration)\SundialsSolver15.dll&quot; &quot;$(OutDir)&quot;" />
<Exec Command="xcopy /y /q /d &quot;$(ProjectDir)..\x64\$(Configuration)\SundialsSolver15.pdb&quot; &quot;$(OutDir)&quot;" />

Просмотреть файл

@ -64,6 +64,8 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "CRNEngineCloudLib", "CRNEng
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "StabilityZ3", "..\StabilityZ3\StabilityZ3\StabilityZ3.fsproj", "{0B810A30-9C35-466E-AA5B-FF8045EE23C8}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Oslo.FSharp", "..\Oslo\Oslo.FSharp\Oslo.FSharp.fsproj", "{60A49E43-FB26-4F2F-B71F-BB34695EA47B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -169,6 +171,10 @@ Global
{0B810A30-9C35-466E-AA5B-FF8045EE23C8}.Debug|x64.Build.0 = Debug|Any CPU
{0B810A30-9C35-466E-AA5B-FF8045EE23C8}.Release|x64.ActiveCfg = Release|Any CPU
{0B810A30-9C35-466E-AA5B-FF8045EE23C8}.Release|x64.Build.0 = Release|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Debug|x64.ActiveCfg = Debug|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Debug|x64.Build.0 = Debug|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Release|x64.ActiveCfg = Release|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -26,10 +26,5 @@
<ProjectReference Include="..\CRNEngineCloudLib\CRNEngineCloudLib.fsproj" />
<ProjectReference Include="..\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

Просмотреть файл

@ -76,14 +76,10 @@
<None Include="Models\Control.crn" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Oslo\Oslo.FSharp\Oslo.FSharp.fsproj" />
<ProjectReference Include="..\CliLibrary\CliLibrary.fsproj" />
<ProjectReference Include="..\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="Copying Sundials" AfterTargets="AfterBuild" Condition="$(OS) == Windows_NT">
<Exec Command="xcopy /y /q /d &quot;$(SolutionDir)x64\$(Configuration)\SundialsSolver15.dll&quot; &quot;$(OutDir)&quot;" />
<Exec Command="xcopy /y /q /d &quot;$(SolutionDir)x64\$(Configuration)\SundialsSolver15.pdb&quot; &quot;$(OutDir)&quot;" />

Просмотреть файл

@ -70,6 +70,11 @@
<assemblyIdentity name="Dynamitey" publicKeyToken="cbf53ea3aeb972c6" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2.0.10.189" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.CSharp" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />

Просмотреть файл

@ -307,6 +307,11 @@
<assemblyIdentity name="Microsoft.AspNetCore.DataProtection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.CSharp" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.Extensions.Caching.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />

Просмотреть файл

@ -22,11 +22,6 @@
<ProjectReference Include="..\HTML5CRN\HTML5CRN.csproj" />
<ProjectReference Include="..\CRNJobsManager\CRNJobsManager.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

Просмотреть файл

@ -322,6 +322,11 @@
<assemblyIdentity name="Microsoft.AspNetCore.DataProtection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.CSharp" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.Extensions.Caching.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />

Просмотреть файл

@ -23,11 +23,6 @@
<ProjectReference Include="..\CRNEngineWebServer\CRNEngineWebServer.fsproj" />
<ProjectReference Include="..\CRNIntegrationTestLib\CRNIntegrationTestLib.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="AfterBuildFAKE" AfterTargets="AfterBuild">
<Message Importance="high" Text="Running FAKE target Build" />
<Exec Command="dotnet tool restore" />

Просмотреть файл

@ -1,106 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<gcServer enabled="true" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.7.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Configuration.ConfigurationManager" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Security.AccessControl" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Dynamitey" publicKeyToken="cbf53ea3aeb972c6" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2.0.10.189" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.Net.Http.Headers" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2.2.8.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Collections.Concurrent" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.13.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Linq" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.1.1" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Runtime.Numerics" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.4.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Threading" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.12.0" />
</dependentAssembly>
</assemblyBinding></runtime>
</configuration>

Просмотреть файл

@ -11,20 +11,15 @@
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="Program.fs" />
<None Include="App.config" />
<None Include="paket.references" />
<None Include="removeExternalDlls.fsx" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MomentClosure\MomentClosure\MomentClosure.fsproj" />
<ProjectReference Include="..\..\Oslo\Oslo.FSharp\Oslo.FSharp.fsproj" />
<ProjectReference Include="..\CliLibrary\CliLibrary.fsproj" />
<ProjectReference Include="..\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="Copying Sundials" AfterTargets="AfterBuild" Condition="$(OS) == Windows_NT">
<Exec Command="xcopy /y /q /d &quot;$(ProjectDir)..\x64\$(Configuration)\SundialsSolver15.dll&quot; &quot;$(OutDir)&quot;" />
<Exec Command="xcopy /y /q /d &quot;$(ProjectDir)..\x64\$(Configuration)\SundialsSolver15.pdb&quot; &quot;$(OutDir)&quot;" />

Просмотреть файл

@ -3,7 +3,6 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
@ -15,7 +14,6 @@
<Compile Include="program.fs" />
<Compile Include="testing.fs" />
<None Include="paket.references" />
<Content Include="app.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MomentClosure\MomentClosure\MomentClosure.fsproj" />
@ -23,10 +21,5 @@
<ProjectReference Include="..\CRNEngineCloudLib\CRNEngineCloudLib.fsproj" />
<ProjectReference Include="..\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

Просмотреть файл

@ -1,103 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Dynamitey" publicKeyToken="cbf53ea3aeb972c6" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2.0.10.189" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.7.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.Net.Http.Headers" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2.2.8.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Collections.Concurrent" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.13.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Configuration.ConfigurationManager" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Linq" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.1.1" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Runtime.Numerics" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Security.AccessControl" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.4.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Threading" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.12.0" />
</dependentAssembly>
</assemblyBinding></runtime></configuration>

Просмотреть файл

@ -2,7 +2,6 @@
FSharp.Core
MathNet.Numerics
#FsPickler
FSharpIDD
argu
WebSharper.Core

Просмотреть файл

@ -37,6 +37,8 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "CRNEngineCloudLib", "..\CRN
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ClassicDSDRunAllExamples", "ClassicDSDRunAllExamples\ClassicDSDRunAllExamples.fsproj", "{4984BA62-0817-4D38-A158-513F078B8204}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Oslo.FSharp", "..\Oslo\Oslo.FSharp\Oslo.FSharp.fsproj", "{60A49E43-FB26-4F2F-B71F-BB34695EA47B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -99,6 +101,10 @@ Global
{4984BA62-0817-4D38-A158-513F078B8204}.Debug|x64.Build.0 = Debug|x64
{4984BA62-0817-4D38-A158-513F078B8204}.Release|x64.ActiveCfg = Release|x64
{4984BA62-0817-4D38-A158-513F078B8204}.Release|x64.Build.0 = Release|x64
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Debug|x64.ActiveCfg = Debug|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Debug|x64.Build.0 = Debug|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Release|x64.ActiveCfg = Release|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -32,6 +32,11 @@
<assemblyIdentity name="Dynamitey" publicKeyToken="cbf53ea3aeb972c6" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2.0.10.189" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.CSharp" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />

Просмотреть файл

@ -27,9 +27,6 @@
<ProjectReference Include="..\ClassicDSDDotNet\ClassicDSDDotNet.fsproj" />
<ProjectReference Include="..\..\PDESolvers\ReactionDiffusion\ReactionDiffusion.fsproj" />
<ProjectReference Include="..\..\RulesDSD\RulesDSD\RulesDSD.fsproj" />
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
<ProjectReference Include="..\..\CRNEngine\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
<ProjectReference Include="..\..\Filzbach.FSharp\Filzbach.FSharp.Portable.fsproj" />
<ProjectReference Include="..\..\ParserCombinators\ParserCombinators\ParserCombinators.fsproj" />

Просмотреть файл

@ -63,9 +63,6 @@
<ItemGroup>
<ProjectReference Include="..\..\PDESolvers\ReactionDiffusion\ReactionDiffusion.fsproj" />
<ProjectReference Include="..\..\RulesDSD\RulesDSD\RulesDSD.fsproj" />
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
<ProjectReference Include="..\..\CRNEngine\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
<ProjectReference Include="..\..\Filzbach.FSharp\Filzbach.FSharp.Portable.fsproj" />
<ProjectReference Include="..\..\ParserCombinators\ParserCombinators\ParserCombinators.fsproj" />

Просмотреть файл

@ -52,6 +52,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenericComponents", "..\HTM
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "CRNIntegrationTestLib", "..\CRNEngine\CRNIntegrationTestLib\CRNIntegrationTestLib.fsproj", "{63622E87-2572-4C3B-A6F1-1C5142C301AF}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Oslo.FSharp.WebSharper", "..\Oslo\Oslo.FSharp.WebSharper\Oslo.FSharp.WebSharper.fsproj", "{C873802D-E33F-4E84-844A-C21DC3B7788D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -218,6 +220,10 @@ Global
{63622E87-2572-4C3B-A6F1-1C5142C301AF}.Release|Any CPU.Build.0 = Release|Any CPU
{63622E87-2572-4C3B-A6F1-1C5142C301AF}.Release|x64.ActiveCfg = Release|Any CPU
{63622E87-2572-4C3B-A6F1-1C5142C301AF}.Release|x64.Build.0 = Release|Any CPU
{C873802D-E33F-4E84-844A-C21DC3B7788D}.Debug|x64.ActiveCfg = Debug|Any CPU
{C873802D-E33F-4E84-844A-C21DC3B7788D}.Debug|x64.Build.0 = Debug|Any CPU
{C873802D-E33F-4E84-844A-C21DC3B7788D}.Release|x64.ActiveCfg = Release|Any CPU
{C873802D-E33F-4E84-844A-C21DC3B7788D}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -322,6 +322,11 @@
<assemblyIdentity name="Microsoft.AspNetCore.DataProtection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.CSharp" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.Extensions.Caching.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />

Просмотреть файл

@ -18,9 +18,6 @@
<ItemGroup>
<ProjectReference Include="..\..\CRNEngine\CRNIntegrationTestLib\CRNIntegrationTestLib.fsproj" />
<ProjectReference Include="..\ClassicDSDServer\ClassicDSDServer.fsproj" />
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="AfterBuildFAKE" AfterTargets="AfterBuild">
<Message Importance="high" Text="Running FAKE target Build" />

Просмотреть файл

@ -162,9 +162,6 @@
<ItemGroup>
<ProjectReference Include="..\..\PDESolvers\ReactionDiffusionJS\ReactionDiffusionJS.fsproj" />
<ProjectReference Include="..\..\RulesDSD\RulesDSDJS\RulesDSDJS.fsproj" />
<Reference Include="Oslo.FSharp.WebSharper">
<HintPath>..\..\Lib\Oslo-FSharp.websharper\Oslo.FSharp.WebSharper.dll</HintPath>
</Reference>
<ProjectReference Include="..\..\CRNEngine\CRNEngineJS\CRNEngineJS.fsproj" />
<ProjectReference Include="..\..\Filzbach.FSharp.JS\Filzbach.FSharp.JS.fsproj" />
<ProjectReference Include="..\..\ParserCombinators\ParserCombinatorsJS\ParserCombinatorsJS.fsproj" />

Просмотреть файл

@ -16,11 +16,6 @@
<ProjectReference Include="..\..\CRNEngine\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
<ProjectReference Include="..\ClassicDSDDotNet\ClassicDSDDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="Copying Sundials" AfterTargets="AfterBuild" Condition="$(OS) == Windows_NT">
<Exec Command="xcopy /y /q /d &quot;$(ProjectDir)..\x64\$(Configuration)\SundialsSolver15.dll&quot; &quot;$(OutDir)&quot;" />
<Exec Command="xcopy /y /q /d &quot;$(ProjectDir)..\x64\$(Configuration)\SundialsSolver15.pdb&quot; &quot;$(OutDir)&quot;" />

Просмотреть файл

@ -67,6 +67,8 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "CRNEngineCloudLib", "..\CRN
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "StabilityZ3", "..\StabilityZ3\StabilityZ3\StabilityZ3.fsproj", "{D6C2B8E2-573C-42BC-A8AD-111785F864D9}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Oslo.FSharp", "..\Oslo\Oslo.FSharp\Oslo.FSharp.fsproj", "{60A49E43-FB26-4F2F-B71F-BB34695EA47B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -189,6 +191,10 @@ Global
{D6C2B8E2-573C-42BC-A8AD-111785F864D9}.Debug|x64.Build.0 = Debug|Any CPU
{D6C2B8E2-573C-42BC-A8AD-111785F864D9}.Release|x64.ActiveCfg = Release|Any CPU
{D6C2B8E2-573C-42BC-A8AD-111785F864D9}.Release|x64.Build.0 = Release|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Debug|x64.ActiveCfg = Debug|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Debug|x64.Build.0 = Debug|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Release|x64.ActiveCfg = Release|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -307,6 +307,11 @@
<assemblyIdentity name="Microsoft.AspNetCore.DataProtection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.CSharp" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.Extensions.Caching.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />

Просмотреть файл

@ -28,9 +28,6 @@
<ProjectReference Include="..\..\PDESolvers\ReactionDiffusion\ReactionDiffusion.fsproj" />
<ProjectReference Include="..\..\RulesDSD\RulesDSD\RulesDSD.fsproj" />
<ProjectReference Include="..\ClassicDSDHTML5\ClassicDSDHTML5.csproj" />
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
<ProjectReference Include="..\..\CRNEngine\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
<ProjectReference Include="..\..\Filzbach.FSharp\Filzbach.FSharp.Portable.fsproj" />
<ProjectReference Include="..\..\ParserCombinators\ParserCombinators\ParserCombinators.fsproj" />

Просмотреть файл

@ -37,9 +37,6 @@
<ProjectReference Include="..\ClassicDSDDotNet\ClassicDSDDotNet.fsproj" />
<ProjectReference Include="..\..\PDESolvers\ReactionDiffusion\ReactionDiffusion.fsproj" />
<ProjectReference Include="..\..\RulesDSD\RulesDSD\RulesDSD.fsproj" />
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
<ProjectReference Include="..\..\CRNEngine\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
<ProjectReference Include="..\..\Filzbach.FSharp\Filzbach.FSharp.Portable.fsproj" />
<ProjectReference Include="..\..\ParserCombinators\ParserCombinators\ParserCombinators.fsproj" />

Просмотреть файл

@ -15,6 +15,11 @@
<assemblyIdentity name="Dynamitey" publicKeyToken="cbf53ea3aeb972c6" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2.0.10.189" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.CSharp" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />

Просмотреть файл

@ -18,11 +18,6 @@
<ProjectReference Include="..\..\CRNEngine\CliLibrary\CliLibrary.fsproj" />
<ProjectReference Include="..\ClassicGECDotNet\ClassicGECDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

Просмотреть файл

@ -38,6 +38,10 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ClassicGECTests", "ClassicG
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "RulesDSD", "..\RulesDSD\RulesDSD\RulesDSD.fsproj", "{22DF9340-8F96-4FBE-8001-675E2E55CB54}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "StabilityZ3", "..\StabilityZ3\StabilityZ3\StabilityZ3.fsproj", "{067C2D8F-219E-4D5B-AEFA-1A59C64E2E1F}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Oslo.FSharp", "..\Oslo\Oslo.FSharp\Oslo.FSharp.fsproj", "{60A49E43-FB26-4F2F-B71F-BB34695EA47B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -108,6 +112,14 @@ Global
{22DF9340-8F96-4FBE-8001-675E2E55CB54}.Debug|x64.Build.0 = Debug|x64
{22DF9340-8F96-4FBE-8001-675E2E55CB54}.Release|x64.ActiveCfg = Release|x64
{22DF9340-8F96-4FBE-8001-675E2E55CB54}.Release|x64.Build.0 = Release|x64
{067C2D8F-219E-4D5B-AEFA-1A59C64E2E1F}.Debug|x64.ActiveCfg = Debug|Any CPU
{067C2D8F-219E-4D5B-AEFA-1A59C64E2E1F}.Debug|x64.Build.0 = Debug|Any CPU
{067C2D8F-219E-4D5B-AEFA-1A59C64E2E1F}.Release|x64.ActiveCfg = Release|Any CPU
{067C2D8F-219E-4D5B-AEFA-1A59C64E2E1F}.Release|x64.Build.0 = Release|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Debug|x64.ActiveCfg = Debug|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Debug|x64.Build.0 = Debug|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Release|x64.ActiveCfg = Release|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -45,10 +45,5 @@
<ProjectReference Include="..\..\PDESolvers\ReactionDiffusion\ReactionDiffusion.fsproj" />
<ProjectReference Include="..\..\RulesDSD\RulesDSD\RulesDSD.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

Просмотреть файл

@ -19,10 +19,5 @@
<ItemGroup>
<ProjectReference Include="..\ClassicGECDotNet\ClassicGECDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

Просмотреть файл

@ -54,6 +54,8 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "CRNIntegrationTestLib", "..
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "RulesDSDJS", "..\RulesDSD\RulesDSDJS\RulesDSDJS.fsproj", "{1203D047-DFC7-4F75-B232-F5F1479DF687}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Oslo.FSharp.WebSharper", "..\Oslo\Oslo.FSharp.WebSharper\Oslo.FSharp.WebSharper.fsproj", "{C873802D-E33F-4E84-844A-C21DC3B7788D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -217,6 +219,10 @@ Global
{1203D047-DFC7-4F75-B232-F5F1479DF687}.Release|Any CPU.Build.0 = Release|Any CPU
{1203D047-DFC7-4F75-B232-F5F1479DF687}.Release|x64.ActiveCfg = Release|Any CPU
{1203D047-DFC7-4F75-B232-F5F1479DF687}.Release|x64.Build.0 = Release|Any CPU
{C873802D-E33F-4E84-844A-C21DC3B7788D}.Debug|x64.ActiveCfg = Debug|Any CPU
{C873802D-E33F-4E84-844A-C21DC3B7788D}.Debug|x64.Build.0 = Debug|Any CPU
{C873802D-E33F-4E84-844A-C21DC3B7788D}.Release|x64.ActiveCfg = Release|Any CPU
{C873802D-E33F-4E84-844A-C21DC3B7788D}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -17,9 +17,6 @@
<ItemGroup>
<ProjectReference Include="..\..\CRNEngine\CRNIntegrationTestLib\CRNIntegrationTestLib.fsproj" />
<ProjectReference Include="..\ClassicGECWebServer\ClassicGECWebServer.fsproj" />
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="AfterBuildFAKE" AfterTargets="AfterBuild">
<Message Importance="high" Text="Running FAKE target Build" />

Просмотреть файл

@ -102,10 +102,5 @@
<ProjectReference Include="..\..\ParserCombinators\ParserCombinatorsJS\ParserCombinatorsJS.fsproj" />
<ProjectReference Include="..\..\RulesDSD\RulesDSDJS\RulesDSDJS.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp.WebSharper">
<HintPath>..\..\Lib\Oslo-FSharp.websharper\Oslo.FSharp.WebSharper.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

Просмотреть файл

@ -16,11 +16,6 @@
<ProjectReference Include="..\..\CRNEngine\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
<ProjectReference Include="..\ClassicGECDotNet\ClassicGECDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="Copying Sundials" AfterTargets="AfterBuild" Condition="$(OS) == Windows_NT">
<Exec Command="xcopy /y /q /d &quot;$(ProjectDir)..\x64\$(Configuration)\SundialsSolver15.dll&quot; &quot;$(OutDir)&quot;" />
<Exec Command="xcopy /y /q /d &quot;$(ProjectDir)..\x64\$(Configuration)\SundialsSolver15.pdb&quot; &quot;$(OutDir)&quot;" />

Просмотреть файл

@ -65,6 +65,8 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "RulesDSD", "..\RulesDSD\Rul
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "StabilityZ3", "..\StabilityZ3\StabilityZ3\StabilityZ3.fsproj", "{A7F6C30E-8925-4A2F-BC4C-7C2560809609}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Oslo.FSharp", "..\Oslo\Oslo.FSharp\Oslo.FSharp.fsproj", "{60A49E43-FB26-4F2F-B71F-BB34695EA47B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -183,6 +185,10 @@ Global
{A7F6C30E-8925-4A2F-BC4C-7C2560809609}.Debug|x64.Build.0 = Debug|Any CPU
{A7F6C30E-8925-4A2F-BC4C-7C2560809609}.Release|x64.ActiveCfg = Release|Any CPU
{A7F6C30E-8925-4A2F-BC4C-7C2560809609}.Release|x64.Build.0 = Release|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Debug|x64.ActiveCfg = Debug|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Debug|x64.Build.0 = Debug|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Release|x64.ActiveCfg = Release|Any CPU
{60A49E43-FB26-4F2F-B71F-BB34695EA47B}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -21,11 +21,6 @@
<ProjectReference Include="..\..\RulesDSD\RulesDSD\RulesDSD.fsproj" />
<ProjectReference Include="..\ClassicGECDotNet\ClassicGECDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<!--
<Target Name="Copying Sundials" AfterTargets="AfterBuild" Condition="$(OS) == Windows_NT">
<Exec Command="xcopy /y /q /d &quot;$(SolutionDir)x64\$(Configuration)\SundialsSolver15.dll&quot; &quot;$(OutDir)&quot;" />

Просмотреть файл

@ -305,6 +305,11 @@
<assemblyIdentity name="Microsoft.AspNetCore.DataProtection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.CSharp" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.5.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Microsoft.Extensions.Caching.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />

Просмотреть файл

@ -28,9 +28,6 @@
<ProjectReference Include="..\..\PDESolvers\ReactionDiffusion\ReactionDiffusion.fsproj" />
<ProjectReference Include="..\ClassicGECDotNet\ClassicGECDotNet.fsproj" />
<ProjectReference Include="..\ClassicGECHTML5\ClassicGECHTML5.csproj" />
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="AfterBuildFAKE" AfterTargets="AfterBuild">
<Message Importance="high" Text="Running FAKE target Build" />

Просмотреть файл

@ -15,10 +15,5 @@
<Compile Include="..\FSBOLWrapper\gecHelper.fs" Link="gecHelper.fs" />
<None Include="paket.references" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp.WebSharper">
<HintPath>..\..\Lib\Oslo-FSharp.websharper\Oslo.FSharp.WebSharper.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

Просмотреть файл

@ -1,175 +0,0 @@
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.0/",
"signature": "12ce3cc4f69a2ba4e974963ad25bfdc95587cf3f"
},
"compilationOptions": {},
"targets": {
".NETStandard,Version=v2.0": {},
".NETStandard,Version=v2.0/": {
"Oslo.FSharp.WebSharper/1.0.0": {
"dependencies": {
"FSharp.Core": "4.5.4",
"NETStandard.Library": "2.0.3",
"WebSharper": "4.5.9.330",
"WebSharper.FSharp": "4.5.9.330"
},
"runtime": {
"Oslo.FSharp.WebSharper.dll": {}
}
},
"FSharp.Core/4.5.4": {
"runtime": {
"lib/netstandard1.6/FSharp.Core.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "2018.11.27.2"
}
},
"resources": {
"lib/netstandard1.6/cs/FSharp.Core.resources.dll": {
"locale": "cs"
},
"lib/netstandard1.6/de/FSharp.Core.resources.dll": {
"locale": "de"
},
"lib/netstandard1.6/en/FSharp.Core.resources.dll": {
"locale": "en"
},
"lib/netstandard1.6/es/FSharp.Core.resources.dll": {
"locale": "es"
},
"lib/netstandard1.6/fr/FSharp.Core.resources.dll": {
"locale": "fr"
},
"lib/netstandard1.6/it/FSharp.Core.resources.dll": {
"locale": "it"
},
"lib/netstandard1.6/ja/FSharp.Core.resources.dll": {
"locale": "ja"
},
"lib/netstandard1.6/ko/FSharp.Core.resources.dll": {
"locale": "ko"
},
"lib/netstandard1.6/pl/FSharp.Core.resources.dll": {
"locale": "pl"
},
"lib/netstandard1.6/pt-BR/FSharp.Core.resources.dll": {
"locale": "pt-BR"
},
"lib/netstandard1.6/ru/FSharp.Core.resources.dll": {
"locale": "ru"
},
"lib/netstandard1.6/tr/FSharp.Core.resources.dll": {
"locale": "tr"
},
"lib/netstandard1.6/zh-Hans/FSharp.Core.resources.dll": {
"locale": "zh-Hans"
},
"lib/netstandard1.6/zh-Hant/FSharp.Core.resources.dll": {
"locale": "zh-Hant"
}
}
},
"Microsoft.NETCore.Platforms/1.1.0": {},
"NETStandard.Library/2.0.3": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
},
"WebSharper/4.5.9.330": {
"dependencies": {
"FSharp.Core": "4.5.4"
},
"runtime": {
"lib/netstandard2.0/WebSharper.Collections.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "4.5.9.330"
},
"lib/netstandard2.0/WebSharper.Control.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "4.5.9.330"
},
"lib/netstandard2.0/WebSharper.Core.JavaScript.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "4.5.9.330"
},
"lib/netstandard2.0/WebSharper.Core.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "4.5.9.330"
},
"lib/netstandard2.0/WebSharper.InterfaceGenerator.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "4.5.9.330"
},
"lib/netstandard2.0/WebSharper.JQuery.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "0.0.0.0"
},
"lib/netstandard2.0/WebSharper.JavaScript.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "0.0.0.0"
},
"lib/netstandard2.0/WebSharper.Main.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "4.5.9.330"
},
"lib/netstandard2.0/WebSharper.Sitelets.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "4.5.9.330"
},
"lib/netstandard2.0/WebSharper.Web.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "4.5.9.330"
}
}
},
"WebSharper.FSharp/4.5.9.330": {
"dependencies": {
"WebSharper": "4.5.9.330"
}
}
}
},
"libraries": {
"Oslo.FSharp.WebSharper/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"FSharp.Core/4.5.4": {
"type": "package",
"serviceable": true,
"sha512": "sha512-yFLVknoI5dbp2Ugu88s/nl0gCu8ffN3jKoBXlaVQtEss2g3wGu8htQ4ygmp4azNegNKzmnQxRqGKm1uXkUmcvQ==",
"path": "fsharp.core/4.5.4",
"hashPath": "fsharp.core.4.5.4.nupkg.sha512"
},
"Microsoft.NETCore.Platforms/1.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
"path": "microsoft.netcore.platforms/1.1.0",
"hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
},
"NETStandard.Library/2.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ME9gB7rkDIfWCNZVKcFe9oiArZwOh56rc2xMVIo2llp98xwPuiQvebP1yGI8j9qRamRg59HJKFqmxI+qxjHNXw==",
"path": "netstandard.library/2.0.3",
"hashPath": "netstandard.library.2.0.3.nupkg.sha512"
},
"WebSharper/4.5.9.330": {
"type": "package",
"serviceable": true,
"sha512": "sha512-vTyUN+mZac/fIiLZaY4SYd46IPdCz/4xERAjq1QJvdoWruYFP3bXxbmVMdASTBgn9tFHMDNdXjCrOWAwswwDIg==",
"path": "websharper/4.5.9.330",
"hashPath": "websharper.4.5.9.330.nupkg.sha512"
},
"WebSharper.FSharp/4.5.9.330": {
"type": "package",
"serviceable": true,
"sha512": "sha512-FjsPO6T8RdEi5/XCql2d8ACCxFRWdoUmBAsFznNXXprSKvMYz2xVSt6IXuvZMTZ21c4rwhP2P8Rjr5YLJx71NQ==",
"path": "websharper.fsharp/4.5.9.330",
"hashPath": "websharper.fsharp.4.5.9.330.nupkg.sha512"
}
}
}

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -1,3 +0,0 @@
These files are generated from: https://msrcambridge.visualstudio.com/Oslo
Ask Colin or Neil if you need help

Просмотреть файл

@ -1,107 +0,0 @@
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.0/",
"signature": "acd6441527c2532bd467e9f105cfa064a6e0d773"
},
"compilationOptions": {},
"targets": {
".NETStandard,Version=v2.0": {},
".NETStandard,Version=v2.0/": {
"Oslo.FSharp/1.0.0": {
"dependencies": {
"FSharp.Core": "4.5.4",
"NETStandard.Library": "2.0.3"
},
"runtime": {
"Oslo.FSharp.dll": {}
}
},
"FSharp.Core/4.5.4": {
"runtime": {
"lib/netstandard1.6/FSharp.Core.dll": {
"assemblyVersion": "4.5.0.0",
"fileVersion": "2018.11.27.2"
}
},
"resources": {
"lib/netstandard1.6/cs/FSharp.Core.resources.dll": {
"locale": "cs"
},
"lib/netstandard1.6/de/FSharp.Core.resources.dll": {
"locale": "de"
},
"lib/netstandard1.6/en/FSharp.Core.resources.dll": {
"locale": "en"
},
"lib/netstandard1.6/es/FSharp.Core.resources.dll": {
"locale": "es"
},
"lib/netstandard1.6/fr/FSharp.Core.resources.dll": {
"locale": "fr"
},
"lib/netstandard1.6/it/FSharp.Core.resources.dll": {
"locale": "it"
},
"lib/netstandard1.6/ja/FSharp.Core.resources.dll": {
"locale": "ja"
},
"lib/netstandard1.6/ko/FSharp.Core.resources.dll": {
"locale": "ko"
},
"lib/netstandard1.6/pl/FSharp.Core.resources.dll": {
"locale": "pl"
},
"lib/netstandard1.6/pt-BR/FSharp.Core.resources.dll": {
"locale": "pt-BR"
},
"lib/netstandard1.6/ru/FSharp.Core.resources.dll": {
"locale": "ru"
},
"lib/netstandard1.6/tr/FSharp.Core.resources.dll": {
"locale": "tr"
},
"lib/netstandard1.6/zh-Hans/FSharp.Core.resources.dll": {
"locale": "zh-Hans"
},
"lib/netstandard1.6/zh-Hant/FSharp.Core.resources.dll": {
"locale": "zh-Hant"
}
}
},
"Microsoft.NETCore.Platforms/1.1.0": {},
"NETStandard.Library/2.0.3": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
}
}
},
"libraries": {
"Oslo.FSharp/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"FSharp.Core/4.5.4": {
"type": "package",
"serviceable": true,
"sha512": "sha512-yFLVknoI5dbp2Ugu88s/nl0gCu8ffN3jKoBXlaVQtEss2g3wGu8htQ4ygmp4azNegNKzmnQxRqGKm1uXkUmcvQ==",
"path": "fsharp.core/4.5.4",
"hashPath": "fsharp.core.4.5.4.nupkg.sha512"
},
"Microsoft.NETCore.Platforms/1.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
"path": "microsoft.netcore.platforms/1.1.0",
"hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
},
"NETStandard.Library/2.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ME9gB7rkDIfWCNZVKcFe9oiArZwOh56rc2xMVIo2llp98xwPuiQvebP1yGI8j9qRamRg59HJKFqmxI+qxjHNXw==",
"path": "netstandard.library/2.0.3",
"hashPath": "netstandard.library.2.0.3.nupkg.sha512"
}
}
}

Двоичные данные
Lib/Oslo.FSharp/Oslo.FSharp.dll

Двоичный файл не отображается.

Двоичные данные
Lib/Oslo.FSharp/Oslo.FSharp.pdb

Двоичный файл не отображается.

Просмотреть файл

@ -1,3 +0,0 @@
These files are generated from: https://msrcambridge.visualstudio.com/Oslo
Ask Colin or Neil if you need help

Просмотреть файл

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.7.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Runtime.Numerics" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="System.Threading" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.0.12.0" />
</dependentAssembly>
</assemblyBinding></runtime></configuration>

Просмотреть файл

@ -2,23 +2,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="moments.fs" />
<Compile Include="mc_utils.fs" />
<None Include="App.config" />
<None Include="paket.references" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\CRNEngine\CRNEngineDotNet\CRNEngineDotNet.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Oslo.FSharp">
<HintPath>..\..\Lib\Oslo.FSharp\Oslo.FSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

Просмотреть файл

@ -1,13 +1,5 @@
group NETSTANDARD
#FsCheck
#FsUnit.xUnit
# argu
#xunit.core
#xunit.runner.console
#xunit.runner.visualstudio
FParsec
FSharp.Core
# MathNet.Numerics
# MathNet.Numerics.FSharp
MathNet.Symbolics

Просмотреть файл

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.7.0.0" />
</dependentAssembly>
</assemblyBinding></runtime></configuration>

Просмотреть файл

@ -0,0 +1,754 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo.FSharp
open Oslo
open Oslo.GearBDF
open System
[<JavaScript>]
module GearSamples =
let private mkVec1 x =
let v = Vector.zeros 1
v.[0] <- x
v
let Exponent t0 t1 =
let t0 = 0.0
let x0 = mkVec1 1000.0
let f (t: double) (x: Vector) : Vector = mkVec1 (-0.01 * x.[0])
let gear = init t0 x0 f { defaults() with MaxStep = 5.0 }
let rec solve (gear : state, t1) =
let gear2 = advance gear
if gear2.t > t1
then []
else (gear2.t, gear2.x.[0]) :: solve(gear2, t1)
let points = (gear.t, gear.x.[0]) :: solve(gear,t1)
let res = (points |> List.map (fun (t,_) -> t) |> List.toArray,
points |> List.map (fun (_,x) -> x) |> List.toArray,
points |> List.map (fun (t,_) -> 1000.0 * Math.Exp(-0.01 * t)) |> List.toArray)
res
let Trigonometric t0 t1 =
let t0 = 0.0
let x0 = mkVec1 1.0
let f (t: double) (x: Vector) = mkVec1 (- sin t)
let gear = init t0 x0 f { defaults() with MaxStep = 0.1 }
let rec solve (gear : state, t1) =
let gear2 = advance gear
if gear2.t > t1
then []
else (gear2.t, gear2.x.[0]) :: solve(gear2, t1)
let points = (gear.t, gear.x.[0]) :: solve(gear,t1)
let res = (points |> List.map (fun (t,_) -> t) |> List.toArray, points |> List.map (fun (_,x) -> x) |> List.toArray)
res
let private mkVec3 a b c =
let v = Vector.zeros 3
v.[0] <- a
v.[1] <- b
v.[2] <- c
v
// Solves Oreginator dynamic system on time segment [t0,t1]
//
// dy[0] / dt = 77.27d * (y[1] + y[0] * (1 - 8.375d * 1e-6d * y[0] - y[1])),
// dy[1] / dt = 1 / 77.27d * (y[2] - (1 + y[0]) * y[1]),
// dy[2] / dt = 0.161d * (y[0] - y[2])
//
// Returns tuple with four 1D arrays: t,x1,x2,x3
// Note: this sample uses recursion that is not translated well by WebSharper 2.4
// Large time intervals may cause stack overflows
let Oregonator t0 t1 =
let x0 = mkVec3 0.001 0.004 0.0002 // Initial point
let f (t:double) (x: Vector) = // Oreginator's right part
mkVec3
(77.27 * (x.[1] + x.[0] * (1.0 - 8.375 * 1e-6 * x.[0] - x.[1])))
(1.0 / 77.27 * (x.[2] - (1.0 + x.[0]) * x.[1]))
(0.161 * (x.[0] - x.[2]))
let gear = init t0 x0 f { defaults() with MaxStep = (t1 - t0) * 0.01 }
let rec solve (gear : state, t1) =
let gear2 = advance gear
if gear2.t > t1
then []
else (gear2.t, gear2.x.[0], gear2.x.[1], gear2.x.[2]) :: solve(gear2, t1)
let points = (gear.t, gear.x.[0], gear.x.[1], gear.x.[2]) :: solve(gear,t1)
(points |> List.map (fun (t,_,_,_) -> t) |> List.toArray,
points |> List.map (fun (_,x1,_,_) -> x1) |> List.toArray,
points |> List.map (fun (_,_,x2,_) -> x2) |> List.toArray,
points |> List.map (fun (_,_,_,x3) -> x3) |> List.toArray)
let private setVec (v: Vector) (i: int) (d: double) =
v.[i] <- d
let oscillating_ics =
let n = 187
let x0 = Vector.zeros n
setVec x0 1 1.0
setVec x0 2 100.0
setVec x0 3 100.0
setVec x0 4 100.0
setVec x0 5 100.0
setVec x0 6 100.0
setVec x0 7 100.0
setVec x0 8 100.0
setVec x0 14 1.0
setVec x0 15 100.0
setVec x0 16 100.0
setVec x0 17 100.0
setVec x0 18 100.0
setVec x0 19 100.0
setVec x0 20 100.0
setVec x0 21 100.0
setVec x0 27 1.0
setVec x0 28 100.0
setVec x0 29 100.0
setVec x0 30 100.0
setVec x0 31 100.0
setVec x0 32 100.0
setVec x0 33 100.0
setVec x0 34 100.0
setVec x0 40 2.0
setVec x0 44 2.0
setVec x0 76 3.0
x0
let oscillating_derivs (t: double) (x: Vector) : Vector =
// Assign states (concentrations)
let IGNORE = x.[0]
let BJ2x2_23 = x.[1]
let BJ2x2_22 = x.[2]
let BJ2x2_21 = x.[3]
let BJ2x2_20 = x.[4]
let BJ2x2_19 = x.[5]
let BJ2x2_18 = x.[6]
let BJ2x2_17 = x.[7]
let BJ2x2_16 = x.[8]
let sp_3 = x.[9]
let sp_5 = x.[10]
let sp_4 = x.[11]
let sp_7 = x.[12]
let sp_6 = x.[13]
let BJ2x2_15 = x.[14]
let BJ2x2_14 = x.[15]
let BJ2x2_13 = x.[16]
let BJ2x2_12 = x.[17]
let BJ2x2_11 = x.[18]
let BJ2x2_10 = x.[19]
let BJ2x2_9 = x.[20]
let BJ2x2_8 = x.[21]
let sp_8 = x.[22]
let sp_10 = x.[23]
let sp_9 = x.[24]
let sp_12 = x.[25]
let sp_11 = x.[26]
let BJ2x2_7 = x.[27]
let BJ2x2_6 = x.[28]
let BJ2x2_5 = x.[29]
let BJ2x2_4 = x.[30]
let BJ2x2_3 = x.[31]
let BJ2x2_2 = x.[32]
let BJ2x2_1 = x.[33]
let BJ2x2 = x.[34]
let sp_13 = x.[35]
let sp_15 = x.[36]
let sp_14 = x.[37]
let sp_17 = x.[38]
let sp_16 = x.[39]
let sp_2 = x.[40]
let sp_18 = x.[41]
let sp_20 = x.[42]
let sp_19 = x.[43]
let sp_1 = x.[44]
let sp_21 = x.[45]
let sp_23 = x.[46]
let sp_24 = x.[47]
let sp_26 = x.[48]
let sp_29 = x.[49]
let sp_28 = x.[50]
let sp_31 = x.[51]
let sp_32 = x.[52]
let sp_30 = x.[53]
let sp_33 = x.[54]
let sp_34 = x.[55]
let sp_27 = x.[56]
let sp_36 = x.[57]
let sp_37 = x.[58]
let sp_35 = x.[59]
let sp_38 = x.[60]
let sp_39 = x.[61]
let sp_25 = x.[62]
let sp_40 = x.[63]
let sp_42 = x.[64]
let sp_43 = x.[65]
let sp_45 = x.[66]
let sp_44 = x.[67]
let sp_47 = x.[68]
let sp_46 = x.[69]
let sp_41 = x.[70]
let sp_49 = x.[71]
let sp_48 = x.[72]
let sp_22 = x.[73]
let sp_51 = x.[74]
let sp_50 = x.[75]
let sp_0 = x.[76]
let sp_55 = x.[77]
let sp_57 = x.[78]
let sp_58 = x.[79]
let sp_60 = x.[80]
let sp_63 = x.[81]
let sp_62 = x.[82]
let sp_65 = x.[83]
let sp_66 = x.[84]
let sp_69 = x.[85]
let sp_70 = x.[86]
let sp_71 = x.[87]
let sp_68 = x.[88]
let sp_72 = x.[89]
let sp_73 = x.[90]
let sp_67 = x.[91]
let sp_74 = x.[92]
let sp_75 = x.[93]
let sp_64 = x.[94]
let sp_76 = x.[95]
let sp_77 = x.[96]
let sp_61 = x.[97]
let sp_79 = x.[98]
let sp_80 = x.[99]
let sp_83 = x.[100]
let sp_84 = x.[101]
let sp_85 = x.[102]
let sp_82 = x.[103]
let sp_86 = x.[104]
let sp_87 = x.[105]
let sp_81 = x.[106]
let sp_88 = x.[107]
let sp_89 = x.[108]
let sp_78 = x.[109]
let sp_90 = x.[110]
let sp_91 = x.[111]
let sp_59 = x.[112]
let sp_92 = x.[113]
let sp_94 = x.[114]
let sp_95 = x.[115]
let sp_97 = x.[116]
let sp_96 = x.[117]
let sp_99 = x.[118]
let sp_98 = x.[119]
let sp_93 = x.[120]
let sp_100 = x.[121]
let sp_56 = x.[122]
let sp_102 = x.[123]
let sp_101 = x.[124]
let sp_54 = x.[125]
let sp_104 = x.[126]
let sp_107 = x.[127]
let sp_106 = x.[128]
let sp_111 = x.[129]
let sp_112 = x.[130]
let sp_115 = x.[131]
let sp_116 = x.[132]
let sp_117 = x.[133]
let sp_114 = x.[134]
let sp_118 = x.[135]
let sp_119 = x.[136]
let sp_113 = x.[137]
let sp_120 = x.[138]
let sp_121 = x.[139]
let sp_110 = x.[140]
let sp_122 = x.[141]
let sp_123 = x.[142]
let sp_105 = x.[143]
let sp_127 = x.[144]
let sp_128 = x.[145]
let sp_131 = x.[146]
let sp_132 = x.[147]
let sp_133 = x.[148]
let sp_130 = x.[149]
let sp_134 = x.[150]
let sp_135 = x.[151]
let sp_129 = x.[152]
let sp_136 = x.[153]
let sp_137 = x.[154]
let sp_126 = x.[155]
let sp_138 = x.[156]
let sp_139 = x.[157]
let sp_103 = x.[158]
let sp_140 = x.[159]
let sp_142 = x.[160]
let sp_143 = x.[161]
let sp_145 = x.[162]
let sp_146 = x.[163]
let sp_144 = x.[164]
let sp_148 = x.[165]
let sp_147 = x.[166]
let sp_141 = x.[167]
let sp_149 = x.[168]
let sp_125 = x.[169]
let sp_150 = x.[170]
let sp_151 = x.[171]
let sp_124 = x.[172]
let sp_152 = x.[173]
let sp_153 = x.[174]
let sp_109 = x.[175]
let sp_154 = x.[176]
let sp_155 = x.[177]
let sp_108 = x.[178]
let sp_156 = x.[179]
let sp_157 = x.[180]
let sp_53 = x.[181]
let sp_158 = x.[182]
let sp_159 = x.[183]
let sp_52 = x.[184]
let sp_160 = x.[185]
let sp_161 = x.[186]
// Write out the reaction propensities
let r_0 = 0.0003 * BJ2x2_17 * sp_160
let r_1 = 0.0003 * sp_103 * sp_160
let r_2 = 0.1126 * sp_52
let r_3 = 0.1126 * sp_52
let r_4 = 0.0003 * BJ2x2_17 * sp_158
let r_5 = 0.0003 * sp_103 * sp_158
let r_6 = 0.1126 * sp_53
let r_7 = 0.1126 * sp_53
let r_8 = 0.0003 * BJ2x2_17 * sp_156
let r_9 = 0.0003 * sp_103 * sp_156
let r_10 = 0.1126 * sp_108
let r_11 = 0.1126 * sp_108
let r_12 = 0.0003 * BJ2x2_17 * sp_154
let r_13 = 0.0003 * sp_103 * sp_154
let r_14 = 0.1126 * sp_109
let r_15 = 0.1126 * sp_109
let r_16 = 0.0003 * BJ2x2_17 * sp_152
let r_17 = 0.0003 * sp_103 * sp_152
let r_18 = 0.1126 * sp_124
let r_19 = 0.1126 * sp_124
let r_20 = 0.0003 * BJ2x2_17 * sp_150
let r_21 = 0.0003 * sp_103 * sp_150
let r_22 = 0.1126 * sp_125
let r_23 = 0.1126 * sp_125
let r_24 = 0.0003 * sp_141 * BJ2x2_21
let r_25 = 0.0003 * sp_141 * sp_142
let r_26 = 0.0003 * sp_144 * BJ2x2_22
let r_27 = 0.0003 * sp_144 * sp_145
let r_28 = 0.0003 * sp_19 * sp_145
let r_29 = 0.1126 * sp_143
let r_30 = 0.1126 * sp_143
let r_31 = 0.0003 * BJ2x2_20 * sp_142
let r_32 = 0.1126 * sp_140
let r_33 = 0.1126 * sp_140
let r_34 = 0.0003 * sp_103 * BJ2x2_19
let r_35 = 0.0003 * sp_103 * sp_104
let r_36 = 0.0003 * sp_103 * sp_122
let r_37 = 0.0003 * sp_103 * sp_138
let r_38 = 0.0003 * BJ2x2_17 * sp_138
let r_39 = 0.1126 * sp_126
let r_40 = 0.1126 * sp_126
let r_41 = 0.0003 * BJ2x2_1 * sp_136
let r_42 = 0.0003 * sp_59 * sp_136
let r_43 = 0.1126 * sp_129
let r_44 = 0.1126 * sp_129
let r_45 = 0.0003 * BJ2x2_1 * sp_134
let r_46 = 0.0003 * sp_59 * sp_134
let r_47 = 0.1126 * sp_130
let r_48 = 0.1126 * sp_130
let r_49 = 0.0003 * BJ2x2_1 * sp_132
let r_50 = 0.0003 * sp_59 * sp_132
let r_51 = 0.1126 * sp_131
let r_52 = 0.1126 * sp_131
let r_53 = 0.0003 * sp_1 * sp_128
let r_54 = 0.0003 * sp_62 * sp_128
let r_55 = 0.0003 * sp_61 * sp_128
let r_56 = 0.0003 * sp_56 * sp_128
let r_57 = 0.1126 * sp_127
let r_58 = 0.1126 * sp_127
let r_59 = 0.0003 * sp_105 * sp_15
let r_60 = 0.0003 * sp_105 * sp_20
let r_61 = 0.0003 * sp_105 * sp_32
let r_62 = 0.0003 * sp_105 * sp_37
let r_63 = 0.0003 * BJ2x2_17 * sp_122
let r_64 = 0.1126 * sp_110
let r_65 = 0.1126 * sp_110
let r_66 = 0.0003 * BJ2x2_1 * sp_120
let r_67 = 0.0003 * sp_59 * sp_120
let r_68 = 0.1126 * sp_113
let r_69 = 0.1126 * sp_113
let r_70 = 0.0003 * BJ2x2_1 * sp_118
let r_71 = 0.0003 * sp_59 * sp_118
let r_72 = 0.1126 * sp_114
let r_73 = 0.1126 * sp_114
let r_74 = 0.0003 * BJ2x2_1 * sp_116
let r_75 = 0.0003 * sp_59 * sp_116
let r_76 = 0.1126 * sp_115
let r_77 = 0.1126 * sp_115
let r_78 = 0.0003 * sp_1 * sp_112
let r_79 = 0.0003 * sp_62 * sp_112
let r_80 = 0.0003 * sp_61 * sp_112
let r_81 = 0.0003 * sp_56 * sp_112
let r_82 = 0.1126 * sp_111
let r_83 = 0.1126 * sp_111
let r_84 = 0.0003 * sp_106 * sp_15
let r_85 = 0.0003 * sp_106 * sp_20
let r_86 = 0.0003 * sp_106 * sp_32
let r_87 = 0.0003 * sp_106 * sp_37
let r_88 = 0.0003 * BJ2x2_17 * sp_104
let r_89 = 0.1126 * sp_54
let r_90 = 0.1126 * sp_54
let r_91 = 0.0003 * sp_56 * sp_57
let r_92 = 0.0003 * sp_56 * sp_97
let r_93 = 0.0003 * sp_93 * BJ2x2_5
let r_94 = 0.0003 * sp_93 * sp_94
let r_95 = 0.0003 * sp_96 * BJ2x2_6
let r_96 = 0.0003 * sp_96 * sp_97
let r_97 = 0.1126 * sp_95
let r_98 = 0.1126 * sp_95
let r_99 = 0.0003 * BJ2x2_4 * sp_94
let r_100 = 0.1126 * sp_92
let r_101 = 0.1126 * sp_92
let r_102 = 0.0003 * sp_59 * BJ2x2_3
let r_103 = 0.0003 * sp_59 * sp_60
let r_104 = 0.0003 * sp_59 * sp_76
let r_105 = 0.0003 * sp_59 * sp_90
let r_106 = 0.0003 * BJ2x2_1 * sp_90
let r_107 = 0.1126 * sp_78
let r_108 = 0.1126 * sp_78
let r_109 = 0.0003 * BJ2x2_9 * sp_88
let r_110 = 0.0003 * sp_25 * sp_88
let r_111 = 0.1126 * sp_81
let r_112 = 0.1126 * sp_81
let r_113 = 0.0003 * BJ2x2_9 * sp_86
let r_114 = 0.0003 * sp_25 * sp_86
let r_115 = 0.1126 * sp_82
let r_116 = 0.1126 * sp_82
let r_117 = 0.0003 * BJ2x2_9 * sp_84
let r_118 = 0.0003 * sp_25 * sp_84
let r_119 = 0.1126 * sp_83
let r_120 = 0.1126 * sp_83
let r_121 = 0.0003 * sp_2 * sp_80
let r_122 = 0.0003 * sp_28 * sp_80
let r_123 = 0.0003 * sp_27 * sp_80
let r_124 = 0.0003 * sp_22 * sp_80
let r_125 = 0.1126 * sp_79
let r_126 = 0.1126 * sp_79
let r_127 = 0.0003 * sp_61 * sp_10
let r_128 = 0.0003 * sp_61 * sp_57
let r_129 = 0.0003 * BJ2x2_1 * sp_76
let r_130 = 0.1126 * sp_64
let r_131 = 0.1126 * sp_64
let r_132 = 0.0003 * BJ2x2_9 * sp_74
let r_133 = 0.0003 * sp_25 * sp_74
let r_134 = 0.1126 * sp_67
let r_135 = 0.1126 * sp_67
let r_136 = 0.0003 * BJ2x2_9 * sp_72
let r_137 = 0.0003 * sp_25 * sp_72
let r_138 = 0.1126 * sp_68
let r_139 = 0.1126 * sp_68
let r_140 = 0.0003 * BJ2x2_9 * sp_70
let r_141 = 0.0003 * sp_25 * sp_70
let r_142 = 0.1126 * sp_69
let r_143 = 0.1126 * sp_69
let r_144 = 0.0003 * sp_2 * sp_66
let r_145 = 0.0003 * sp_28 * sp_66
let r_146 = 0.0003 * sp_27 * sp_66
let r_147 = 0.0003 * sp_22 * sp_66
let r_148 = 0.1126 * sp_65
let r_149 = 0.1126 * sp_65
let r_150 = 0.0003 * sp_62 * sp_10
let r_151 = 0.0003 * sp_62 * sp_57
let r_152 = 0.0003 * BJ2x2_1 * sp_60
let r_153 = 0.1126 * sp_58
let r_154 = 0.1126 * sp_58
let r_155 = 0.0003 * sp_1 * sp_57
let r_156 = 0.1126 * sp_55
let r_157 = 0.1126 * sp_55
let r_158 = 0.0003 * sp_0 * sp_15
let r_159 = 0.0003 * sp_0 * sp_20
let r_160 = 0.0003 * sp_0 * sp_32
let r_161 = 0.0003 * sp_0 * sp_37
let r_162 = 0.0003 * sp_22 * sp_23
let r_163 = 0.0003 * sp_22 * sp_45
let r_164 = 0.0003 * sp_41 * BJ2x2_13
let r_165 = 0.0003 * sp_41 * sp_42
let r_166 = 0.0003 * sp_44 * BJ2x2_14
let r_167 = 0.0003 * sp_44 * sp_45
let r_168 = 0.1126 * sp_43
let r_169 = 0.1126 * sp_43
let r_170 = 0.0003 * BJ2x2_12 * sp_42
let r_171 = 0.1126 * sp_40
let r_172 = 0.1126 * sp_40
let r_173 = 0.0003 * sp_25 * BJ2x2_11
let r_174 = 0.0003 * sp_25 * sp_26
let r_175 = 0.0003 * sp_25 * sp_33
let r_176 = 0.0003 * sp_25 * sp_38
let r_177 = 0.0003 * BJ2x2_9 * sp_38
let r_178 = 0.1126 * sp_35
let r_179 = 0.1126 * sp_35
let r_180 = 0.0003 * sp_19 * sp_37
let r_181 = 0.1126 * sp_36
let r_182 = 0.1126 * sp_36
let r_183 = 0.0003 * sp_27 * sp_5
let r_184 = 0.0003 * sp_27 * sp_23
let r_185 = 0.0003 * BJ2x2_9 * sp_33
let r_186 = 0.1126 * sp_30
let r_187 = 0.1126 * sp_30
let r_188 = 0.0003 * sp_19 * sp_32
let r_189 = 0.1126 * sp_31
let r_190 = 0.1126 * sp_31
let r_191 = 0.0003 * sp_28 * sp_5
let r_192 = 0.0003 * sp_28 * sp_23
let r_193 = 0.0003 * BJ2x2_9 * sp_26
let r_194 = 0.1126 * sp_24
let r_195 = 0.1126 * sp_24
let r_196 = 0.0003 * sp_2 * sp_23
let r_197 = 0.1126 * sp_21
let r_198 = 0.1126 * sp_21
let r_199 = 0.0003 * sp_1 * sp_10
let r_200 = 0.0003 * sp_19 * sp_20
let r_201 = 0.1126 * sp_18
let r_202 = 0.1126 * sp_18
let r_203 = 0.0003 * sp_2 * sp_5
let r_204 = 0.0003 * sp_14 * BJ2x2_2
let r_205 = 0.0003 * sp_14 * sp_15
let r_206 = 0.1126 * sp_13
let r_207 = 0.1126 * sp_13
let r_208 = 0.0003 * BJ2x2_7 * BJ2x2
let r_209 = 0.0003 * sp_9 * BJ2x2_10
let r_210 = 0.0003 * sp_9 * sp_10
let r_211 = 0.1126 * sp_8
let r_212 = 0.1126 * sp_8
let r_213 = 0.0003 * BJ2x2_15 * BJ2x2_8
let r_214 = 0.0003 * sp_4 * BJ2x2_18
let r_215 = 0.0003 * sp_4 * sp_5
let r_216 = 0.1126 * sp_3
let r_217 = 0.1126 * sp_3
let r_218 = 0.0003 * BJ2x2_23 * BJ2x2_16
let v = Vector.zeros 187
do
v.[0] <- 0.0
v.[1] <- r_0 + r_4 + r_8 + r_12 + r_16 + r_20 + r_38 + r_63 + r_88 + r_216 - r_218
v.[2] <- -r_26
v.[3] <- -r_24
v.[4] <- r_30 - r_31
v.[5] <- r_33 - r_34
v.[6] <- -r_214
v.[7] <- -r_0 - r_4 - r_8 - r_12 - r_16 - r_20 - r_38 - r_63 - r_88
v.[8] <- r_216 - r_218
v.[9] <- r_215 - r_216 - r_217 + r_218
v.[10] <- r_181 - r_183 + r_189 - r_191 + r_201 - r_203 - r_215 + r_217
v.[11] <- -r_214 - r_215 + r_217
v.[12] <- r_214
v.[13] <- r_214
v.[14] <- r_109 + r_113 + r_117 + r_132 + r_136 + r_140 + r_177 + r_185 + r_193 + r_211 - r_213
v.[15] <- -r_166
v.[16] <- -r_164
v.[17] <- r_169 - r_170
v.[18] <- r_172 - r_173
v.[19] <- -r_209
v.[20] <- -r_109 - r_113 - r_117 - r_132 - r_136 - r_140 - r_177 - r_185 - r_193
v.[21] <- r_211 - r_213
v.[22] <- r_210 - r_211 - r_212 + r_213
v.[23] <- r_125 - r_127 + r_148 - r_150 + r_197 - r_199 - r_210 + r_212
v.[24] <- -r_209 - r_210 + r_212
v.[25] <- r_209
v.[26] <- r_209
v.[27] <- r_41 + r_45 + r_49 + r_66 + r_70 + r_74 + r_106 + r_129 + r_152 + r_206 - r_208
v.[28] <- -r_95
v.[29] <- -r_93
v.[30] <- r_98 - r_99
v.[31] <- r_101 - r_102
v.[32] <- -r_204
v.[33] <- -r_41 - r_45 - r_49 - r_66 - r_70 - r_74 - r_106 - r_129 - r_152
v.[34] <- r_206 - r_208
v.[35] <- r_205 - r_206 - r_207 + r_208
v.[36] <- r_57 - r_59 + r_82 - r_84 + r_156 - r_158 - r_205 + r_207
v.[37] <- -r_204 - r_205 + r_207
v.[38] <- r_204
v.[39] <- r_204
v.[40] <- r_119 - r_121 + r_142 - r_144 + r_194 - r_196 + r_201 - r_203
v.[41] <- r_200 - r_201 - r_202 + r_203
v.[42] <- r_39 - r_60 + r_64 - r_85 + r_89 - r_159 - r_200 + r_202
v.[43] <- -r_28 - r_180 + r_182 - r_188 + r_190 - r_200 + r_202
v.[44] <- r_51 - r_53 + r_76 - r_78 + r_153 - r_155 + r_197 - r_199
v.[45] <- r_162 - r_197 - r_198 + r_199
v.[46] <- -r_162 + r_178 - r_184 + r_186 - r_192 + r_194 - r_196 + r_198
v.[47] <- r_174 - r_194 - r_195 + r_196
v.[48] <- -r_174 - r_193 + r_195
v.[49] <- r_193
v.[50] <- r_109 + r_113 + r_115 + r_117 - r_122 + r_132 + r_136 + r_138 + r_140 - r_145 + r_177 + r_185 + r_186 + r_189 - r_191 - r_192 + r_193
v.[51] <- r_188 - r_189 - r_190 + r_191
v.[52] <- r_6 + r_14 + r_22 - r_61 - r_86 - r_160 - r_188 + r_190
v.[53] <- r_175 - r_186 - r_187 + r_192
v.[54] <- -r_175 - r_185 + r_187
v.[55] <- r_185
v.[56] <- r_109 + r_111 + r_113 + r_117 - r_123 + r_132 + r_134 + r_136 + r_140 - r_146 + r_177 + r_178 + r_181 - r_183 - r_184 + r_185 + r_193
v.[57] <- r_180 - r_181 - r_182 + r_183
v.[58] <- r_2 + r_10 + r_18 - r_62 - r_87 - r_161 - r_180 + r_182
v.[59] <- r_176 - r_178 - r_179 + r_184
v.[60] <- -r_176 - r_177 + r_179
v.[61] <- r_177
v.[62] <- -r_110 + r_112 - r_114 + r_116 - r_118 + r_120 - r_133 + r_135 - r_137 + r_139 - r_141 + r_143 + r_172 - r_173 - r_174 - r_175 - r_176 + r_179 + r_187 + r_195
v.[63] <- r_165 - r_171 - r_172 + r_173
v.[64] <- -r_165 + r_169 - r_170 + r_171
v.[65] <- r_167 - r_168 - r_169 + r_170
v.[66] <- -r_163 - r_167 + r_168
v.[67] <- -r_166 - r_167 + r_168
v.[68] <- r_166
v.[69] <- r_166
v.[70] <- -r_164 - r_165 + r_171
v.[71] <- r_164
v.[72] <- r_28 + r_164
v.[73] <- -r_124 + r_126 - r_147 + r_149 - r_162 - r_163 + r_198
v.[74] <- r_163
v.[75] <- r_93 + r_163
v.[76] <- r_2 + r_6 + r_89 + r_156 - r_158 - r_159 - r_160 - r_161
v.[77] <- r_91 - r_156 - r_157 + r_158
v.[78] <- -r_91 + r_107 - r_128 + r_130 - r_151 + r_153 - r_155 + r_157
v.[79] <- r_103 - r_153 - r_154 + r_155
v.[80] <- -r_103 - r_152 + r_154
v.[81] <- r_152
v.[82] <- r_41 + r_45 + r_47 + r_49 - r_54 + r_66 + r_70 + r_72 + r_74 - r_79 + r_106 + r_129 + r_130 + r_148 - r_150 - r_151 + r_152
v.[83] <- r_147 - r_148 - r_149 + r_150
v.[84] <- r_134 + r_138 + r_142 - r_144 - r_145 - r_146 - r_147 + r_149
v.[85] <- r_141 - r_142 - r_143 + r_144
v.[86] <- -r_140 - r_141 + r_143
v.[87] <- r_140
v.[88] <- r_137 - r_138 - r_139 + r_145
v.[89] <- -r_136 - r_137 + r_139
v.[90] <- r_136
v.[91] <- r_133 - r_134 - r_135 + r_146
v.[92] <- -r_132 - r_133 + r_135
v.[93] <- r_132
v.[94] <- r_104 - r_130 - r_131 + r_151
v.[95] <- -r_104 - r_129 + r_131
v.[96] <- r_129
v.[97] <- r_41 + r_43 + r_45 + r_49 - r_55 + r_66 + r_68 + r_70 + r_74 - r_80 + r_106 + r_107 + r_125 - r_127 - r_128 + r_129 + r_152
v.[98] <- r_124 - r_125 - r_126 + r_127
v.[99] <- r_111 + r_115 + r_119 - r_121 - r_122 - r_123 - r_124 + r_126
v.[100] <- r_118 - r_119 - r_120 + r_121
do
v.[101] <- -r_117 - r_118 + r_120
v.[102] <- r_117
v.[103] <- r_114 - r_115 - r_116 + r_122
v.[104] <- -r_113 - r_114 + r_116
v.[105] <- r_113
v.[106] <- r_110 - r_111 - r_112 + r_123
v.[107] <- -r_109 - r_110 + r_112
v.[108] <- r_109
v.[109] <- r_105 - r_107 - r_108 + r_128
v.[110] <- -r_105 - r_106 + r_108
v.[111] <- r_106
v.[112] <- -r_42 + r_44 - r_46 + r_48 - r_50 + r_52 - r_67 + r_69 - r_71 + r_73 - r_75 + r_77 + r_101 - r_102 - r_103 - r_104 - r_105 + r_108 + r_131 + r_154
v.[113] <- r_94 - r_100 - r_101 + r_102
v.[114] <- -r_94 + r_98 - r_99 + r_100
v.[115] <- r_96 - r_97 - r_98 + r_99
v.[116] <- -r_92 - r_96 + r_97
v.[117] <- -r_95 - r_96 + r_97
v.[118] <- r_95
v.[119] <- r_95
v.[120] <- -r_93 - r_94 + r_100
v.[121] <- r_93
v.[122] <- -r_56 + r_58 - r_81 + r_83 - r_91 - r_92 + r_157
v.[123] <- r_92
v.[124] <- r_24 + r_92
v.[125] <- r_35 - r_89 - r_90 + r_159
v.[126] <- -r_35 - r_88 + r_90
v.[127] <- r_88
v.[128] <- r_0 + r_4 + r_8 + r_10 + r_12 + r_14 + r_16 + r_20 + r_38 + r_63 + r_64 + r_82 - r_84 - r_85 - r_86 - r_87 + r_88
v.[129] <- r_81 - r_82 - r_83 + r_84
v.[130] <- r_68 + r_72 + r_76 - r_78 - r_79 - r_80 - r_81 + r_83
v.[131] <- r_75 - r_76 - r_77 + r_78
v.[132] <- -r_74 - r_75 + r_77
v.[133] <- r_74
v.[134] <- r_71 - r_72 - r_73 + r_79
v.[135] <- -r_70 - r_71 + r_73
v.[136] <- r_70
v.[137] <- r_67 - r_68 - r_69 + r_80
v.[138] <- -r_66 - r_67 + r_69
v.[139] <- r_66
v.[140] <- r_36 - r_64 - r_65 + r_85
v.[141] <- -r_36 - r_63 + r_65
v.[142] <- r_63
v.[143] <- r_0 + r_4 + r_8 + r_12 + r_16 + r_18 + r_20 + r_22 + r_38 + r_39 + r_57 - r_59 - r_60 - r_61 - r_62 + r_63 + r_88
v.[144] <- r_56 - r_57 - r_58 + r_59
v.[145] <- r_43 + r_47 + r_51 - r_53 - r_54 - r_55 - r_56 + r_58
v.[146] <- r_50 - r_51 - r_52 + r_53
v.[147] <- -r_49 - r_50 + r_52
v.[148] <- r_49
v.[149] <- r_46 - r_47 - r_48 + r_54
v.[150] <- -r_45 - r_46 + r_48
v.[151] <- r_45
v.[152] <- r_42 - r_43 - r_44 + r_55
v.[153] <- -r_41 - r_42 + r_44
v.[154] <- r_41
v.[155] <- r_37 - r_39 - r_40 + r_60
v.[156] <- -r_37 - r_38 + r_40
v.[157] <- r_38
v.[158] <- -r_1 + r_3 - r_5 + r_7 - r_9 + r_11 - r_13 + r_15 - r_17 + r_19 - r_21 + r_23 + r_33 - r_34 - r_35 - r_36 - r_37 + r_40 + r_65 + r_90
v.[159] <- r_25 - r_32 - r_33 + r_34
v.[160] <- -r_25 + r_30 - r_31 + r_32
v.[161] <- r_27 - r_29 - r_30 + r_31
v.[162] <- -r_27 - r_28 + r_29
v.[163] <- r_28
v.[164] <- -r_26 - r_27 + r_29
v.[165] <- r_26
v.[166] <- r_26
v.[167] <- -r_24 - r_25 + r_32
v.[168] <- r_24
v.[169] <- r_21 - r_22 - r_23 + r_61
v.[170] <- -r_20 - r_21 + r_23
v.[171] <- r_20
v.[172] <- r_17 - r_18 - r_19 + r_62
v.[173] <- -r_16 - r_17 + r_19
v.[174] <- r_16
v.[175] <- r_13 - r_14 - r_15 + r_86
v.[176] <- -r_12 - r_13 + r_15
v.[177] <- r_12
v.[178] <- r_9 - r_10 - r_11 + r_87
v.[179] <- -r_8 - r_9 + r_11
v.[180] <- r_8
v.[181] <- r_5 - r_6 - r_7 + r_160
v.[182] <- -r_4 - r_5 + r_7
v.[183] <- r_4
v.[184] <- r_1 - r_2 - r_3 + r_161
v.[185] <- -r_0 - r_1 + r_3
v.[186] <- r_0
v
let DNA_init =
let x0 = oscillating_ics // Initial point
let f (t:double) (x: Vector) = // OscillatingDNA's right part
oscillating_derivs t x
init 0.0 x0 f { defaults() with MaxStep = 500.0 }
let DNA_solve (rm : state) count =
let t = Array.zeroCreate count
let x1 = Array.zeroCreate count
let x2 = Array.zeroCreate count
let x3 = Array.zeroCreate count
let mutable r = rm
for i = 0 to count - 1 do
Array.set t i r.t
Array.set x1 i (r.x.[76] + r.x.[128] + r.x.[143])
Array.set x2 i (r.x.[44] + r.x.[82] + r.x.[97])
Array.set x3 i (r.x.[40] + r.x.[50] + r.x.[56])
r <- advance r
(t,x1,x2,x3,r)

Просмотреть файл

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Compile Include="RK547Samples.fs" />
<Compile Include="GearSamples.fs" />
<None Include="Script.fsx" />
<None Include="App.config" />
<None Include="paket.references" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Oslo.FSharp.WebSharper\Oslo.FSharp.WebSharper.fsproj" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,87 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo.FSharp
open Oslo
open Oslo.RK547M
[<JavaScript>]
module Samples =
let private mkVec1 x =
let r = Vector.zeros 1
r.[0] <- x
r
let private mkVec x y =
let r = Vector.zeros 2
r.[0] <- x
r.[1] <- y
r
// Solves Brusselator dynamic system on time segment [t0,t1]
//
// dx1/dt = 1 + x1*x1*x2 - 4*x1
// dx2/dt = 3*x1 - x1*x1*x2
//
// Returns tuple with three 1D arrays: t,x1,x2
// Note: this sample uses recursion that is not translated well by WebSharper 2.4
// Large time intervals may cause stack overflows
let Brusselator t0 t1 =
let x0 = mkVec 1.01 3.0 // Initial point
let f (t:double) (x: Vector) = // Brusselator's right part
mkVec (1.0 + x.[0] * x.[0] * x.[1] - 4.0 * x.[0]) (3.0 * x.[0] - x.[0] * x.[0] * x.[1])
let ts, xs = solve t0 t1 x0 f {defaults() with MaxStep = 0.01} |> List.unzip
( ts
, xs |> List.map (fun v -> v.[0])
, xs |> List.map (fun v -> v.[1])
)
let RM_init =
let x0 = mkVec 0.2 0.4 // Initial point
let RM (t:double) (x: Vector) : Vector =
let alpha = 0.2
let kappa = 0.14
let sigma = 0.15
mkVec (x.[0] * (1.0 - x.[0]) - x.[0] * x.[1] / (kappa + x.[0]))
(alpha * x.[0] * x.[1] / (kappa + x.[0]) - sigma * x.[1])
init 0.0 x0 RM { defaults() with MaxStep = 4.0 }
let RM_solve (rm : state) count =
let t = Array.zeroCreate count
let x1 = Array.zeroCreate count
let x2 = Array.zeroCreate count
let mutable r = rm
for i = 0 to count - 1 do
Array.set t i r.t
Array.set x1 i r.x.[0]
Array.set x2 i r.x.[1]
r <- advance r
(t,x1,x2,r)
let RM_rk547_benchmark n =
let x0 = mkVec 0.2 0.4 // Initial point
let RM (t:double) (x: Vector) : Vector =
let alpha = 0.2
let kappa = 0.14
let sigma = 0.15
mkVec
(x.[0] * (1.0 - x.[0]) - x.[0] * x.[1] / (kappa + x.[0]))
(alpha * x.[0] * x.[1] / (kappa + x.[0]) - sigma * x.[1])
let mutable solver = init 0.0 x0 RM { defaults() with MaxStep = 0.01}
for i = 0 to n - 1 do
solver <- advance solver
let Trigonometric t0 t1 =
let t0 = 0.0
let x0 = mkVec1 1.0
let f (t: double) (x: Vector) = mkVec1 (- sin t)
let ts, xs = solve t0 t1 x0 f { defaults() with MaxStep = 0.1 } |> List.unzip
(ts |> List.toArray, xs |> List.map (fun x -> x.[0]) |> List.toArray)

Просмотреть файл

@ -0,0 +1,8 @@
// Learn more about F# at http://fsharp.net. See the 'F# Tutorial' project
// for more guidance on F# programming.
#load "Library1.fs"
open Oslo.FSharp.Samples
// Define your library scripting code here

Просмотреть файл

@ -0,0 +1,5 @@
group NETSTANDARD
FSharp.Core
WebSharper
WebSharper.FSharp

Просмотреть файл

@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo.Tests
module GuassianEliminationTests =
open Expecto
open Oslo
open Oslo.Gauss
let private VectorsEqual(a: Vector, b: Vector) =
Vector.subtract a b
|> Vector.sum
|> abs < 0.001
|> Expect.isTrue
let tests =
testList "Gaussian Elimination" [
test "Solve core" {
let A = !*[|[|2.0;1.0;-1.0|];[|-3.0;-1.0;2.0|];[|-2.0;1.0;2.0|]|]
let b = !^[|8.0;-11.0;-3.0|]
let x = (SolveCore A b)
VectorsEqual(x, !^[|2.0;3.0;-1.0|]) "Vectors must equal"
}
]

Просмотреть файл

@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo.Tests
module GearTests =
open Expecto
open System
open Oslo
open Oslo.GearBDF
let tests =
testList "Gaussian Elimination" [
test "Exp" {
let t0 = 0.0
let x0 = !^[|1000.0|]
let f t (x : Vector) = !^[|- 0.01 * x.[0]|]
let ts, xs = solve t0 2000.0 x0 f {defaults() with MaxStep = 5.0} |> List.unzip
let max = List.map2 (fun t (x:Vector) -> Math.Abs(x.[0] - 1000.0 * Math.Exp(-0.01 * t))) ts xs |> List.max
Expect.isLessThan max 1e-1 ""
}
]

Просмотреть файл

@ -0,0 +1,121 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo.Tests
module MatrixTests =
open Expecto
open Oslo
let tests =
testList "Matrix" [
test "Add matrices" {
let A =
!*[| [| 1.0; 0.0 |]
[| 0.0; 1.0 |] |]
let B =
!*[| [| -1.0; 0.0 |]
[| 0.0; -0.9 |] |]
let result = Matrix.add A B
let expectation =
!*[| [| 0.0; 0.0 |]
[| 0.0; 0.1 |] |]
Expect.isTrue(Matrix.areEqualEps result expectation 0.001) ""
}
test "Subtract matrices" {
let A =
!*[| [| 1.0; 0.0 |]
[| 0.0; 1.0 |] |]
let B =
!*[| [| -1.0; 0.0 |]
[| 0.0; -0.9 |] |]
let result = Matrix.subtract A B
let expectation =
!*[| [| 2.0; 0.0 |]
[| 0.0; 1.9 |] |]
Expect.isTrue(Matrix.areEqualEps result expectation 0.001) ""
}
test "Multiply by scalar" {
let A =
!*[| [| 1.0; 0.0 |]
[| 0.0; 1.1 |] |]
let result = Matrix.scalMultMatr 2.0 A
let expectation =
!*[| [| 2.0; 0.0 |]
[| 0.0; 2.2 |] |]
Expect.isTrue(Matrix.areEqualEps result expectation 0.001) ""
}
test "Multiply matrices" {
let A =
!*[| [| 0.0; 2.0 |]
[| 1.0; 1.2 |] |]
let B =
!*[| [| 3.0; 0.0 |]
[| 0.0; -2.0 |] |]
let result = Matrix.matrMultMatr A B
let expectation =
!*[| [| 0.0; -4.0 |]
[| 3.0; -2.4 |] |]
Expect.isTrue(Matrix.areEqualEps result expectation 0.001) ""
}
test "Multiply by vector" {
let A =
!*[| [| 0.0; 2.0 |]
[| 1.0; 1.2 |] |]
let v = !^[| 1.0; 2.0 |]
let result = Matrix.matrMultVec A v
let expectation = !^[| 4.0; 3.4 |]
Expect.isTrue(Vector.areEqualEps result expectation 0.001) ""
}
test "Transpose square" {
let A =
!*[| [| 0.0; 2.0 |]
[| 1.0; 1.2 |] |]
let result = Matrix.transpose A
let expectation =
!*[| [| 0.0; 1.0 |]
[| 2.0; 1.2 |] |]
Expect.isTrue(Matrix.areEqualEps result expectation 0.001) ""
}
test "Transpose non-square" {
let A =
!*[| [| 0.0; 2.0; -2.3 |] |]
let result = Matrix.transpose A
let expectation =
!*[| [| 0.0 |]
[| 2.0 |]
[| -2.3 |] |]
Expect.isTrue(Matrix.areEqualEps result expectation 0.001) ""
}
test "Map" {
let A =
!*[| [| 1.0; 2.0 |]
[| 3.0; 4.0 |] |]
let result = Matrix.matrMap (fun x -> x * x) A
let resultAsPiping = A |> Matrix.matrMap (fun x -> x * x) //Not sure why we're testing piping...
let expectation =
!*[| [| 1.0; 4.0 |]
[| 9.0; 16.0 |] |]
Expect.isTrue(Matrix.areEqualEps result expectation 0.001) ""
Expect.isTrue(Matrix.areEqualEps resultAsPiping expectation 0.001) ""
}
]

Просмотреть файл

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Compile Include="TestNotation.fs" />
<Compile Include="VectorTests.fs" />
<Compile Include="MatrixTests.fs" />
<Compile Include="SparseVectorTests.fs" />
<Compile Include="SparseMatrixTest.fs" />
<Compile Include="GaussianEliminationTests.fs" />
<Compile Include="GearTests.fs" />
<Compile Include="Program.fs" />
<None Include="paket.references" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Oslo.FSharp\Oslo.FSharp.fsproj" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo.Tests
open Expecto
module Program =
open Oslo
[<Tests>]
let allTests =
testList "All" [
VectorTests.tests
MatrixTests.tests
SparseVectorTests.tests
SparseMatrixTests.tests
GuassianEliminationTests.tests
GearTests.tests
]
[<EntryPoint>]
let main args =
runTestsWithArgs defaultConfig args allTests

Просмотреть файл

@ -0,0 +1,61 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo.Tests
module SparseMatrixTests =
open Expecto
open Oslo.SparseMatrix
let tests =
testList "Sparse Matrices" [
test "Plus" {
let N = 50
// Make matrix diagonal 6.0, 1.0 elsewhere
let A = SparseMatrix(N, N)
for i in 0..5..N-1 do A.Item(i,i) <- 6.0;
// Make matrix diagonal -1.0, 1.0 elsewhere
let B = SparseMatrix(N, N)
for i in 0..5..N-1 do B.Item(i,i) <- -1.0;
let expected = SparseMatrix(N, N)
for i in 0..5..N-1 do expected.Item(i,i) <- 5.0;
let C = A.plus(B)
Expect.isTrue (Oslo.SparseMatrix.areEqual C expected) ""
}
test "Minus" {
let N = 50
let A = Oslo.SparseMatrix.Identity(N, N)
for i in 0..N - 1 do A.Item(i,i) <- if i % 5 = 0 then 5.0 else 3.0
let B = Oslo.SparseMatrix.Identity(N, N)
for i in 0..N - 1 do B.Item(i,i) <- if i % 5 = 0 then 2.0 else 1.0
let expected = Oslo.SparseMatrix.Identity(N, N)
for i in 0..N - 1 do expected.Item(i,i) <- if i % 5 = 0 then 3.0 else 2.0
let C = A.minus(B)
Expect.isTrue (Oslo.SparseMatrix.areEqual C expected) ""
}
test "Minus with mismatched" {
let N = 50
let A = Oslo.SparseMatrix.Identity(N, N)
for i in 0..N - 1 do A.Item(i,i) <- if i % 5 = 0 then 5.0 else 3.0
let B = Oslo.SparseMatrix.Identity(N, N)
for i in 0..N - 1 do B.Item(i,i) <- if i % 5 = 0 then 2.0 else 1.0
let expected = Oslo.SparseMatrix.Identity(N, N)
for i in 0..N - 1 do expected.Item(i,i) <- if i % 5 = 0 then 3.0 else 2.0
let C = A.minus(B)
Expect.isTrue (Oslo.SparseMatrix.areEqual C expected) ""
}
//TODO: times
]

Просмотреть файл

@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo.Tests
module SparseVectorTests =
open Expecto
open Oslo.SparseVector
let tests =
testList "Sparse Vectors" [
test "Access test" {
let sv = SparseVector([|1.0; 2.0; 3.0|], [| 0; 3; 6|], 10)
Expect.equal sv.[0] 1.0 ""
Expect.equal sv.[1] 0.0 ""
Expect.equal sv.[2] 0.0 ""
Expect.equal sv.[3] 2.0 ""
Expect.equal sv.[4] 0.0 ""
Expect.equal sv.[5] 0.0 ""
Expect.equal sv.[6] 3.0 ""
Expect.equal sv.[7] 0.0 ""
}
]

Просмотреть файл

@ -0,0 +1,12 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo.Tests
[<AutoOpen>]
module TestsNotation =
open Oslo
let ( !^ ) xs = Vector.ofArray xs
let ( !* ) xs = Matrix.ofArray xs

Просмотреть файл

@ -0,0 +1,54 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo.Tests
module VectorTests =
open Expecto
open Oslo
let tests =
testList "Vectors" [
test "Adding" {
let x = !^[|1.0; 0.0|]
let y = !^[|-1.0; 1.0|]
let z = x +^ y
Expect.isTrue(Vector.areEqual z !^[|0.0; 1.0|]) "Should equal"
Expect.isFalse(Vector.areEqual z !^[|0.0; 1.000001|]) "Shouldn't equal"
}
test "Subtraction (eps)" {
let x = !^[|1.0; 0.0|]
let y = !^[|-1.0; 1.000000000000000001|]
let z = x +^ y
Expect.isTrue(Vector.areEqual z !^[|0.0; 1.0|]) "Should equal"
Expect.isFalse(Vector.areEqual z !^[|0.0; 1.01|]) "Shouldn't equal"
}
test "Multiply vector" {
let x = !^[|1.0; 0.0|]
let s = 2.0
let y = x *> s
Expect.isTrue(Vector.areEqual y !^[|2.0; 0.0|]) "Equal"
}
test "Scale vector" {
let x = !^[|1.0; 0.0|]
let s = 0.5
let y = s *< x
Expect.isTrue(Vector.areEqual y !^[|0.5; 0.0|]) "Equal"
}
test "dot" {
let x = !^[|1.0; 0.0|]
let y = !^[|-1.0; 1.0|]
let z = Vector.dot x y
Expect.equal z -1.0 "equal"
}
test "Dollar" {
let x = !^[|1.0; 0.0|]
let y = !^[|-1.0; 1.0|]
let z = x $ y
Expect.isTrue(Matrix.areEqualEps z !*[| [|-1.0; 1.0|]; [|0.0; 0.0|]|] 0.001) "Equal"
}
]

Просмотреть файл

@ -0,0 +1,10 @@
group DOTNETCORE
FsCheck
FsUnit.xUnit
argu
xunit.core
xunit.runner.console
xunit.runner.visualstudio
Expecto
FSharp.Core

Просмотреть файл

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<Compile Include="WebSharperAbbreviations.fs" />
<Compile Include="..\Oslo.FSharp\Vector.fs">
<Link>Vector.fs</Link>
</Compile>
<Compile Include="..\Oslo.FSharp\Matrix.fs">
<Link>Matrix.fs</Link>
</Compile>
<Compile Include="..\Oslo.FSharp\SparseVector.fs">
<Link>SparseVector.fs</Link>
</Compile>
<Compile Include="..\Oslo.FSharp\SparseMatrix.fs">
<Link>SparseMatrix.fs</Link>
</Compile>
<Compile Include="..\Oslo.FSharp\Gauss.fs">
<Link>Gauss.fs</Link>
</Compile>
<Compile Include="..\Oslo.FSharp\RK547M.fs">
<Link>RK547M.fs</Link>
</Compile>
<Compile Include="..\Oslo.FSharp\GearBDF.fs">
<Link>GearBDF.fs</Link>
</Compile>
<Content Include="paket.references" />
<None Include="wsconfig.json" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace global
//These abbreviations map to the real WebSharper types in 4.x
type JavaScriptAttribute = WebSharper.JavaScriptAttribute
type InlineJavaScriptAttribute = WebSharper.InlineAttribute
type DirectJavaScriptAttribute = WebSharper.DirectAttribute

Просмотреть файл

@ -0,0 +1,5 @@
group NETSTANDARD
FSharp.Core
WebSharper
WebSharper.FSharp

Просмотреть файл

@ -0,0 +1,4 @@
{
"$schema": "https://websharper.com/wsconfig.schema.json",
"project": "library"
}

54
Oslo/Oslo.FSharp.sln Normal file
Просмотреть файл

@ -0,0 +1,54 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2002
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{816632C4-18B5-4AE2-96AA-7B8E9D6CF974}"
ProjectSection(SolutionItems) = preProject
paket.dependencies = paket.dependencies
EndProjectSection
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Oslo.FSharp.WebSharper", "Oslo.FSharp.WebSharper\Oslo.FSharp.WebSharper.fsproj", "{B577BC2C-D7C7-4A93-AC2A-0FBC47B3707E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Oslo.JavaScript.Samples", "Oslo.JavaScript.Samples\Oslo.JavaScript.Samples.csproj", "{26C5140E-6B59-4A5F-9C9B-03DAB71C87D8}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Oslo.FSharp.Samples", "Oslo.FSharp.Samples\Oslo.FSharp.Samples.fsproj", "{993CD92E-123B-4AB4-9DD7-D3B22173F5F3}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Oslo.FSharp", "Oslo.FSharp\Oslo.FSharp.fsproj", "{F3A00D99-016C-4D36-836A-2045ACD1CE8B}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Oslo.FSharp.Tests", "Oslo.FSharp.Tests\Oslo.FSharp.Tests.fsproj", "{D7898DC7-B7CF-45AC-B32A-07D4271F0AEE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B577BC2C-D7C7-4A93-AC2A-0FBC47B3707E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B577BC2C-D7C7-4A93-AC2A-0FBC47B3707E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B577BC2C-D7C7-4A93-AC2A-0FBC47B3707E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B577BC2C-D7C7-4A93-AC2A-0FBC47B3707E}.Release|Any CPU.Build.0 = Release|Any CPU
{26C5140E-6B59-4A5F-9C9B-03DAB71C87D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26C5140E-6B59-4A5F-9C9B-03DAB71C87D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26C5140E-6B59-4A5F-9C9B-03DAB71C87D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26C5140E-6B59-4A5F-9C9B-03DAB71C87D8}.Release|Any CPU.Build.0 = Release|Any CPU
{993CD92E-123B-4AB4-9DD7-D3B22173F5F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{993CD92E-123B-4AB4-9DD7-D3B22173F5F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{993CD92E-123B-4AB4-9DD7-D3B22173F5F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{993CD92E-123B-4AB4-9DD7-D3B22173F5F3}.Release|Any CPU.Build.0 = Release|Any CPU
{F3A00D99-016C-4D36-836A-2045ACD1CE8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3A00D99-016C-4D36-836A-2045ACD1CE8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3A00D99-016C-4D36-836A-2045ACD1CE8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3A00D99-016C-4D36-836A-2045ACD1CE8B}.Release|Any CPU.Build.0 = Release|Any CPU
{D7898DC7-B7CF-45AC-B32A-07D4271F0AEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D7898DC7-B7CF-45AC-B32A-07D4271F0AEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7898DC7-B7CF-45AC-B32A-07D4271F0AEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7898DC7-B7CF-45AC-B32A-07D4271F0AEE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3B9D903D-D040-4C4D-B18F-376221CE8DE3}
EndGlobalSection
EndGlobal

171
Oslo/Oslo.FSharp/Gauss.fs Normal file
Просмотреть файл

@ -0,0 +1,171 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo
open System
open SparseMatrix
//Provides implementation of Gaussian elimination with partial pivoting
[<JavaScript>]
module Gauss =
module private SolveCoreUtility =
let inline flipValues (v: Vector) (i: int) (j: int) =
let temp = v.[i]
v.[i] <- v.[j]
v.[j] <- temp
let inline flipRows (A: Matrix) (r1: int) (r2: int) =
let r1 = A.[r1]
let r2 = A.[r2]
for k = 0 to Vector.length r1 - 1 do
let x = r1.[k]
r1.[k] <- r2.[k]
r2.[k] <- x
// NOTE: this is often the performance bottleneck, therefore we use
// internal representations of Vector and Matrix, and we specialize code
// for JavaScript separately.
[<DirectJavaScript "
var data = $A1.MatrixData,
jR = (data.length - $j - 1) | 0,
mult = +$b1[jR],
b = data[jR];
for (var i = 0; i < jR; i++) {
var a = data[i], aj = +a[$j];
if (aj !== 0) {
for (var k = $j|0 + 1; k < a.length; k++) {
a[k] = +a[k] - aj * +b[k];
}
$b1[i] = +$b1[i] - aj * mult;
a[$j] = 0.0;
}
}">]
let processOtherRows (A1: Matrix) (b1: Vector) (j: int) =
let jR = Matrix.numRows A1 - j - 1
let b = A1.[jR]
for i = 0 to jR - 1 do
let a = A1.[i]
let aj = a.[j]
if aj <> 0.0 then
for k = j + 1 to Vector.length a - 1 do
a.[k] <- a.[k] - aj * b.[k]
b1.[i] <- b1.[i] - aj * b1.[jR]
a.[j] <- 0.0
let divideFrom (v: Vector) (r: double) (i: int) =
for k in i .. Vector.length v - 1 do
v.[k] <- v.[k] / r
let solveCore (A1: Matrix) (b1: Vector) =
let mutable maxIdx = 0
for j = 0 to Matrix.numRows A1 - 1 do
let jR = Matrix.numRows A1 - j - 1
// Find row with largest absolute value of j-st element
maxIdx <- 0
for i = 0 to jR do
if abs A1.[i].[j] > abs A1.[maxIdx].[j] then
maxIdx <- i
if abs A1.[maxIdx].[j] < 1e-12 then
failwith "Cannot apply Gauss method"
// Divide this row by max value
do let row = A1.[maxIdx]
let v = row.[j]
divideFrom row v (j + 1)
b1.[maxIdx] <- b1.[maxIdx] / v
row.[j] <- 1.0
// Move this row to bottom
if maxIdx <> jR then
flipRows A1 maxIdx jR
flipValues b1 maxIdx jR
processOtherRows A1 b1 j
/// Solves system of linear equations A * x = b
/// using Gaussian elimination with partial pivoting.
let SolveCore (A: Matrix) (b: Vector) : Vector =
let n = Matrix.numRows A
let A1 = Matrix.copy A
let b1 = Vector.copy b
SolveCoreUtility.solveCore A1 b1
// Build answer
let x = Vector.zeros n
for i = 0 to n - 1 do
let mutable s = b1.[i]
let a = A1.[i]
for j = n - i to n - 1 do
s <- s - x.[j] * a.[j]
x.[n - i - 1] <- s
x
let SparseSolveCore (A: SparseMatrix) (b: Vector) : Vector =
let n = A.RowDimension
let mutable b1 = [| for i in 0..n - 1 -> b.[i] |]
let mutable map = [| for i in 0..n - 1 -> i |]
let mutable x = Array.zeroCreate n
for j in 0..n - 1 do
// Find row with largest absolute value of j-st element
let mutable maxIdx = 0
let mutable maxVal = A.Items(maxIdx, j)
let mutable Aij = 0.0
for i in 0..n - j - 1 do
Aij <- A.Items(i, j)
if (Math.Abs(Aij) > Math.Abs(maxVal))
then
maxIdx <- i
maxVal <- Aij
if (Math.Abs(maxVal) < 1e-12)
then
failwith "Cannot apply Gauss method"
// Divide this row by max value
A.ScaleRow(maxIdx, j + 1, n - 1, 1.0 / maxVal);
b1.[maxIdx] <- b1.[maxIdx] / maxVal;
A.Items(maxIdx, j) <- 1.0
// Move this row to bottom
if (maxIdx <> n - j - 1) then
A.SwitchRows(maxIdx, n - j - 1)
let temp3 = b1.[n - j - 1]
b1.[n - j - 1] <- b1.[maxIdx]
b1.[maxIdx] <- temp3
let temp2 = map.[n - j - 1]
map.[n - j - 1] <- map.[maxIdx]
map.[maxIdx] <- temp2
// Process all other rows
for i = 0 to n - j - 2 do
Aij <- A.Item(i, j)
if (Aij <> 0.0) then
for k = j + 1 to n - 1 do
A.Item(i, k) <- (Aij - A.Item(n - j - 1, k))
b1.[i] <- (b1.[i] - (Aij * b1.[n - j - 1]));
A.Item(i, j) <- 0.0
// Build answer
for i = 0 to n - 1 do
let mutable s = b1.[i]
let Ai = A.[i]
for k in 0..Ai.Count - 1 do
if (Ai.Indices.[k] >= n - i)
then
s <- s - x.[Ai.Indices.[k]] * A.[i].Items.[k]
Array.set x (n - i - 1) s
Vector.ofArray x

546
Oslo/Oslo.FSharp/GearBDF.fs Normal file
Просмотреть файл

@ -0,0 +1,546 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
[<JavaScript>]
//Implementation of Gear's BDF method with dynamically changed step size and order.
module Oslo.GearBDF
open System
open Microsoft.FSharp.Core
open SparseMatrix
open Gauss
open System.Collections
type jacobian = Absent | Dense of Matrix | Sparse of SparseMatrix
//Order changes between 1 and 4.
type options =
{
/// Initial step for solution. Default value 0 means that initial step is computed automatically.
InitialStepSize : double
/// Absolute error tolerance used in automatic step size calculations.
AbsoluteTolerance : double
/// Relative error tolerance used in automatic step size calculations.
RelativeTolerance : double
/// Sets maximal step value.
MaxStep : double
/// Sets minimal step value.
MinStep : double
/// Gets or sets maximal scale factor value.
MaxScale : double
/// Gets or sets maximal scale factor value.
MinScale : double
/// Gets or sets NumberOfIterations value.
NumberOfIterations : int
// Jacobian
Jacobian : jacobian
/// Gets or sets pre-defined Jacobian matrix
//Jacobian : Matrix
/// Gets or sets pre-defined Sparse Jacobian matrix
//SparseJacobian : SparseMatrix
}
type state =
{
/// current time
t : double
/// current state vector
x : Vector
/// right parts
f : double -> Vector -> Vector
/// current time step
dt : double
/// current Nordsieck history matrix
z : Matrix
/// current method order
q : int
/// current step size computation variable
Dq : double
/// current step size computation variable
delta : double
/// current step size scale factor
r : double
/// maximum order, usually 4 or 5
qmax : int
/// number of coincide successful steps
nsuccess : int
/// current error vector
e : Vector
/// iterations failed flag
isIterationFailed : bool
/// options
opts : options
}
let inline defaults() = {
InitialStepSize = 0.0
AbsoluteTolerance = 1e-6
RelativeTolerance = 1e-3
MaxStep = Double.MaxValue
MinStep = 0.0
MaxScale = 1.1
MinScale = 0.9
NumberOfIterations = 5
Jacobian = Absent
}
/// The following function compute Nordsieck's matrix Zn0 = Z(n-1)*A
/// in more effective way than just multiply two matrixes.
/// Current algoritm is taken from book of
/// Krishnan Radhakrishnan and Alan C.Hindmarsh "Description and Use of LSODE,
/// the Livermore Solver of Ordinary Differential Equations"
/// </summary>
/// <param name="arg">previous value of Nordsieck's matrix, so-called Z(n-1)</param>
/// <returns>So-called Zn0,initial vaue of Z in new step</returns>
let NordsieckMatrix_init (arg : Matrix) : Matrix =
let q = Matrix.numCols arg
let n = Matrix.numRows arg
let res = Matrix.copy arg
for k = 0 to q - 2 do
for j = k + 1 to q - 1 do
let k1 = k
let j1 = j
let j2 = q + k1 - j1
for i = 0 to n - 1 do
let temp = res.[i, j2] + res.[i, j2 - 1]
res.[i, j2 - 1] <- temp
res
/// The following function rescales Nordsieck's matrix in more effective way than
/// only compute two matrixes. Current algorithm is taken from book of
/// Krishnan Radhakrishnan and Alan C.Hindmarsh "Description and Use of LSODE,
/// the Livermore Solver of Ordinary Differential Equations"
/// </summary>
/// <param name="arg">Previous value of history matrix</param>
/// <param name="r">(New time step)/(Old time step)</param>
/// <returns>Rescaled history matrix</returns>
let NordsieckMatrix_rescale (arg: Matrix) (r: double) : Matrix =
let mutable R = 1.0
let q = Matrix.numCols arg
let n = Matrix.numRows arg
let mutable res = Matrix.copy arg
for j = 1 to q - 1 do
R <- R * r
for i = 0 to n - 1 do
res.[i, j] <- res.[i, j] * R
res
//Compute Jacobian of f in given point (t,x) v.r.t x variations
let NordsieckMatrix_Jacobian (t: double) (x: Vector) (f: double -> Vector -> Vector) : Matrix =
let n = Vector.length x
let J = Matrix.zeros n n
let vars = Array.create n 0.0
let xvars = Vector.zeros n
for i = 0 to n - 1 do
vars.[i] <- sqrt (1e-6 * max (1e-5) (abs x.[i]))
xvars.[i] <- x.[i]
let fx = f t x
let fvars = Matrix.zeros n n
for i = 0 to n - 1 do
xvars.[i] <- xvars.[i] + vars.[i]
let fv = f t xvars
for j = 0 to n - 1 do
fvars.[i, j] <- fv.[j]
xvars.[i] <- xvars.[i] - vars.[i]
for i = 0 to n - 1 do
let J_i = J.[i]
for j = 0 to n - 1 do
J_i.[j] <- (fvars.[j, i] - fx.[i]) / vars.[j]
J
let init (t0: double) x0 f (opts : options) =
let n = Vector.length x0
let dx0 = f t0 x0
// Compute initial step (see LSODE handbook)
let dt0 =
if opts.InitialStepSize = 0.0 then
let tol = opts.RelativeTolerance;
let ywt = x0 |> Vector.map (fun (a : double) -> (1.0 / opts.RelativeTolerance) *(opts.AbsoluteTolerance + opts.RelativeTolerance * Math.Abs(a)))
let sum = Vector.sum (Vector.map2 (fun a b -> a * a / b / b) dx0 ywt)
Math.Min(Math.Sqrt( tol / (1.0 / (ywt.[0] * ywt.[0]) + 1.0 / (float n) * sum)), opts.MaxStep)
else
Math.Min(opts.InitialStepSize, opts.MaxStep)
let qmax = 5
let q = 2
let z0 = Matrix.zeros n (qmax + 1)
for i = 0 to n - 1 do
z0.[i, 0] <- x0.[i]
z0.[i, 1] <- dt0 * dx0.[i]
{t=t0; x=x0; f = f; dt = dt0; opts = opts; e = Vector.zeros n; z = z0; r = 1.0; Dq = 0.0; delta = 0.0; qmax = qmax; q = q; nsuccess = 0; isIterationFailed = false}
type iteration =
{
e : Vector
Dq : double
DqUp : double
DqDown : double
delta : double
x : Vector
z : Matrix
count : int
}
let rec Factorial (arg: int) =
if arg < 0 then -1
elif arg = 0 then 1
else arg * Factorial (arg - 1)
let ToleranceNorm (v1: Vector) (absTol: double) (relTol: double) (v2 : Vector) : double =
let n1 = Vector.length v1
let n2 = Vector.length v2
let mutable m1 = 0.0
let mutable m2 = 0.0
for i = 0 to n1 - 1 do
let tmp = Math.Abs v1.[i]
m1 <- if m1 > tmp then m1 else tmp
for i = 0 to n2 - 1 do
let tmp = Math.Abs v2.[i]
m2 <- if m2 > tmp then m2 else tmp
m1 / (absTol + relTol * m2)
let Corrector (gear_state_predicted : state) =
let NumberOfIterations = gear_state_predicted.opts.NumberOfIterations
// Vector l for Nordsieck algorithm (orders 1 to 5)
let l = [|[|1.0; 1.0|];
[|2.0 / 3.0; 1.0; 1.0 / 3.0|];
[|6.0 / 11.0; 1.0; 6.0 / 11.0; 1.0 / 11.0|];
[|24.0 / 50.0; 1.0; 35.0 / 50.0; 10.0 / 50.0; 1.0 / 50.0|];
[|120.0 / 274.0; 1.0; 225.0 / 274.0; 85.0 / 274.0; 15.0 / 274.0; 1.0 / 274.0|];
[|720.0 / 1764.0; 1.0; 1624.0 / 1764.0; 735.0 / 1764.0; 175.0 / 1764.0; 1.0 / 1764.0|]|]
|> Array.map Vector.ofArray
// Vector Beta for Nordsieck algorithm (orders 1 to 5)
let b = [|1.0; 2.0 / 3.0; 6.0 / 11.0; 24.0 / 50.0; 120.0 / 274.0; 720.0 / 1764.0 |]
|> Vector.ofArray
let n = Vector.length gear_state_predicted.x
let f = gear_state_predicted.f
let x0 = gear_state_predicted.x
let qcurr = gear_state_predicted.q
let qmax = gear_state_predicted.qmax
let dt = gear_state_predicted.dt
let t = gear_state_predicted.t
let z0 = Matrix.copy gear_state_predicted.z
//Tolerance computation factors
let Cq = 1.0 / (float qcurr + (float 1));
let tau = 1.0 / (Cq * (float (Factorial qcurr)) * l.[qcurr - 1].[qcurr])
//Scaling factors for the step size changing
//with new method order q' = q, q + 1, q - 1, respectively
let mutable rSame = 0.0
let mutable rUp = 0.0
let mutable rDown = 0.0
(*let isJacobianSparse = false
let JSparse = if gear_state_predicted.opts.SparseJacobian <> null
then
gear_state_predicted.opts.SparseJacobian
else
null
let J = if box gear_state_predicted.opts.Jacobian = null
then
NordsieckMatrix_Jacobian (t + dt) x0 f
else
gear_state_predicted.opts.Jacobian
let P = Oslo.Matrix.subtract (Oslo.Matrix.identity n n) (Oslo.Matrix.matrMultScal J (dt * b.[qcurr - 1]))
let PSparse = if isJacobianSparse = false
then
null
else
let M1 = JSparse.times (dt * b.[qcurr - 1])
let M2 = SparseMatrix.Identity(n, n)
M2.minus M1*)
let computeDenseP J = Oslo.Matrix.subtract (Oslo.Matrix.identity n n) (Oslo.Matrix.matrMultScal J (dt * b.[qcurr - 1]))
let P = match gear_state_predicted.opts.Jacobian with
| Absent -> NordsieckMatrix_Jacobian (t + dt) x0 f |> computeDenseP |> Dense
| Dense J -> computeDenseP J |> Dense
| Sparse J -> SparseMatrix.Identity(n, n).minus (J.times(dt * b.[qcurr - 1])) |> Sparse
let absTol = gear_state_predicted.opts.AbsoluteTolerance
let relTol = gear_state_predicted.opts.RelativeTolerance
let rec iterations (par : iteration) =
let xprev = par.x
let gm = Vector.zeros n
let dx = f (t + dt) par.x
for i = 0 to n - 1 do
gm.[i] <- dt * dx.[i] - z0.[i].[1] - par.e.[i]
let resX = match P with
| Absent -> failwith "Failed to evaluate predictor matrix P"
| Dense P -> SolveCore P gm
| Sparse P -> SparseSolveCore P gm
let ecurr = Vector.zeros n
for i = 0 to n - 1 do
ecurr.[i] <- par.e.[i] + resX.[i]
let xcurr = Vector.zeros n
for i = 0 to n - 1 do
xcurr.[i] <- x0.[i] + b.[qcurr - 1] * ecurr.[i]
//Row dimension is smaller than zcurr has
let M = ecurr $ l.[qcurr - 1]
//So, "expand" the matrix
let MBig = Matrix.zeros n (qmax + 1)
for i = 0 to n - 1 do
for j = 0 to qmax do
if i < Matrix.numRows M && j < Vector.length l.[qcurr - 1] then
MBig.[i, j] <- M.[i, j]
else
MBig.[i, j] <- 0.0
let zcurr = Matrix.add z0 MBig
let Dq = ToleranceNorm ecurr absTol relTol xprev
let deltaE = Vector.zeros n
for i = 0 to n - 1 do
deltaE.[i] <- ((ecurr.[i] - (gear_state_predicted.e.[i])) * ((1.0 / ((float qcurr) + 2.0)) * l.[qcurr - 1].[qcurr - 1]))
let DqUp = ToleranceNorm deltaE absTol relTol xcurr
let zcurrColumn = Matrix.copyCol zcurr (qcurr - 1)
let DqDown = ToleranceNorm zcurrColumn absTol relTol xcurr
let delta = Dq / (tau / (2.0 * (float qcurr + 2.0)))
let newState = {Dq = Dq; DqUp = DqUp; DqDown = DqDown; z = zcurr; x = xcurr; e = ecurr; count = par.count + 1; delta = delta}
if (delta > 1.0 && newState.count < NumberOfIterations)
then
(newState |> iterations)
else
newState
let iterResult = iterations {delta = 0.0; count = 0; e = gear_state_predicted.e; Dq = 0.0; DqUp = 0.0; DqDown = 0.0; x = x0; z = z0}
let mutable nsuccess = if iterResult.count < NumberOfIterations then (gear_state_predicted.nsuccess + 1) else 0
let mutable deltaFin = iterResult.delta
let mutable isIterationFailedFin = false
let mutable nsuccessFin = 0
let mutable zFin = iterResult.z
let mutable eFin = iterResult.e
let mutable xFin = iterResult.x
let mutable DFin = iterResult.Dq
let mutable qFin = gear_state_predicted.q
let mutable rFin = 1.0
let Dq = Math.Abs(iterResult.Dq)
let DqUp = Math.Abs(iterResult.DqUp)
let DqDown = Math.Abs(iterResult.DqDown)
if (iterResult.count < NumberOfIterations)
then
isIterationFailedFin <- false
zFin <- iterResult.z
for i = 0 to n - 1 do
xFin.[i] <- iterResult.z.[i].[0]
eFin <- iterResult.e
else
isIterationFailedFin <- true
zFin <- gear_state_predicted.z
for i = 0 to n - 1 do
xFin.[i] <- gear_state_predicted.z.[i].[0]
eFin <- gear_state_predicted.e
//Compute step size scaling factors
rUp <- 0.0
if (gear_state_predicted.q < gear_state_predicted.qmax) then
rUp <- 1.0 / 1.4 / (Math.Pow(DqUp, 1.0 / (float (qcurr + 2))) + 1e-6)
rSame <- 1.0 / 1.2 / (Math.Pow(Dq, 1.0 / (float (qcurr + 1))) + 1e-6)
rDown <- 0.0
if (gear_state_predicted.q > 1) then
rDown <- 1.0 / 1.3 / (Math.Pow(DqDown, 1.0 / (float qcurr)) + 1e-6)
//======================================
nsuccessFin <- if nsuccess >= gear_state_predicted.q then 0 else nsuccess;
//Step size scale operations
if (rSame >= rUp)
then
if (rSame <= rDown && nsuccess >= gear_state_predicted.q && gear_state_predicted.q > 1)
then
qFin <- gear_state_predicted.q - 1
DFin <- DqDown
for i = 0 to n - 1 do
for j = qFin + 1 to qmax do
zFin.[i].[j] <- 0.0
nsuccess <- 0
rFin <- rDown
else
qFin <- gear_state_predicted.q
DFin <- Dq
rFin <- rSame
else
if (rUp >= rDown)
then
if (rUp >= rSame && nsuccess >= gear_state_predicted.q && gear_state_predicted.q < gear_state_predicted.qmax)
then
qFin <- gear_state_predicted.q + 1
DFin <- DqUp
rFin <- rUp
nsuccess <- 0
else
qFin <- gear_state_predicted.q
DFin <- Dq
rFin <- rSame
else
if (nsuccess >= gear_state_predicted.q && gear_state_predicted.q > 1)
then
qFin <- gear_state_predicted.q - 1;
DFin <- DqDown;
for i = 0 to (n - 1) do
for j = qFin + 1 to qmax do
zFin.[i].[j] <- 0.0
nsuccess <- 0
rFin <- rDown
else
qFin <- gear_state_predicted.q
DFin <- Dq
rFin <- rSame
{ Dq = DFin;
x = xFin;
z = zFin;
delta = deltaFin;
e = eFin;
t = gear_state_predicted.t;
isIterationFailed = isIterationFailedFin;
opts = gear_state_predicted.opts;
nsuccess = nsuccessFin;
r = rFin;
f = gear_state_predicted.f;
dt = gear_state_predicted.dt;
q = qFin;
qmax = gear_state_predicted.qmax}
// Predictor - Corrector scheme
let rec PredictorCorrector (gear_state : state) =
//Predictor step
let z0 = Matrix.copy gear_state.z
let xn = Matrix.copyCol z0 0
let n = Vector.length xn
let init_z = NordsieckMatrix_init gear_state.z
let init_state =
{ Dq = gear_state.Dq;
x = Matrix.copyCol init_z 0;
z = init_z;
delta = gear_state.delta;
e = Vector.zeros n;
t = gear_state.t;
isIterationFailed = false; opts = gear_state.opts;
nsuccess = gear_state.nsuccess; r = gear_state.r; f = gear_state.f; dt = gear_state.dt;
q = gear_state.q; qmax = gear_state.qmax
}
let MinStep = gear_state.opts.MinStep
let MaxScale = gear_state.opts.MaxScale
let MinScale = gear_state.opts.MinScale
//Corrector step
let mod_state = Corrector init_state
if mod_state.isIterationFailed
then
let mod_z = z0
let mod_nsuccess = 0
let mod_dt = mod_state.dt / 2.0
if mod_dt < 1e-12
then failwith "Cannot generate numerical solution"
else
{Dq = mod_state.Dq;
x = mod_state.x;
z = NordsieckMatrix_rescale mod_z 0.5;
delta = mod_state.delta;
e = mod_state.e;
t = mod_state.t;
isIterationFailed = false; opts = mod_state.opts;
nsuccess = mod_nsuccess; r = mod_state.r; f = mod_state.f;
dt = mod_dt;
q = mod_state.q; qmax = mod_state.qmax} |> PredictorCorrector
else
let mutable r = Math.Min(1.1, Math.Max(0.2, mod_state.r))
if (mod_state.delta >= 1.0)
then
if (mod_state.opts.MaxStep < Double.MaxValue) then
r <- (Math.Min(r, mod_state.opts.MaxStep / mod_state.dt))
if (MinStep > 0.0) then
r <- (Math.Max(r, MinStep / mod_state.dt))
r <- Math.Min(r, MaxScale)
r <- Math.Max(r, MinScale)
{ Dq = mod_state.Dq;
x = mod_state.x;
z = NordsieckMatrix_rescale mod_state.z r;
delta = mod_state.delta;
e = mod_state.e;
t = mod_state.t;
isIterationFailed = false; opts = mod_state.opts;
nsuccess = mod_state.nsuccess; r = mod_state.r; f = mod_state.f;
dt = mod_state.dt * r // Decrease step;
q = mod_state.q; qmax = mod_state.qmax
} |> PredictorCorrector
else
if (mod_state.opts.MaxStep < Double.MaxValue) then
r <- (Math.Min(r, mod_state.opts.MaxStep / mod_state.dt))
if (MinStep > 0.0) then
r <- (Math.Max(r, MinStep / mod_state.dt))
r <- Math.Min(r, MaxScale)
r <- Math.Max(r, MinScale)
let fin_state = {Dq = mod_state.Dq; x = mod_state.x;
z = NordsieckMatrix_rescale mod_state.z r;
delta = mod_state.delta; e = mod_state.e;
t = mod_state.t + mod_state.dt; isIterationFailed = mod_state.isIterationFailed;
opts = mod_state.opts;
nsuccess = mod_state.nsuccess; r = mod_state.r;
f = mod_state.f; dt = mod_state.dt * r;
q = mod_state.q;qmax = mod_state.qmax}
fin_state
let advance (gear_state : state) =
let n = Vector.length gear_state.x
let state : state = { Dq = gear_state.Dq; x = gear_state.x; z = gear_state.z;
delta = gear_state.delta; e = Vector.zeros n;
t = gear_state.t; isIterationFailed = false;
opts = gear_state.opts;
nsuccess = gear_state.nsuccess; r = gear_state.r; f = gear_state.f;
dt = gear_state.dt; q = gear_state.q; qmax = gear_state.qmax
}
PredictorCorrector state
let solve t0 t1 x0 f opts =
let mutable s = init t0 x0 f opts
let res = new System.Collections.Generic.List<_>()
while s.t < t1 do
s <- advance s
res.Add (s.t, s.x)
res |> Seq.toList

195
Oslo/Oslo.FSharp/Matrix.fs Normal file
Просмотреть файл

@ -0,0 +1,195 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo
[<JavaScript>]
type Matrix =
{
/// NOTE: currently this representaiton is much faster on CLR than a flattened
/// vector/array for large matrices, probably due to better cache locality.
/// In JS, both this representation and a flattened packed Float64Array do well.
MatrixData : Vector []
}
member mx.Item
with [<InlineJavaScript>] get (i, j) = mx.MatrixData.[i].[j]
and [<InlineJavaScript>] set (i, j) d = mx.MatrixData.[i].[j] <- d
member mx.Item
with get i = mx.MatrixData.[i]
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
[<JavaScript>]
module Matrix =
type M = Matrix
type V = Vector
let zeros rows cols =
{ MatrixData = Array.init rows (fun _ -> Vector.zeros cols) }
let numRows m =
m.MatrixData.Length
let numCols m =
Vector.length m.MatrixData.[0]
let copy mx =
{ mx with MatrixData = Array.map Vector.copy mx.MatrixData }
let ofArray (xs: double[][]) =
{ MatrixData = Array.map Vector.ofArray xs }
let ofRows (rows: V []) =
{ MatrixData = Array.map Vector.copy rows }
let copyCol (x: M) (j: int) =
let n = numRows x
let v = Vector.zeros n
for i in 0 .. n - 1 do
v.[i] <- x.[i,j]
v
let copyRow (x: M) (i: int) =
Vector.copy x.[i]
let identity (rows: int) (n: int) =
let r = zeros rows n
for i in 0 .. min (rows - 1) (n - 1) do
r.[i, i] <- 1.0
r
let sameSizeCheck (a: M) (b: M) =
let m1 = numRows a
let n1 = numCols a
let m2 = numRows b
let n2 = numCols b
if m1 <> m2 || n1 <> n2 then
failwith "Matrix dimensions do not match"
let copyTo x y =
sameSizeCheck x y
Array.iter2 Vector.copyTo x.MatrixData y.MatrixData
let vectorProduct v1 v2 =
let m = Vector.length v1
let n = Vector.length v2
let res = zeros m n
for i = 0 to m - 1 do
for j = 0 to n - 1 do
res.[i, j] <- v1.[i] * v2.[j]
res
///Implement matrix per-element mapping
/// r.[i].[j] = f(A.[i].[j]) where
/// (1) A is m x n
/// (2) f is doble -> double
/// (3) r is m x n
[<JavaScript>]
let matrMap (f : double -> double) (A : M) =
let dim1 = numRows A
let dim2 = numCols A
let r = zeros dim1 dim2
for i = 0 to dim1 - 1 do
let r_i = r.[i]
for j = 0 to dim2 - 1 do
r_i.[j] <- A.[i].[j] |> f
r
/// r = A * v where
/// (1) A is m x n
/// (2) v is n x 1
/// (3) r is mutated in place
let matrMultVecStore (A: M) (v: V) (r: double[]) =
for i in 0 .. numRows A - 1 do
let mutable s = 0.0
let row = A.[i]
for j in 0 .. numCols A - 1 do
s <- s + row.[j] * v.[j]
r.[i] <- s
let matrMultVec (A: M) (v: V) =
let store = (Vector.fastCreate (numRows A))
matrMultVecStore A v store
store |> Vector.ofArray
//Implements matrix addition
//result is C = A + B,
//A is m x n matrix,
//B is m x n matrix.
let add (A: M) (B: M) : M =
sameSizeCheck A B
{ MatrixData = Array.map2 Vector.add A.MatrixData B.MatrixData }
//Implements matrix subtraction
//result is C = A - B,
//A is m x n matrix,
//B is m x n matrix.
let subtract (A: M) (B: M) : M =
sameSizeCheck A B
{ MatrixData = Array.map2 Vector.subtract A.MatrixData B.MatrixData }
//Implements scalar by matrix multiplication
//result is C = s * A ,
//s is scalar,
//A is m x n matrix.
let scalMultMatr (s: double) (A: M) : M =
{ MatrixData = Array.map (Vector.scale s) A.MatrixData }
//Implements scalar by matrix multiplication
//result is C = A * s ,
//A is m x n matrix,
//s is scalar.
let matrMultScal (A: M) (s: double) : M =
scalMultMatr s A
let times (A: M) (s: double) : M =
scalMultMatr s A
(*let areEqual v1 v2 =
numRows v1 = numRows v2
&& Array.forall2 Vector.areEqual v1.MatrixData v2.MatrixData*)
let areEqualEps (v1: M) (v2: M) (eps: double) : bool =
numRows v1 = numRows v2
&& Array.forall2 (fun x y -> Vector.areEqualEps x y eps) v1.MatrixData v2.MatrixData
let toArray m =
Array.init (numRows m) (fun i -> Vector.toArray (copyRow m i))
let transpose m =
let rows = numRows m
let cols = numCols m
let r = zeros cols rows
for i in 0..(rows-1) do
for j in 0..(cols-1) do
r.[j].[i] <- m.[i].[j]
r
//Implements matrix multiplication by matrix
//result is C = A * B,
//A is m x n matrix,
//B is n x k matrix.
[<JavaScript>]
let matrMultMatr A B =
let dim1 = numRows A
let dim2 = numCols A
let dim3 = numCols B
if dim2 <> numRows B then failwith "Matrix dimensions do not match"
let r = zeros dim1 dim3
for i = 0 to dim1 - 1 do
let A_i = A.[i]
let r_i = r.[i]
for j = 0 to dim3 - 1 do
let mutable sum = 0.0
for k in 0 .. dim2 - 1 do
sum <- sum + A_i.[k] * B.[k, j]
r_i.[j] <- sum
r
[<AutoOpen>]
[<JavaScript>]
module MatrixNotation =
[<InlineJavaScript>]
let ( $ ) a b = Matrix.vectorProduct a b

Просмотреть файл

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Compile Include="WebSharperAttributes.fs" />
<Compile Include="Vector.fs" />
<Compile Include="Matrix.fs" />
<Compile Include="SparseVector.fs" />
<Compile Include="SparseMatrix.fs" />
<Compile Include="Gauss.fs" />
<Compile Include="RK547M.fs" />
<Compile Include="GearBDF.fs" />
<None Include="paket.references" />
</ItemGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>

342
Oslo/Oslo.FSharp/RK547M.fs Normal file
Просмотреть файл

@ -0,0 +1,342 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
[<JavaScript>]
module Oslo.RK547M
open System
open Microsoft.FSharp.Core
(*[<JavaScript>]
module Proxies =
[<Proxy(typeof<System.ArgumentException>)>]
type ArgumentExceptionProxy [<JavaScript>](message: string) =
inherit exn(message)
new () = ArgumentExceptionProxy("ArgumentException")
*)
type corrStruct =
{
x : Vector
dt : double
prevDt : double
e : double
k : Matrix
}
/// <summary>Implementation of Runge-Kutta algoritm with per-point accurancy control from
/// Dormand and Prince article.
/// (J.R.Dormand, P.J.Prince, A family of embedded Runge-Kuttae formulae)</summary>
/// <example>Let our problem will be:
/// dx/dt=y+1,
/// dy/dt=-x+2.
/// x(0)=0, y(0)=1.
/// To solve it, we just have to write
/// <code>
/// var sol=Ode.RK547M(0,new Vector(0,1),(t,x)=>new Vector(y+1,-x+2));
/// </code>
/// and then enumerate solution point from <see cref="System.IEnumerable"/> 'sol'.
/// </example>
/// <returns>Endless sequence of solution points</returns>
// Options name should match if possible: http://www.mathworks.com/help/techdoc/ref/odeset.html
type options = {
InitialStepSize : double // Initial step for solution. Default value 0 means that initial step is computed automatically
AbsoluteTolerance : double // Absolute error tolerance used in automatic step size calculations.
RelativeTolerance : double // Relative error tolerance used in automatic step size calculations.
MaxStep : double // Sets maximal step value.
MinStep : double // Sets minimal step value.
}
type state = {
t: double;
x: Vector;
f: double->Vector->Vector;
dt: double;
k: Matrix;
prevErr: double;
prevT: double;
prevX: Vector;
opts: options;
}
let defaults () = {
InitialStepSize = 0.0;
AbsoluteTolerance = 1e-6;
RelativeTolerance = 1e-3;
MaxStep = Double.MaxValue
MinStep = 1e-12;
}
let init t0 x0 f opts =
let ks = 7
let n = Vector.length x0
let state = { t = t0; x = x0; f = f; dt = 0.0; opts = opts; prevErr = 1.0
k = Matrix.zeros ks n; prevT = 0.0; prevX = x0 }
// Compute initial step (see E. Hairer book)
let dt0 =
let t0 : double = t0
let x0 : Vector = x0
if opts.InitialStepSize = 0.0
then
let sc = x0 |> Vector.map (fun a -> (opts.AbsoluteTolerance + opts.RelativeTolerance * Math.Abs(a)))
let f0 = state.f t0 x0
let d0 = (Vector.map2 (fun a b -> Math.Abs((float a / float b))) x0 sc) |> Vector.max
let d1 = (Vector.map2 (fun a b -> Math.Abs((float a / float b))) f0 sc) |> Vector.max
let h0 = if Math.Min(d0, d1) < 1e-5 then (1e-6) else (1e-2 * (d0 / d1))
let f1 = state.f (t0 + h0) (x0 +^ (h0 *< f0))
let f2 = Vector.subtract f0 f1
let sc2 = Vector.scale h0 sc
let d2 : double = (Vector.map2 (fun a b -> Math.Abs((float a / float b))) f2 sc2) |> Vector.max
let dt = if Math.Max(d1, d2) <= 1e-15 then Math.Max(1e-6, h0 * 1e-3) else Math.Pow(1e-2 / Math.Max(d1, d2), 1.0 / 5.0)
let dt1 = if dt > 100.0 * h0 then 100.0 * h0 else dt
dt1
else
opts.InitialStepSize;
{ t=t0; x=x0; f = f; dt = dt0; opts = opts; prevErr = 1.0; k = Matrix.zeros ks n; prevT = 0.0; prevX = x0; }
// <summary>Interpolation for Runge-Kutta 5(4)7M method</summary>
// <param name="s">Relative locations in the interval (t,t+dt)<\param>
// <param name="y">Solution at start time<\param>
// <param name="k">Runge-Kutta points<\param>
let rec interp (s : Vector) (y : Vector) (k : Matrix) =
if (box k = null) then failwith "interpolation array k is empty."
let n = Vector.length y
let nk = Matrix.numRows k
let ns = Vector.length s
let ys = Matrix.zeros ns n
for i = 0 to ns - 1 do
Vector.copyTo y ys.[i]
// Create cumulative product of intervals
let sp = Matrix.zeros 4 ns
for i = 0 to ns - 1 do
sp.[0].[i] <- s.[i]
for j = 1 to 3 do
sp.[j].[ i] <- s.[i] * sp.[j - 1].[i]
// Define matrix of interpolation coefficients
let BI = [|[| 1.0; -183.0 / 64.0; 37.0 / 12.0; -145.0 / 128.0 |];
[| 0.0; 0.0; 0.0; 0.0 |];
[| 0.0; 1500.0 / 371.0; -1000.0 / 159.0; 1000.0 / 371.0 |];
[| 0.0; -125.0 / 32.0; 125.0 / 12.0; -375.0 / 64.0 |];
[| 0.0; 9477.0 / 3392.0; -729.0 / 106.0; 25515.0 / 6784.0 |];
[| 0.0; -11.0 / 7.0; 11.0 / 3.0; -55.0 / 28.0 |];
[| 0.0; 3.0 / 2.0; -4.0; 5.0 / 2.0 |] |]
|> Matrix.ofArray
// Construct intermediate matrix
let mutable kBI = Matrix.zeros n 4
let mutable kBIs = Matrix.zeros n ns
for i1 = 0 to ns - 1 do
for i2 = 0 to n - 1 do
kBIs.[i2].[i1] <- 0.0
for j = 0 to 3 do
kBI.[i2].[j] <- 0.0
for l = 0 to nk - 1 do
kBI.[i2].[j] <- kBI.[i2].[j] + k.[l].[i2] * BI.[l].[j]
kBIs.[i2].[i1] <- kBIs.[i2].[i1] + kBI.[i2].[j] * sp.[j].[i1]
ys.[i1].[i2] <- ys.[i1].[i2] + kBIs.[i2].[i1]
ys
// Output interpolated points (set by Refine property) between rk_state_prev.t and rk_state_curr.t
let add_interpolate rk_state_prev rk_state_curr =
let Refine : int = 4;
let S = Vector.zeros (Refine - 1)
for i = 0 to Refine - 2 do
S.[i] <- ((float i + float 1) / (float Refine))
let ts = Array.create Refine 0.0
for i = 0 to Refine - 2 do
Array.set ts i (rk_state_prev.t + (rk_state_curr.t - rk_state_prev.t) * S.[i])
let ys = interp S rk_state_prev.x rk_state_curr.k
let rec create_interp_list (count : int) =
if count >= Refine - 1
then []
else
let rk = {t = ts.[count]; x = ys.[count]; dt = rk_state_prev.dt
prevErr = rk_state_prev.prevErr
opts = rk_state_prev.opts; f = rk_state_prev.f; k = rk_state_prev.k
prevX = if count = 0 then rk_state_prev.x else ys.[count - 1]
prevT = if count = 0 then rk_state_prev.t else ts.[count - 1]}
rk :: create_interp_list (count + 1)
(create_interp_list 0)
let private addTo k v2 v1 =
Vector.setAddedScaled v1 k v2
v1
let private scaleTo k v1 =
Vector.setScaled k v1
v1
let advance rk_state =
// Safety factors for automatic step control
// See Solving Ordinary Differential Equations I Non stiff problems by E. Hairer, S.P. Norsett, G.Wanner
// 2nd edition, Springer.
// Safety factor is recommended on page 168
let SafetyFactor : double = 0.8
let MaxFactor : double = 5.0 // Maximum possible step increase
let MinFactor : double = 0.2 // Maximum possible step decrease
let t = rk_state.t
let x = rk_state.x // Lower order approximation
// Create formulae parameters(a's,b's and c's)
// In original article, a is a step array.
let a = [| [|1.0 / 5.0|];
[|3.0 / 40.0; 9.0 / 40.0|];
[|44.0 / 45.0; -56.0 / 15.0; 32.0 / 9.0|];
[|19372.0 / 6561.0; -25360.0 / 2187.0; 64448.0 / 6561.0; -212.0 / 729.0|];
[|9017.0 / 3168.0; -355.0 / 33.0; 46732.0 / 5247.0; 49.0 / 176.0; -5103.0 / 18656.0|];
[|35.0 / 384.0; 0.0; 500.0 / 1113.0; 125.0 / 192.0; -2187.0 / 6784.0; 11.0 / 84.0|] |]
// Coeffs for higher order
let b1 = [|5179.0 / 57600.0; 0.0; 7571.0 / 16695.0; 393.0 / 640.0; -92097.0 / 339200.0; 187.0 / 2100.0; 1.0 / 40.0|]
// Coeffs for lower order
let b = [|35.0 / 384.0; 0.0; 500.0 / 1113.0; 125.0 / 192.0; -2187.0 / 6784.0; 11.0 / 84.0; 0.0|];
let c = [|0.0; 1.0 / 5.0; 3.0 / 10.0; 4.0 / 5.0; 8.0 / 9.0; 1.0; 1.0|]
let prevX = rk_state.x
let prevErr = rk_state.prevErr
let rec correction (currIter : corrStruct) =
// Initial step value. During computational process, we modify it.
let dt = currIter.dt
let prevDt = currIter.dt
let k0 =
Vector.copy x
|> rk_state.f (t + dt * c.[0])
|> scaleTo dt
let k1 =
let a0 = a.[0]
Vector.copy x
|> addTo k0 a0.[0]
|> rk_state.f (t + dt * c.[1])
|> scaleTo dt
let k2 =
let a1 = a.[1]
Vector.copy x
|> addTo k0 a1.[0]
|> addTo k1 a1.[1]
|> rk_state.f (t + dt * c.[2])
|> scaleTo dt
let k3 =
let a2 = a.[2]
Vector.copy x
|> addTo k0 a2.[0]
|> addTo k1 a2.[1]
|> addTo k2 a2.[2]
|> rk_state.f (t + dt * c.[3])
|> scaleTo dt
let k4 =
let a3 = a.[3]
Vector.copy x
|> addTo k0 a3.[0]
|> addTo k1 a3.[1]
|> addTo k2 a3.[2]
|> addTo k3 a3.[3]
|> rk_state.f (t + dt * c.[4])
|> scaleTo dt
let k5 =
let a4 = a.[4]
Vector.copy x
|> addTo k0 a4.[0]
|> addTo k1 a4.[1]
|> addTo k2 a4.[2]
|> addTo k3 a4.[3]
|> addTo k4 a4.[4]
|> rk_state.f (t + dt * c.[5])
|> scaleTo dt
let k6 =
let a5 = a.[5]
Vector.copy x
|> addTo k0 a5.[0]
|> addTo k1 a5.[1]
|> addTo k2 a5.[2]
|> addTo k3 a5.[3]
|> addTo k4 a5.[4]
|> addTo k5 a5.[5]
|> rk_state.f (t + dt * c.[6])
|> scaleTo dt
let k = Matrix.ofRows [| k0; k1; k2; k3; k4; k5; k6 |]
let xLow =
Vector.copy prevX
|> addTo k0 b.[0]
|> addTo k1 b.[1]
|> addTo k2 b.[2]
|> addTo k3 b.[3]
|> addTo k4 b.[4]
|> addTo k5 b.[5]
|> addTo k6 b.[6]
let xHigh =
Vector.copy prevX
|> addTo k0 b1.[0]
|> addTo k1 b1.[1]
|> addTo k2 b1.[2]
|> addTo k3 b1.[3]
|> addTo k4 b1.[4]
|> addTo k5 b1.[5]
|> addTo k6 b1.[6]
// Compute error (see p. 168 of book indicated above)
// error compulation in L-infinity norm is commented
let e =
Vector.mapi2 (fun i y1 y2 ->
Math.Abs (1.0 * (y1 - y2)) / Math.Max(rk_state.opts.AbsoluteTolerance, rk_state.opts.RelativeTolerance * Math.Max ( Math.Abs(prevX.[i]), Math.Abs(float y2) ))
) xLow xHigh
|> Vector.max
// PI-filter. Beta = 0.08
let dtNew =
if e = 0.0
then dt
else dt * Math.Min(MaxFactor, Math.Max(MinFactor, SafetyFactor * Math.Pow(1.0 / e, 1.0 / 5.0) * Math.Pow(prevErr, 0.08) ) )
let dtFin = if rk_state.opts.MaxStep < (Double.MaxValue) then Math.Min(dtNew , rk_state.opts.MaxStep) else dtNew
if Double.IsNaN(dtFin)
then raise (System.ArgumentException("Derivatives function returned NaN"))
else
if (dtFin < 1e-12)
then raise (System.ArgumentException("Cannot generate numerical solution"))
else
let newIter = {x = xHigh; prevDt = prevDt; dt = dtFin; e = e; k = k}
if e <= 1.0 then newIter else newIter |> correction
let nextState = correction {x = rk_state.x; e = 0.0; dt = rk_state.dt; prevDt = rk_state.dt; k = rk_state.k}
{
t = rk_state.t + nextState.prevDt
x = nextState.x
f = rk_state.f
dt = nextState.dt
prevErr = nextState.e
opts = rk_state.opts
k = nextState.k
prevT = rk_state.t
prevX = rk_state.x
}
/// <summary>Solve using Runge-Kutta 5(4) method</summary>
/// <param name="t0">Left end of current time span</param>
/// <param name="t1">Right end of current time span</param>
/// <param name="x0">Initial phase vector value</param>
/// <param name="f">System right parts vector function</param>
/// <param name="opts">Options used by solver</param>
/// <returns>List of solution points x(t)</returns>
let solve t0 t1 x0 f opts =
let mutable s = init t0 x0 f opts
let res = new System.Collections.Generic.List<_>()
while s.t < t1 do
s <- advance s
res.Add (s.t, s.x)
res |> Seq.toList

Просмотреть файл

@ -0,0 +1,358 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo
open System
open System.Windows
open System.Numerics
open Microsoft.FSharp.Core
open Microsoft.FSharp.Core.NumericLiterals
open Microsoft.FSharp.Core.Operators
open Oslo.Matrix
open Oslo.SparseVector
[<JavaScript>]
module SparseMatrix =
[<Literal>]
let Delta : int = 1
[<AllowNullLiteral>]
type SparseMatrix(rows0 : int, cols0 : int, matrixItems : double[][], matrixIndices : int[][], _count : int[]) =
//Many of these mutables are for compatilbility with WebSharper which otherwise generates "Failed to translate property access"
//As I understand it may be actually the quotations system that's causing the limitation
let mutable rows : int = rows0
let mutable cols : int = cols0
let mutable items : double[][] = matrixItems
let mutable indices : int[][] = matrixIndices
let mutable count : int[] = _count
member this.SetItems(_items:double[][]) =
items <- _items
(*let mutable this.items : double[][] = if matrixItems = null then failwith("argument is null") else matrixItems//The nonzero elements of the sparse matrix
let mutable this.indices : int[][] = if matrixIndices = null then failwith("argument is null") else matrixIndices //The this.indices of the nonzero elements in the sparse matrix
let mutable this.count : int[] = _count //Number of initialized elements*)
//new(rows0 : int, cols0 : int, matrixItems : double[][], matrixIndices : int[][], _count : int[]) = {rows = rows0; cols = cols0; items = matrixItems; indices = matrixIndices; count = _count}
new(rows0 : int, cols0 : int) = SparseMatrix(rows0, cols0, Array.init rows0 (fun _ -> Array.empty), Array.init rows0 (fun _ -> Array.empty), Array.zeroCreate rows0)
member this.Count with get() = count
and set value = count <- value
member this.CountElem with get(i) = count.[i]
and set i value = count.[i] <- value
/// <summary>Get row dimension.</summary>
/// <returns>this.m, the number of rows</returns>
member this.RowDimension with get() = rows
/// <summary>Get column dimension.</summary>
/// <returns>this.n, the number of columns.</returns>
member this.ColumnDimension with get() = cols
member this.Copy() =
let A = SparseMatrix(this.RowDimension, this.ColumnDimension, (Array.copy items), (Array.copy indices), (Array.copy count))
A
member this.Items with get(i) = items.[i]
and set(i) value = items.[i] <- value
member this.Items with get(i, j) = items.[i].[j]
and set(i, j) value = items.[i].[j] <- value
member this.Indices with get(i) = indices.[i]
and set(i) value = indices.[i] <- value
member this.Indices with get(i, j) = indices.[i].[j]
and set(i, j) value = indices.[i].[j] <- value
/// <summary>Dense version of a sparse matrix</summary>
/// <returns>A matrix equivalent</returns>
member this.DenseMatrix() =
let DM = Array.init (rows) (fun _ -> Array.zeroCreate cols)
for i in 0..this.RowDimension - 1 do
//This is faulty
for j in 0..this.ColumnDimension - 1 do
Array.set DM.[i] indices.[i].[j] items.[i].[j]
DM
/// <summary>Accessor method for (i,j)th element</summary>
member this.Item
/// <param name="i">Row index</param>
/// <param name="j">Column index</param>
/// <returns>(i,j)th element</returns>
with get(i : int, j : int) =
if (i < 0 || j < 0 || i >= rows || j >= cols)
then
failwith "Element index is out of range"
else
if (indices.[i] = null)
then
0.0
else
let jidx : int =
match Array.tryFindIndex (fun x -> x = j) indices.[i].[0..(count.[i] - 1)] with
| Some x -> x
| None -> if Array.forall (fun x -> x < j) (indices.[i].[0..(count.[i] - 1)]) then ~~~(count.[i]) else match (Array.tryFindIndex (fun x -> x > j) (indices.[i].[0..(count.[i] - 1)])) with | Some x -> ~~~x | None -> -1
if (jidx < 0) then
0.0
else
items.[i].[jidx]
/// <param name="i">Row index</param>
/// <param name="j">Column index</param>
/// <param name="value">Value to assign</param>
and set(i, j) value =
if (i < 0 || j < 0 || i >= rows || j >= cols) then
failwith "Element index is out of range"
else
if (Array.isEmpty indices.[i] || Array.length indices.[i]<1)
then
indices.[i] <- Array.zeroCreate Delta
items.[i] <- Array.zeroCreate Delta
indices.[i].[0] <- j
items.[i].[0] <- value
count.[i] <- 1
else
let jidx : int =
match Array.tryFindIndex (fun x -> x = j) indices.[i].[0..(count.[i] - 1)] with
| Some x -> x
| None -> if Array.forall (fun x -> x < j) (indices.[i].[0..(count.[i] - 1)]) then ~~~(count.[i]) else match (Array.tryFindIndex (fun x -> x > j) (indices.[i].[0..(count.[i] - 1)])) with | Some x -> ~~~x | None -> -1
if (jidx >= 0)
then
items.[i].[jidx] <- value
else
let indexToAdd = ~~~jidx;
if (count.[i] >= items.[i].Length) then
let delta = Math.Min(IncrementSize, cols - items.Length)
let newIndices : int[] = Array.zeroCreate ((Array.length indices) + delta)
let newItems : double[] = Array.zeroCreate ((Array.length items) + delta)
for k in 0..indexToAdd - 1 do Array.set newIndices k indices.[i].[k]
for k in 0..indexToAdd - 1 do Array.set newItems k items.[i].[k]
for k in 0..count.[i] - indexToAdd - 1 do
newIndices.[count.[i] - k] <- indices.[i].[count.[i] - k - 1]
newItems.[count.[i] - k] <- items.[i].[count.[i] - k - 1]
items.[i] <- newItems
indices.[i] <- newIndices
else
for k in 0..count.[i] - indexToAdd - 1 do
indices.[i].[count.[i] - k] <- indices.[i].[count.[i] - k - 1]
items.[i].[count.[i] - k] <- items.[i].[count.[i] - k - 1]
count.[i] <- count.[i] + 1
Array.set indices.[i] indexToAdd j
Array.set items.[i] indexToAdd value
/// <summary>Accessor method for ith row</summary>
member this.Item
/// <param name="i">Row index</param>
/// <returns>The ith row as a SparseVector</returns>
with get(i) = SparseVector(items.[i], indices.[i], cols)
/// <param name="i">Row index</param>
/// <param name="value">Value to assign</param>
and set i (value : SparseVector) =
indices.[i] <- value.Indices
items.[i] <- value.Items
count.[i] <- value.Length
/// <summary>Tranpose</summary>
/// <returns></returns>
member this.transpose() =
let At = SparseMatrix(this.ColumnDimension, this.RowDimension)
for i in 0..this.RowDimension - 1 do
for j in 0..(this.[i].Count) - 1 do
At.[this.[i].Indices.[j]].[i] <- this.[i].Items.[j];
At
/// <summary>Method to rescale a row of a Sparse Matrix</summary>
/// <param name="i">Index of the row to be scaled</param>
/// <param name="j1">Lowest column entry to scale</param>
/// <param name="j2">High column entry to scale</param>
/// <param name="sf">Scale factor</param>
member this.ScaleRow(i, j1, j2, sf : double) =
for k in 0..count.[i] - 1 do
if ((indices.[i].[k] >= j1) && (indices.[i].[k] <= j2)) then
items.[i].[k] <- items.[i].[k] * sf
/// <summary>Switch rows of a sparse matrix</summary>
member this.SwitchRows(i, j) =
let tempItems = items.[i]
let tempIndices = indices.[i]
let tempCount = count.[i]
items.[i] <- items.[j]
indices.[i] <- indices.[j]
count.[i] <- count.[j]
items.[j] <- tempItems
indices.[j] <- tempIndices
count.[j] <- tempCount
/// <summary>Matrix addition for a sparse matrix</summary>
/// <param name="B">The matrix to add</param>
/// <returns>The result A + B</returns>
member this.plus(B : SparseMatrix ) =
let C = SparseMatrix(rows, cols)
for r in 0..rows - 1 do
let v = (this.Item r).plus (B.Item r)
let it = v.Items
C.Items(r) <- it
C.Indices(r) <- v.Indices
C.CountElem(r) <- v.Count
C
/// <summary>Matrix subtraction for a sparse matrix</summary>
/// <param name="B">The matrix to subtract</param>
/// <returns>The result A - B</returns>
member this.minus(B : SparseMatrix ) =
let C = SparseMatrix(rows, cols)
for r in 0..rows-1 do
let v = (this.Item r).minus (B.Item r)
C.Items(r) <- v.Items
C.Indices(r) <- v.Indices
C.CountElem(r) <- v.Count
C
/// <summary>Matrix multiplication</summary>
/// <param name="v">Vector</param>
/// <returns></returns>
member this.times(v : double[]) =
let result = Array.zeroCreate rows
for i in 0..rows - 1 do
if (Array.isEmpty indices.[i] = false)
then
let mutable s = 0.0
for k in 0..count.[i] - 1 do
s <- s + items.[i].[k] * v.[indices.[i].[k]]
Array.set result i s
result
/// <summary>Matrix multiplication, y = v * A</summary>
/// <param name="v">Vector</param>
/// <returns>y</returns>
member this.timesRight(v : double[]) =
let v_ = v
let mutable result = Array.zeroCreate cols
for i in 0..rows - 1 do
//if (not (Array.isEmpty this.indices.[i])) then
let indices_i = indices.[i]
let v_i = v_.[i]
let items_i = items.[i]
for k in 0..indices_i.Length - 1 do
let indicies_ik = indices_i.[k]
result.[indicies_ik] <- result.[indicies_ik] + v_i * items_i.[k]
result
/// <summary>Matrix multiplication by a scalar</summary>
/// <param name="s">Scalar</param>
/// <returns>Scaled sparse matrix</returns>
member this.times(s : double) =
let B = SparseMatrix(rows, cols)
for i in 0..rows - 1 do
if (Array.isEmpty indices.[i] = false)
then
B.Indices(i) <- Array.zeroCreate count.[i]
B.Items(i) <- Array.zeroCreate count.[i]
for j in 0..count.[i] - 1 do
B.Indices(i, j) <- indices.[i].[j]
B.Items(i, j) <- s * items.[i].[j]
B.CountElem(i) <- count.[i]
B
/// <summary>Matrix multiplication by a scalar</summary>
/// <param name="s">Scaling factor</param>
/// <returns>Scaled sparse matrix</returns>
member this.Mul(s : double) =
for i in 0..rows - 1 do
for j in 0..count.[i] - 1 do
items.[i].[j] <- items.[i].[j] * s
this
/// <summary>Matrix right multiplication by a matrix</summary>
/// <param name="B">Scaling factor</param>
/// <returns>A * B where A is current sparce matrix</returns>
member this.times(B : SparseMatrix) =
//if (B = null) then failwith "Argument is zero"
if (B.RowDimension <> cols) then failwith "Sparse matrix inner dimensions must agree."
let C = SparseMatrix(rows, B.ColumnDimension)
for i in 0..rows - 1 do
if not (Array.isEmpty indices.[i]) then
for j in 0..B.ColumnDimension - 1 do
let mutable accumulator = 0.0
for jj in 0..count.[i] - 1 do
let ii = indices.[i].[jj]
let b_ii = B.Indices(ii)
if (not (Array.isEmpty b_ii)) then
let idx = Array.BinarySearch(b_ii,0,B.CountElem(ii),j)
if (idx >= 0) then accumulator <- accumulator + items.[i].[jj] * B.Items(ii).[idx]
if accumulator <> 0.0 then C.Item(i, j) <- accumulator
C
/// <summary>Identity matrix in sparse form</summary>
/// <param name="m">Row dimension</param>
/// <param name="n">Column dimension</param>
/// <returns>An m x n sparse identity matrix</returns>
let inline Identity(m : int, n : int) =
let o = Math.Min(m, n)
let A = SparseMatrix(m, n)
for i in 0..o - 1 do
A.[i].[i] <- 1.0
A
let inline areEqual (A : SparseMatrix) (B : SparseMatrix) =
let rec compare (a : SparseMatrix) (b : SparseMatrix) =
let mutable s = 0.0
for i in 0..a.RowDimension - 1 do
for j in 0..a.ColumnDimension - 1 do
s <- s + Math.Abs(a.[i].[j] - b.[i].[j])
s = 0.0
((A.ColumnDimension) = (B.ColumnDimension)) &&
((A.RowDimension) = (B.RowDimension)) &&
(compare A B)
let inline areEqualEps (A : SparseMatrix) (B : SparseMatrix) eps =
let rec compare (a : SparseMatrix) (b : SparseMatrix) =
let mutable s = 0.0
for i in 0..a.RowDimension - 1 do
for j in 0..a.ColumnDimension - 1 do
s <- s + Math.Abs(a.[i].[j] - b.[i].[j])
s < eps
((A.ColumnDimension) = (B.ColumnDimension)) &&
((A.RowDimension) = (B.RowDimension)) &&
(compare A B)

Просмотреть файл

@ -0,0 +1,121 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
[<JavaScript>]
module Oslo.SparseVector
open System
open Microsoft.FSharp.Core
[<Literal>]
let IncrementSize : int = 16 // Size of chunk for array increments
type SparseVector(items : double[], indices : int[], n : int) =
let n : int = n //number of elements
let mutable items : double[] = if items = null then failwith "argument is null" else items//The nonzero elements of the sparse vector
let mutable indices : int[] = if indices = null then failwith "argument is null" else indices //The indices of the nonzero elements in the sparse vector
let mutable count : int = if (Array.sumBy (fun x->x*x) items) = 0.0 then 0 else Array.length items //Number of initialized elements
new(n : int) = SparseVector(Array.zeroCreate IncrementSize, Array.zeroCreate IncrementSize, n)
member this.Items with get() = items
member this.Indices with get() = indices
member this.Count with get() = count
member this.Length with get() = n
member this.Item
with get(i : int) =
if (i < 0 || i >= n)
then failwith "index is out of range"
else
let idx : int =
match Array.tryFindIndex (fun x -> x = i) indices.[0..count - 1] with
| Some x -> x
| None ->
if Array.forall (fun x -> x < i) (indices.[0..(count - 1)])
then ~~~(count)
else
match (Array.tryFindIndex (fun x -> x > i) (indices.[0..(count - 1)])) with
| Some x -> ~~~x
| None -> -1
if idx < 0 then 0.0 else items.[idx]
and set i value =
if (i < 0 || i >= n)
then failwith "index is out of range"
else
let idx : int =
match Array.tryFindIndex (fun x -> x = i) indices.[0..count - 1] with
| Some x -> x
| None ->
if Array.forall (fun x -> x < i) (indices.[0..(count - 1)])
then ~~~(count)
else
match (Array.tryFindIndex (fun x -> x > i) (indices.[0..(count - 1)])) with
| Some x -> ~~~x
| None -> -1
if (idx >= 0)
then Array.set items idx value
else
let indexToAdd = ~~~idx
if (count >= items.Length)
then
let delta = Math.Min(IncrementSize, n - items.Length)
let newIndices : int[] = Array.zeroCreate ((Array.length indices) + delta)
let newItems : double[] = Array.zeroCreate ((Array.length items) + delta)
for k in 0..(Array.length indices) - 1 do Array.set newIndices k indices.[k]
for k in 0..(Array.length items) - 1 do Array.set newItems k items.[k]
items <- newItems
indices <- newIndices
for k in 0..count - indexToAdd - 1 do
indices.[count - k] <- indices.[count - k - 1]
items.[count - k] <- items.[count - k - 1]
count <- count + 1
Array.set indices indexToAdd i
Array.set items indexToAdd value
member this.binary f (B:SparseVector) =
//let A = this
if not (this.Length = B.Length) then failwith "Minus requires two vectors of the same length"
match (this.Count,B.Count) with
| (0,_) -> SparseVector(Array.map (f 0.0) B.Items, B.Indices, B.Length)
| (_,0) -> this
| _ ->
let tail (V:SparseVector) cV acc =
let indices, items = acc |> List.rev |> Array.ofList |> Array.unzip
SparseVector
( Array.append items V.Items.[cV..V.Count-1]
, Array.append indices V.Indices.[cV..V.Count-1]
, V.Length )
let rec loop cA cB acc =
let iA = this.Indices.[cA]
let iB = B.Indices.[cB]
match iA - iB with
| n when n < 0 ->
let new_acc = (iA, f this.Items.[iA] 0.0)::acc
if cA < this.Count-1 then
loop (cA+1) (cB) new_acc
else tail B cB new_acc
| n when n > 0 ->
let new_acc = (iB, f 0.0 B.Items.[iB])::acc
if cB < B.Count-1 then
loop (cA) (cB+1) new_acc
else tail this cA new_acc
| 0 ->
//let A_inner = A
//I changed this from let new_acc = (iA, f A.Items.[iA] B.Items.[iB])::acc
let new_acc = (iA, f this.Items.[cA] B.Items.[cB])::acc
if cA < this.Count-1 && cB < B.Count-1 then
loop (cA+1) (cB+1) new_acc
elif cA < this.Count-1 then tail this (cA+1) new_acc
else tail B (cB+1) new_acc
loop 0 0 []
member this.plus (B:SparseVector) =
this.binary (+) B
member this.minus (B:SparseVector) =
this.binary (-) B

207
Oslo/Oslo.FSharp/Vector.fs Normal file
Просмотреть файл

@ -0,0 +1,207 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Oslo
open System
type Vector =
private {
Data : double []
}
member v.Item
with [<InlineJavaScript "$0[$1]">] get (i: int) : double = v.Data.[i]
and [<InlineJavaScript "void($0[$1]=$2)">] set (i: int) (d: double) = v.Data.[i] <- d
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
[<JavaScript>]
module Vector =
type T = Vector
[<InlineJavaScript "new Float64Array($0)">]
let fastCreate (n: int) =
Array.CreateInstance(typeof<double>, n) :?> double []
[<InlineJavaScript "new Float64Array($0)">]
let zeros n = { Data = fastCreate n }
[<InlineJavaScript "$0.length">]
let length (v: Vector) = v.Data.Length
[<InlineJavaScript "$1.set($0)">]
let copyTo x y =
if x.Data.Length <> y.Data.Length then
failwith "Invalid vector lengths"
Array.Copy(x.Data, y.Data, x.Data.Length)
[<DirectJavaScript "$t.set($s.subarray($i,$i+$n),$j)">]
let blit (s: T) (i: int) (t: T) (j: int) (n: int) =
Array.Copy(s.Data, i, t.Data, j, n)
[<DirectJavaScript "new Float64Array($arr)">]
let ofArray (arr: double[]) =
let n = Array.length arr
let r = zeros n
Array.Copy(arr, r.Data, n)
r
[<DirectJavaScript "Array.prototype.slice.call($v)">]
let toArray v =
let n = length v
let r = fastCreate n
Array.Copy(v.Data, r, n)
r
let copy v =
let r = zeros (length v)
copyTo v r
r
let max v =
let mutable s = 0.0
for i in 0 .. length v - 1 do
s <- max s v.[i]
s
let update f v =
for i in 0 .. length v - 1 do
v.[i] <- f v.[i]
let updatei f v =
for i in 0 .. length v - 1 do
v.[i] <- f i v.[i]
let map f v =
let r = copy v
update f r
r
let mapi f v =
let r = copy v
updatei f r
r
let sum v =
let mutable s = 0.0
for i in 0 .. length v - 1 do
s <- s + v.[i]
s
let checkSize a b =
if length a <> length b then
failwith "Vector dimensions do not match"
[<InlineJavaScript "$0">]
[<System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)>]
let inline adapt2 (f: double -> double -> double) =
OptimizedClosures.FSharpFunc<_,_,_>.Adapt(f)
[<InlineJavaScript "$0">]
[<System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)>]
let inline adapt3 (f: int -> double -> double -> double) =
OptimizedClosures.FSharpFunc<_,_,_,_>.Adapt(f)
[<InlineJavaScript "$0($1)($2)">]
[<System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)>]
let inline invoke2 (f: OptimizedClosures.FSharpFunc<double,double,double>) x y =
f.Invoke(x, y)
[<InlineJavaScript "$0($1)($2)($3)">]
[<System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)>]
let inline invoke3 (f: OptimizedClosures.FSharpFunc<int,double,double,double>) x y z =
f.Invoke(x, y, z)
let mapi2 f v1 v2 =
checkSize v1 v2
let g = adapt3 f
let n = length v1
let r = zeros n
for i in 0 .. n - 1 do
r.[i] <- invoke3 g i v1.[i] v2.[i]
r
let map2 f v1 v2 =
checkSize v1 v2
let g = adapt2 f
let n = length v1
let r = zeros n
for i in 0 .. n - 1 do
r.[i] <- invoke2 g v1.[i] v2.[i]
r
let dot v1 v2 =
checkSize v1 v2
let mutable s = 0.0
for i in 0 .. length v1 - 1 do
s <- s + v1.[i] * v2.[i]
s
let areEqual (v1:T) (v2: T) =
let n = length v1
if n = length v2 then
v1.Data = v2.Data
else false
let areEqualEps v1 v2 eps : bool =
let n = length v1
if n = length v2 then
(v1.Data, v2.Data)
||> Seq.forall2 (fun i j -> Math.Abs(i - j) < eps)
else false
let add v1 v2 =
checkSize v1 v2
let n = length v1
let r = zeros n
for i in 0 .. n - 1 do
r.[i] <- v1.[i] + v2.[i]
r
let setAdded v1 v2 =
checkSize v1 v2
let n = length v1
for i in 0 .. n - 1 do
v1.[i] <- v1.[i] + v2.[i]
let subtract v1 v2 =
checkSize v1 v2
let n = length v1
let r = zeros n
for i in 0 .. n - 1 do
r.[i] <- v1.[i] - v2.[i]
r
let scale k v =
let r = copy v
for i in 0 .. length r - 1 do
r.[i] <- k * r.[i]
r
let setScaled k v =
let n = length v
for i in 0 .. n - 1 do
v.[i] <- k * v.[i]
let setAddedScaled x y k =
checkSize x y
let n = length x
for i in 0 .. n - 1 do
x.[i] <- x.[i] + k * y.[i]
[<AutoOpen>]
[<JavaScript>]
module VectorNotation =
[<InlineJavaScript>]
let ( *< ) a v = Vector.scale a v
[<InlineJavaScript>]
let ( *> ) v a = Vector.scale a v
[<InlineJavaScript>]
let ( +^ ) x y = Vector.add x y
[<InlineJavaScript>]
let ( -^ ) x y = Vector.subtract x y

Просмотреть файл

@ -0,0 +1,24 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace global
//these types are dummy types to enable F# portable library compilation of WebSharper intended code
open System
[<AttributeUsage(AttributeTargets.All)>]
type JavaScriptAttribute() = inherit Attribute()
[<Sealed; AttributeUsage(AttributeTargets.Constructor|||AttributeTargets.Method|||AttributeTargets.Property)>]
type InlineJavaScriptAttribute() =
inherit Attribute()
/// Constructs a new inlining annotation from a code template.
new (template: string) = InlineJavaScriptAttribute()
type DirectJavaScriptAttribute() =
inherit Attribute()
/// Constructs a new inlining annotation from a code template.
new (template: string) = DirectJavaScriptAttribute()
[<AttributeUsage(AttributeTargets.All)>]
type NamedUnionCasesAttribute() = inherit Attribute()
[<AttributeUsage(AttributeTargets.All)>]
type ConstantAttribute(n:string) = inherit Attribute()

Просмотреть файл

@ -0,0 +1,3 @@
group NETSTANDARD
FSharp.Core

Просмотреть файл

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\Users\ndalchau\.nuget\packages\yarn.msbuild\1.22.4\build\Yarn.MSBuild.props" Condition="Exists('..\..\..\..\Users\ndalchau\.nuget\packages\yarn.msbuild\1.22.4\build\Yarn.MSBuild.props')" Label="Paket" />
<Import Project="..\..\..\..\Users\ndalchau\.nuget\packages\microsoft.typescript.msbuild\3.0.3\build\Microsoft.TypeScript.MSBuild.props" Condition="Exists('..\..\..\..\Users\ndalchau\.nuget\packages\microsoft.typescript.msbuild\3.0.3\build\Microsoft.TypeScript.MSBuild.props')" Label="Paket" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{26C5140E-6B59-4A5F-9C9B-03DAB71C87D8}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<TargetFSharpCoreVersion>4.3.1.0</TargetFSharpCoreVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Oslo.JavaScript.Samples</RootNamespace>
<AssemblyName>Oslo.JavaScript.Samples</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<UseGlobalApplicationHostFile />
<TargetFrameworkProfile />
<Use64BitIISExpress />
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Content Include="index.html" />
<Content Include="Samples\Benchmarks.html" />
<Content Include="Samples\DirectBenchmarks.html" />
<Content Include="Samples\GearCosine.html" />
<Content Include="Samples\Exponent.html" />
<Content Include="Samples\Oregonator.html" />
<Content Include="Samples\OscillatingDNA.html" />
<Content Include="Samples\RKCosine.html" />
<Content Include="Samples\RM.html" />
<Content Include="Samples\Brusselator.html" />
<Content Include="Scripts\Benchmarks.js" />
<Content Include="Scripts\d3.js" />
<Content Include="Scripts\DNA_worker.js" />
<Content Include="Scripts\Helpers.js" />
<Content Include="Scripts\jquery-1.8.0.min.js" />
<Content Include="Scripts\jquery-2.0.3.min.js" />
<Content Include="Scripts\RM_worker.js" />
<Content Include="Scripts\rx.jQuery.js" />
<Content Include="Scripts\rx.js" />
<Content Include="Styles\d3.css" />
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="paket.references" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</None>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Samples\Exponent.html</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>10166</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:3933/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="..\..\..\..\Users\ndalchau\.nuget\packages\microsoft.typescript.msbuild\3.0.3\build\Microsoft.TypeScript.MSBuild.targets" Condition="Exists('..\..\..\..\Users\ndalchau\.nuget\packages\microsoft.typescript.msbuild\3.0.3\build\Microsoft.TypeScript.MSBuild.targets')" Label="Paket" />
<Import Project="..\..\..\..\Users\ndalchau\.nuget\packages\yarn.msbuild\1.22.4\build\Yarn.MSBuild.targets" Condition="Exists('..\..\..\..\Users\ndalchau\.nuget\packages\yarn.msbuild\1.22.4\build\Yarn.MSBuild.targets')" Label="Paket" />
</Project>

Просмотреть файл

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Oslo.JavaScript.Samples")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Oslo.JavaScript.Samples")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ff7c4a61-91fd-4892-bc59-f45a16d7d497")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Oscillating DNA</title>
<link rel="stylesheet" type="text/css" href="../Styles/d3.css" />
<script src="../Scripts/jquery-2.0.3.min.js"></script>
<script src="../Scripts/WebSharper/IntelliFactory.JavaScript/Runtime.js" ></script>
<script src="../Scripts/WebSharper/IntelliFactory.WebSharper.js" ></script>
<script src="../Scripts/WebSharper/Oslo.FSharp.WebSharper.js"></script>
<script src="../Scripts/WebSharper/Oslo.FSharp.Samples.js"></script>
<script type="application/javascript">
$(document).ready(function () {
var worker = new Worker("../Scripts/Benchmarks.js");
worker.onmessage = function (msg) {
$("<div>" + msg.data.text + "</div><br/>").appendTo("#timings");
}
});
</script>
</head>
<body>
<div id="timings" />
</body>
</html>

Просмотреть файл

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>R-K Brusselator</title>
<link rel="stylesheet" type="text/css" href="../Styles/d3.css" />
<script src="../Scripts/jquery-2.0.3.min.js"></script>
<script src="../Scripts/rx.js"></script>
<script src="../Scripts/rx.jQuery.js"></script>
<script src="../Scripts/d3.js"></script>
<script src="../Scripts/WebSharper/IntelliFactory.JavaScript/Runtime.js" ></script>
<script src="../Scripts/WebSharper/IntelliFactory.WebSharper.js" ></script>
<script src="../Scripts/WebSharper/Oslo.FSharp.WebSharper.js"></script>
<script src="../Scripts/WebSharper/Oslo.FSharp.Samples.js"></script>
<script type="application/javascript">
$(document).ready(function () {
IntelliFactory.Runtime.Start();
//===========
//=============
var startTime = new Date();
var sol1 = Oslo.FSharp.Samples.Brusselator(0.0, 10.0);
var endTime = new Date();
$("#timings").text("It took " + (endTime - startTime) + "ms to compute " + sol1[0].length + " points");
var chart1 = D3.asPlot($("#BrusselatorChart"))
var polyline1 = chart1.get("x2");
polyline1.draw({ x: sol1[0], y: sol1[1] });
polyline1.fitToView();
var polyline2 = chart1.get("x3");
polyline2.draw({ x: sol1[0], y: sol1[2] });
polyline2.fitToView();
});
</script>
</head>
<body>
<div id="BrusselatorChart" data-d3-plot="chart" style="width:600px;height:600px">
<div id="x2" data-d3-plot="polyline" data-d3-style="stroke: orange" data-d3-name="x1(t)"></div>
<div id="x3" data-d3-plot="polyline" data-d3-style="stroke: blue" data-d3-name="x2(t)"></div>
</div>
<div id="timings" />
</body>
</html>

Просмотреть файл

@ -0,0 +1,58 @@
<!DOCTYPE html>
<html>
<head>
<title>Benchmark Page</title>
</head>
<body>
<script type="text/javascript" src="/Scripts/WebSharper/IntelliFactory.JavaScript/Runtime.js"></script>
<script type="text/javascript" src="/Scripts/WebSharper/IntelliFactory.WebSharper.js"></script>
<script type="text/javascript" src="/Scripts/WebSharper/Oslo.FSharp.WebSharper.js"></script>
<script type="text/javascript" src="/Scripts/WebSharper/Oslo.FSharp.Samples.js"></script>
<script type="text/javascript">
function show(msg) {
console.log(msg);
var pre = document.createElement("pre");
pre.innerText = msg;
document.body.appendChild(pre);
}
function start() {
var IterationCount = 60;
var IterationSize = 20;
IntelliFactory.Runtime.Start();
show("Benchmarking OscDNA using GearBDF");
var start = new Date().getTime();
var dna = Oslo.FSharp.GearSamples.DNA_init();
var count = 0;
for (var i = 0; i < 5; i++) {
dna = Oslo.FSharp.GearSamples.DNA_solve(dna, 250)[4];
count += 250;
var end = new Date().getTime();
show("OscDNA using GearBDF: " + count + " points in " + (end - start) + " ms");
}
show("Benchmarking RM using R-K");
start = new Date().getTime();
var rm = Oslo.FSharp.Samples.RM_init();
count = 0;
for (var i = 0; i < 5; i++) {
rm = Oslo.FSharp.Samples.RM_solve(rm, 20000)[3];
count += 20000;
var end = new Date().getTime();
show("RM using R-K: " + count + " points in " + (end - start) + " ms");
}
}
start();
</script>
</body>
</html>

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше