Browse Source

Convert F# examples to F# scripts (interactive); update nuget

pull/112/head
Christoph Ruegg 13 years ago
parent
commit
5f45c842c5
  1. 10
      .editorconfig
  2. 24
      build/NuGet/nuget.proj
  3. 14
      src/FSharpExamples/Apply.fsx
  4. 15
      src/FSharpExamples/DenseVector.fsx
  5. 10
      src/FSharpExamples/FSharpExamples.fsproj
  6. 14
      src/FSharpExamples/Histogram.fsx
  7. 14
      src/FSharpExamples/MCMC.fsx
  8. 11
      src/FSharpExamples/RandomAndDistributions.fsx
  9. BIN
      tools/NuGet/nuget.exe

10
.editorconfig

@ -0,0 +1,10 @@
# This file is for unifying the coding style for different editors and IDEs.
# More information at http://EditorConfig.org
root=true
[*]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

24
build/NuGet/nuget.proj

@ -21,7 +21,7 @@
<FSharpNet40 Include="$(OutLib)/Net40/MathNet.Numerics.FSharp.dll;$(OutLib)/Net40/MathNet.Numerics.FSharp.pdb;$(OutLib)/Net40/MathNet.Numerics.FSharp.xml" />
<FSharpPortable Include="$(OutLib)/Portable/MathNet.Numerics.FSharp.dll;$(OutLib)/Portable/MathNet.Numerics.FSharp.pdb;$(OutLib)/Portable/MathNet.Numerics.FSharp.xml;" />
<NumericsSample Include="$(Examples)/**/*.cs" Exclude="$(Examples)/**/bin/**;$(Examples)/**/obj/**" />
<FSharpSample Include="$(FSharpExamples)/**/*.fs" Exclude="$(FSharpExamples)/**/bin/**;$(FSharpExamples)/**/obj/**" />
<FSharpSample Include="$(FSharpExamples)/**/*.fsx" Exclude="$(FSharpExamples)/**/bin/**;$(FSharpExamples)/**/obj/**" />
</ItemGroup>
<Target Name="CopyContentFiles">
@ -37,11 +37,11 @@
<Copy SourceFiles="@(FSharpNet40)" DestinationFolder="$(FSharpPack)/lib/net40" />
<Copy SourceFiles="@(FSharpPortable)" DestinationFolder="$(FSharpPack)/lib/portable-net45+windows8+sl5" />
<RemoveDir Directories="$(NumericsSamplePack)/Samples" />
<RemoveDir Directories="$(NumericsSamplePack)/content" />
<Copy SourceFiles="@(NumericsSample)" DestinationFiles="$(NumericsSamplePack)/content/Samples/MathNet.Numerics/%(RecursiveDir)%(Filename).cs.pp" />
<RemoveDir Directories="$(FSharpSamplePack)/Samples" />
<Copy SourceFiles="@(FSharpSample)" DestinationFiles="$(FSharpSamplePack)/content/Samples/MathNet.Numerics.FSharp/%(RecursiveDir)%(Filename).fs.pp" />
<RemoveDir Directories="$(FSharpSamplePack)/content" />
<Copy SourceFiles="@(FSharpSample)" DestinationFiles="$(FSharpSamplePack)/content/Samples/MathNet.Numerics.FSharp/%(RecursiveDir)%(Filename).fsx.pp" />
</Target>
<Target Name="UpdateNuspec" DependsOnTargets="CopyContentFiles">
@ -117,16 +117,20 @@
ReplacementText="namespace %24rootnamespace%24.Samples.MathNet.Numerics"/>
<FileUpdate
Files="@(FSharpSamplePreprocessingFiles)"
Regex="(module MathNet.Numerics.FSharp.Examples)"
ReplacementText="module %24rootnamespace%24.Samples.MathNet.Numerics.FSharp"/>
Regex="(/out/(debug|release)/Net40/MathNet\.Numerics\.dll)"
ReplacementText="/../packages/MathNet.Numerics.$(NumericsPackVersion)/lib/net40/MathNet.Numerics.dll"/>
<FileUpdate
Files="@(FSharpSamplePreprocessingFiles)"
Regex="(/out/(debug|release)/Net40/MathNet\.Numerics\.FSharp\.dll)"
ReplacementText="/../packages/MathNet.Numerics.FSharp.$(FSharpPackVersion)/lib/net40/MathNet.Numerics.FSharp.dll"/>
</Target>
<Target Name="BuildPackages" DependsOnTargets="UpdateNuspec;PatchContentFiles">
<MakeDir Directories="$(OutNuGetPackages)" />
<Exec Command="$(NuGetExe) pack $(NumericsPack)/MathNet.Numerics.nuspec /Verbose /OutputDirectory $(OutNuGetPackages)" />
<Exec Command="$(NuGetExe) pack $(FSharpPack)/MathNet.Numerics.FSharp.nuspec /Verbose /OutputDirectory $(OutNuGetPackages)" />
<Exec Command="$(NuGetExe) pack $(NumericsSamplePack)/MathNet.Numerics.Sample.nuspec /Verbose /OutputDirectory $(OutNuGetPackages)" />
<Exec Command="$(NuGetExe) pack $(FSharpSamplePack)/MathNet.Numerics.FSharp.Sample.nuspec /Verbose /OutputDirectory $(OutNuGetPackages)" />
<Exec Command="$(NuGetExe) pack $(NumericsPack)/MathNet.Numerics.nuspec -Verbosity detailed -OutputDirectory $(OutNuGetPackages)" />
<Exec Command="$(NuGetExe) pack $(FSharpPack)/MathNet.Numerics.FSharp.nuspec -Verbosity detailed -OutputDirectory $(OutNuGetPackages)" />
<Exec Command="$(NuGetExe) pack $(NumericsSamplePack)/MathNet.Numerics.Sample.nuspec -Verbosity detailed -OutputDirectory $(OutNuGetPackages)" />
<Exec Command="$(NuGetExe) pack $(FSharpSamplePack)/MathNet.Numerics.FSharp.Sample.nuspec -Verbosity detailed -OutputDirectory $(OutNuGetPackages)" />
</Target>
</Project>

14
src/FSharpExamples/Apply.fs → src/FSharpExamples/Apply.fsx

@ -1,8 +1,10 @@
// <copyright file="Apply.fs" company="Math.NET">
// <copyright file="Apply.fsx" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://mathnet.opensourcedotnet.info
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009 Math.NET
// Copyright (c) 2009-2013 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -25,7 +27,9 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
module MathNet.Numerics.FSharp.Examples.Apply
#r "../../out/debug/Net40/MathNet.Numerics.dll"
#r "../../out/debug/Net40/MathNet.Numerics.FSharp.dll"
open System.Numerics
open MathNet.Numerics
@ -91,4 +95,4 @@ for (name, fs, dotnet) in FunctionList do
else printf "\t%d" sw.ElapsedMilliseconds
sw.Reset()*)
printfn ""
printfn ""

15
src/FSharpExamples/DenseVector.fs → src/FSharpExamples/DenseVector.fsx

@ -1,8 +1,10 @@
// <copyright file="DenseVector.fs" company="Math.NET">
// <copyright file="DenseVector.fsx" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://mathnet.opensourcedotnet.info
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009 Math.NET
// Copyright (c) 2009-2013 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -25,7 +27,9 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
module MathNet.Numerics.FSharp.Examples.DenseVector
#r "../../out/debug/Net40/MathNet.Numerics.dll"
#r "../../out/debug/Net40/MathNet.Numerics.FSharp.dll"
open MathNet.Numerics.LinearAlgebra
open MathNet.Numerics.LinearAlgebra.Double
@ -45,9 +49,8 @@ let z = v + w
// ... or scale them in the process.
let x = v + 3.0 * t
// We can create a vector from an integer range (in this case, 5 and 10 inclusive) ...
let s = DenseVector.range 5 10
// ... or we can create a vector from a double range with a particular step size.
let r = DenseVector.rangef 0.0 0.1 10.0
let r = DenseVector.rangef 0.0 0.1 10.0

10
src/FSharpExamples/FSharpExamples.fsproj

@ -60,11 +60,11 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="DenseVector.fs" />
<Compile Include="Apply.fs" />
<Compile Include="Histogram.fs" />
<Compile Include="MCMC.fs" />
<Compile Include="RandomAndDistributions.fs" />
<None Include="DenseVector.fsx" />
<None Include="Apply.fsx" />
<None Include="Histogram.fsx" />
<None Include="MCMC.fsx" />
<None Include="RandomAndDistributions.fsx" />
</ItemGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>

14
src/FSharpExamples/Histogram.fs → src/FSharpExamples/Histogram.fsx

@ -1,8 +1,10 @@
// <copyright file="Histogram.fs" company="Math.NET">
// <copyright file="Histogram.fsx" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://mathnet.opensourcedotnet.info
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009 Math.NET
// Copyright (c) 2009-2013 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -25,7 +27,9 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
module MathNet.Numerics.FSharp.Examples.Histogram
#r "../../out/debug/Net40/MathNet.Numerics.dll"
#r "../../out/debug/Net40/MathNet.Numerics.FSharp.dll"
open MathNet.Numerics.Statistics
@ -41,4 +45,4 @@ let hist = new Histogram(data, B)
// Print some histogram information.
printfn "Histogram.ToString(): %O" hist
for i in 0 .. B-1 do
printfn "Bucket %d contains %f datapoints." i hist.[i].Count
printfn "Bucket %d contains %f datapoints." i hist.[i].Count

14
src/FSharpExamples/MCMC.fs → src/FSharpExamples/MCMC.fsx

@ -1,8 +1,10 @@
// <copyright file="MCMC.fs" company="Math.NET">
// <copyright file="MCMC.fsx" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://mathnet.opensourcedotnet.info
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009 Math.NET
// Copyright (c) 2009-2013 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -25,7 +27,9 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
module MathNet.Numerics.FSharp.Examples.Mcmc
#r "../../out/debug/Net40/MathNet.Numerics.dll"
#r "../../out/debug/Net40/MathNet.Numerics.FSharp.dll"
open MathNet.Numerics.Random
open MathNet.Numerics.Statistics
@ -198,4 +202,4 @@ do
System.Console.ReadLine() |> ignore
System.Console.ReadLine() |> ignore

11
src/FSharpExamples/RandomAndDistributions.fs → src/FSharpExamples/RandomAndDistributions.fsx

@ -1,8 +1,10 @@
// <copyright file="RandomAndDistributions.fs" company="Math.NET">
// <copyright file="RandomAndDistributions.fsx" company="Math.NET">
// Math.NET Numerics, part of the Math.NET Project
// http://mathnet.opensourcedotnet.info
// http://numerics.mathdotnet.com
// http://github.com/mathnet/mathnet-numerics
// http://mathnetnumerics.codeplex.com
//
// Copyright (c) 2009-2012 Math.NET
// Copyright (c) 2009-2013 Math.NET
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
@ -26,7 +28,8 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
module RandomAndDistributions
#r "../../out/debug/Net40/MathNet.Numerics.dll"
#r "../../out/debug/Net40/MathNet.Numerics.FSharp.dll"
open MathNet.Numerics.Random
open MathNet.Numerics.Distributions

BIN
tools/NuGet/nuget.exe

Binary file not shown.
Loading…
Cancel
Save