diff --git a/Backup/MathNet.Numerics.sln b/Backup/MathNet.Numerics.sln new file mode 100644 index 00000000..82a49c1d --- /dev/null +++ b/Backup/MathNet.Numerics.sln @@ -0,0 +1,88 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "src\Examples\Examples.csproj", "{8239A6FF-1EF3-4DA4-A860-95C392DD6899}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Numerics", "src\Numerics\Numerics.csproj", "{B7CAE5F4-A23F-4438-B5BE-41226618B695}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp", "src\FSharp\FSharp.fsproj", "{37E8E802-A354-4114-BFC1-6E1357DA605B}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharpExamples", "src\FSharpExamples\FSharpExamples.fsproj", "{BC81EA37-8EE6-4BF9-B8A9-B30497AEF8B1}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharpUnitTests", "src\FSharpUnitTests\FSharpUnitTests.fsproj", "{F2F8032B-A31D-4E33-A05E-F2CDCBFAA75D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{4D50FB34-10BC-495A-8B2F-482E34B4D771}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{49EE74BD-301F-4C3B-B76A-07F90CC88CE7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "src\UnitTests\UnitTests.csproj", "{DAF07AA8-C5C9-4963-98F7-2C3285064DAD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Readme", "Readme", "{C2F37492-38AE-4186-8A7F-17B0B080942C}" + ProjectSection(SolutionItems) = preProject + AUTHORS.markdown = AUTHORS.markdown + COPYRIGHT.markdown = COPYRIGHT.markdown + README.markdown = README.markdown + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Numerics.IO", "src\Numerics.IO\Numerics.IO.csproj", "{EB1A5D32-F264-4BCE-BEB7-0B97085075BE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + Release-Signed|Any CPU = Release-Signed|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8239A6FF-1EF3-4DA4-A860-95C392DD6899}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8239A6FF-1EF3-4DA4-A860-95C392DD6899}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8239A6FF-1EF3-4DA4-A860-95C392DD6899}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8239A6FF-1EF3-4DA4-A860-95C392DD6899}.Release|Any CPU.Build.0 = Release|Any CPU + {8239A6FF-1EF3-4DA4-A860-95C392DD6899}.Release-Signed|Any CPU.ActiveCfg = Release-Signed|Any CPU + {8239A6FF-1EF3-4DA4-A860-95C392DD6899}.Release-Signed|Any CPU.Build.0 = Release-Signed|Any CPU + {B7CAE5F4-A23F-4438-B5BE-41226618B695}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7CAE5F4-A23F-4438-B5BE-41226618B695}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release|Any CPU.Build.0 = Release|Any CPU + {B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release-Signed|Any CPU.ActiveCfg = Release-Signed|Any CPU + {B7CAE5F4-A23F-4438-B5BE-41226618B695}.Release-Signed|Any CPU.Build.0 = Release-Signed|Any CPU + {37E8E802-A354-4114-BFC1-6E1357DA605B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {37E8E802-A354-4114-BFC1-6E1357DA605B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {37E8E802-A354-4114-BFC1-6E1357DA605B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {37E8E802-A354-4114-BFC1-6E1357DA605B}.Release|Any CPU.Build.0 = Release|Any CPU + {37E8E802-A354-4114-BFC1-6E1357DA605B}.Release-Signed|Any CPU.ActiveCfg = Release-Signed|Any CPU + {37E8E802-A354-4114-BFC1-6E1357DA605B}.Release-Signed|Any CPU.Build.0 = Release-Signed|Any CPU + {BC81EA37-8EE6-4BF9-B8A9-B30497AEF8B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BC81EA37-8EE6-4BF9-B8A9-B30497AEF8B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BC81EA37-8EE6-4BF9-B8A9-B30497AEF8B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BC81EA37-8EE6-4BF9-B8A9-B30497AEF8B1}.Release|Any CPU.Build.0 = Release|Any CPU + {BC81EA37-8EE6-4BF9-B8A9-B30497AEF8B1}.Release-Signed|Any CPU.ActiveCfg = Release-Signed|Any CPU + {BC81EA37-8EE6-4BF9-B8A9-B30497AEF8B1}.Release-Signed|Any CPU.Build.0 = Release-Signed|Any CPU + {F2F8032B-A31D-4E33-A05E-F2CDCBFAA75D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F2F8032B-A31D-4E33-A05E-F2CDCBFAA75D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2F8032B-A31D-4E33-A05E-F2CDCBFAA75D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F2F8032B-A31D-4E33-A05E-F2CDCBFAA75D}.Release|Any CPU.Build.0 = Release|Any CPU + {F2F8032B-A31D-4E33-A05E-F2CDCBFAA75D}.Release-Signed|Any CPU.ActiveCfg = Release-Signed|Any CPU + {F2F8032B-A31D-4E33-A05E-F2CDCBFAA75D}.Release-Signed|Any CPU.Build.0 = Release-Signed|Any CPU + {DAF07AA8-C5C9-4963-98F7-2C3285064DAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DAF07AA8-C5C9-4963-98F7-2C3285064DAD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DAF07AA8-C5C9-4963-98F7-2C3285064DAD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DAF07AA8-C5C9-4963-98F7-2C3285064DAD}.Release|Any CPU.Build.0 = Release|Any CPU + {DAF07AA8-C5C9-4963-98F7-2C3285064DAD}.Release-Signed|Any CPU.ActiveCfg = Release-Signed|Any CPU + {DAF07AA8-C5C9-4963-98F7-2C3285064DAD}.Release-Signed|Any CPU.Build.0 = Release-Signed|Any CPU + {EB1A5D32-F264-4BCE-BEB7-0B97085075BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EB1A5D32-F264-4BCE-BEB7-0B97085075BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EB1A5D32-F264-4BCE-BEB7-0B97085075BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EB1A5D32-F264-4BCE-BEB7-0B97085075BE}.Release|Any CPU.Build.0 = Release|Any CPU + {EB1A5D32-F264-4BCE-BEB7-0B97085075BE}.Release-Signed|Any CPU.ActiveCfg = Release-Signed|Any CPU + {EB1A5D32-F264-4BCE-BEB7-0B97085075BE}.Release-Signed|Any CPU.Build.0 = Release-Signed|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {BC81EA37-8EE6-4BF9-B8A9-B30497AEF8B1} = {49EE74BD-301F-4C3B-B76A-07F90CC88CE7} + {8239A6FF-1EF3-4DA4-A860-95C392DD6899} = {49EE74BD-301F-4C3B-B76A-07F90CC88CE7} + {F2F8032B-A31D-4E33-A05E-F2CDCBFAA75D} = {4D50FB34-10BC-495A-8B2F-482E34B4D771} + {DAF07AA8-C5C9-4963-98F7-2C3285064DAD} = {4D50FB34-10BC-495A-8B2F-482E34B4D771} + EndGlobalSection +EndGlobal diff --git a/Backup/src/FSharp/AssemblyInfo.fs b/Backup/src/FSharp/AssemblyInfo.fs new file mode 100644 index 00000000..e64c03b7 --- /dev/null +++ b/Backup/src/FSharp/AssemblyInfo.fs @@ -0,0 +1,51 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://numerics.mathdotnet.com +// http://github.com/mathnet/mathnet-numerics +// http://mathnetnumerics.codeplex.com +// +// Copyright (c) 2009 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +namespace MathNet.Numerics + +open System.Reflection +open System.Resources; +open System.Runtime.CompilerServices +open System.Runtime.InteropServices + +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +() diff --git a/Backup/src/FSharp/DenseMatrix.fs b/Backup/src/FSharp/DenseMatrix.fs new file mode 100644 index 00000000..01497f72 --- /dev/null +++ b/Backup/src/FSharp/DenseMatrix.fs @@ -0,0 +1,101 @@ +// +// 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 +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +namespace MathNet.Numerics.LinearAlgebra.Double +open MathNet.Numerics.LinearAlgebra +open MathNet.Numerics.LinearAlgebra.Generic + +/// A module which implements functional dense vector operations. +module DenseMatrix = + + /// Initialize a matrix by calling a construction function for every element. + let inline init (n: int) (m: int) f = + let A = new DenseMatrix(n,m) + for i=0 to n-1 do + for j=0 to m-1 do + A.[i,j] <- f i j + A + + /// Create a matrix from a list of float lists. Every list in the master list specifies a row. + let inline ofList (fll: float list list) = + let n = List.length fll + let m = List.length (List.head fll) + let A = DenseMatrix(n,m) + fll |> List.iteri (fun i fl -> + if (List.length fl) <> m then failwith "Each subrow must be of the same length." else + List.iteri (fun j f -> A.[i,j] <- f) fl) + A + + /// Create a matrix from a list of sequences. Every sequence in the master sequence specifies a row. + let inline ofSeq (fss: #seq<#seq>) = + let n = Seq.length fss + let m = Seq.length (Seq.head fss) + let A = DenseMatrix(n,m) + fss |> Seq.iteri (fun i fs -> + if (Seq.length fs) <> m then failwith "Each subrow must be of the same length." else + Seq.iteri (fun j f -> A.[i,j] <- f) fs) + A + + /// Create a matrix from a 2D array of floating point numbers. + let inline ofArray2 (arr: float[,]) = new DenseMatrix(arr) + + /// Create a matrix with the given entries. + let inline initDense (n: int) (m: int) (es: #seq) = + let A = new DenseMatrix(n,m) + Seq.iter (fun (i,j,f) -> A.[i,j] <- f) es + A + + /// Create a square matrix with constant diagonal entries. + let inline constDiag (n: int) (f: float) = + let A = new DenseMatrix(n,n) + for i=0 to n-1 do + A.[i,i] <- f + A + + /// Create a square matrix with the vector elements on the diagonal. + let inline diag (v: #Vector) = + let n = v.Count + let A = new DenseMatrix(n,n) + for i=0 to n-1 do + A.[i,i] <- v.Item(i) + A + + /// Initialize a matrix by calling a construction function for every row. + let inline initRow (n: int) (m: int) (f: int -> #Vector) = + let A = new DenseMatrix(n,m) + for i=0 to n-1 do A.SetRow(i, f i) + A + + /// Initialize a matrix by calling a construction function for every column. + let inline initCol (n: int) (m: int) (f: int -> #Vector) = + let A = new DenseMatrix(n,m) + for i=0 to m-1 do A.SetColumn(i, f i) + A \ No newline at end of file diff --git a/Backup/src/FSharp/DenseVector.fs b/Backup/src/FSharp/DenseVector.fs new file mode 100644 index 00000000..3e56484e --- /dev/null +++ b/Backup/src/FSharp/DenseVector.fs @@ -0,0 +1,69 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://numerics.mathdotnet.com +// http://github.com/mathnet/mathnet-numerics +// http://mathnetnumerics.codeplex.com +// +// Copyright (c) 2009 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +namespace MathNet.Numerics.LinearAlgebra.Double + +open MathNet.Numerics.LinearAlgebra + +/// A module which implements functional dense vector operations. +module DenseVector = + + /// Initialize a vector by calling a construction function for every element. + let inline init (n: int) f = + let v = new Double.DenseVector(n) + for i=0 to n-1 do + v.[i] <- f i + v + + /// Create a vector from a float list. + let inline ofList (fl: float list) = + let n = List.length fl + let v = Double.DenseVector(n) + fl |> List.iteri (fun i f -> v.[i] <- f) + v + + /// Create a vector from a sequences. + let inline ofSeq (fs: #seq) = + let n = Seq.length fs + let v = DenseVector(n) + fs |> Seq.iteri (fun i f -> v.[i] <- f) + v + + /// Create a vector with evenly spaced entries: e.g. rangef -1.0 0.5 1.0 = [-1.0 -0.5 0.0 0.5 1.0] + let inline rangef (start: float) (step: float) (stop: float) = + let n = (int ((stop - start) / step)) + 1 + let v = new DenseVector(n) + for i=0 to n-1 do + v.[i] <- (float i) * step + start + v + + /// Create a vector with integer entries in the given range. + let inline range (start: int) (stop: int) = + new DenseVector([| for i in [start .. stop] -> float i |]) \ No newline at end of file diff --git a/Backup/src/FSharp/Extensions.fs b/Backup/src/FSharp/Extensions.fs new file mode 100644 index 00000000..7ca5b7dd --- /dev/null +++ b/Backup/src/FSharp/Extensions.fs @@ -0,0 +1,68 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://numerics.mathdotnet.com +// http://github.com/mathnet/mathnet-numerics +// http://mathnetnumerics.codeplex.com +// +// Copyright (c) 2009 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +namespace MathNet.Numerics.LinearAlgebra.Generic + +// Module that contains implementation of useful F#-specific +// extension members for generic Matrix and Vector types +[] +module FSharpExtensions = + + // A type extension for the generic vector type that + // adds the 'GetSlice' method to allow vec.[a .. b] syntax + type MathNet.Numerics.LinearAlgebra.Generic. + Vector<'T when 'T : struct and 'T : (new : unit -> 'T) + and 'T :> System.IEquatable<'T> and 'T :> System.IFormattable + and 'T :> System.ValueType> with + + /// Gets a slice of a vector starting at a specified index + /// and ending at a specified index (both indices are optional) + /// This method can be used via the x.[start .. finish] syntax + member x.GetSlice(start, finish) = + let start = defaultArg start 0 + let finish = defaultArg finish (x.Count - 1) + x.SubVector(start, finish - start + 1) + + // A type extension for the generic matrix type that + // adds the 'GetSlice' method to allow m.[r1 .. r2, c1 .. c2] syntax + type MathNet.Numerics.LinearAlgebra.Generic. + Matrix<'T when 'T : struct and 'T : (new : unit -> 'T) + and 'T :> System.IEquatable<'T> and 'T :> System.IFormattable + and 'T :> System.ValueType> with + + /// Gets a submatrix using a specified column range and + /// row range (all indices are optional) + /// This method can be used via the x.[r1 .. r2, c1 .. c2 ] syntax + member x.GetSlice(rstart, rfinish, cstart, cfinish) = + let cstart = defaultArg cstart 0 + let rstart = defaultArg rstart 0 + let cfinish = defaultArg cfinish (x.ColumnCount - 1) + let rfinish = defaultArg rfinish (x.RowCount - 1) + x.SubMatrix(rstart, rfinish - rstart + 1, cstart, cfinish - cstart + 1) \ No newline at end of file diff --git a/Backup/src/FSharp/FSharp.fsproj b/Backup/src/FSharp/FSharp.fsproj new file mode 100644 index 00000000..53e98c55 --- /dev/null +++ b/Backup/src/FSharp/FSharp.fsproj @@ -0,0 +1,80 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {37e8e802-a354-4114-bfc1-6e1357da605b} + Library + FSharp + MathNet.Numerics.FSharp + v4.0 + FSharp + + + + true + full + false + false + ..\..\out\debug\Net40\ + DEBUG;TRACE + 3 + + + pdbonly + true + true + ..\..\out\lib\Net40\ + TRACE + 3 + ..\..\out\lib\Net40\MathNet.Numerics.FSharp.xml + + + MathNet.Numerics.FSharp.XML + + + pdbonly + true + true + TRACE + 3 + ..\..\out\lib\Net40\MathNet.Numerics.FSharp.xml + bin\Release-Signed\ + + + + + + + + + + + + + + + + + + + + 3.5 + + + + Numerics + {b7cae5f4-a23f-4438-b5be-41226618b695} + True + + + + \ No newline at end of file diff --git a/Backup/src/FSharp/Main.fs b/Backup/src/FSharp/Main.fs new file mode 100644 index 00000000..9bb5c897 --- /dev/null +++ b/Backup/src/FSharp/Main.fs @@ -0,0 +1,43 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://numerics.mathdotnet.com +// http://github.com/mathnet/mathnet-numerics +// http://mathnetnumerics.codeplex.com +// +// Copyright (c) 2009 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +namespace MathNet.Numerics + +open MathNet.Numerics.LinearAlgebra.Double +open MathNet.Numerics.LinearAlgebra.Generic + +/// A module which implements some F# utility functions. +module FSharp = + + /// Construct a dense matrix from a list of floating point numbers. + let inline matrix (lst: list>) = DenseMatrix.ofList lst :> Matrix + + /// Construct a dense vector from a list of floating point numbers. + let inline vector (lst: list) = DenseVector.ofList lst :> Vector \ No newline at end of file diff --git a/Backup/src/FSharp/Matrix.fs b/Backup/src/FSharp/Matrix.fs new file mode 100644 index 00000000..e25a71e9 --- /dev/null +++ b/Backup/src/FSharp/Matrix.fs @@ -0,0 +1,243 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://numerics.mathdotnet.com +// http://github.com/mathnet/mathnet-numerics +// http://mathnetnumerics.codeplex.com +// +// Copyright (c) 2009 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +namespace MathNet.Numerics.LinearAlgebra.Double + +open MathNet.Numerics.LinearAlgebra.Double +open MathNet.Numerics.LinearAlgebra.Generic + +/// A module which implements functional matrix operations. +module Matrix = + + /// Fold a function over all matrix elements. + let inline fold (f: 'a -> float -> 'a) (acc0: 'a) (A: #Matrix) = + let n = A.RowCount + let m = A.ColumnCount + let mutable acc = acc0 + for i=0 to n-1 do + for j=0 to m-1 do + acc <- f acc (A.Item(i,j)) + acc + + /// Fold a function over all matrix elements in reverse order. + let inline foldBack (f: float -> 'a -> 'a) (acc0: 'a) (A: #Matrix) = + let n = A.RowCount + let m = A.ColumnCount + let mutable acc = acc0 + for i in n-1 .. -1 .. 0 do + for j in m-1 .. -1 .. 0 do + acc <- f (A.Item(i,j)) acc + acc + + /// Fold a matrix by applying a given function to all matrix elements. + let inline foldi (f: int -> int -> 'a -> float -> 'a) (acc0: 'a) (A: #Matrix) = + let n = A.RowCount + let m = A.ColumnCount + let mutable acc = acc0 + for i=0 to n-1 do + for j=0 to m-1 do + acc <- f i j acc (A.Item(i,j)) + acc + + /// Create a 2D array from a matrix. + let inline toArray2 (A: #Matrix) = + let n = A.RowCount + let m = A.ColumnCount + Array2D.init n m (fun i j -> (A.Item(i,j))) + + /// Checks whether a predicate holds for all elements of a matrix. + let inline forall (p: float -> bool) (A: #Matrix) = + let mutable b = true + let mutable i = 0 + let mutable j = 0 + while b && i < A.RowCount do + b <- b && (p (A.Item(i,j))) + j <- j+1 + if j = A.ColumnCount then i <- i+1; j <- 0 + b + + /// Chechks whether a predicate holds for at least one element of a matrix. + let inline exists (p: float -> bool) (A: #Matrix) = + let mutable b = false + let mutable i = 0 + let mutable j = 0 + while not(b) && i < A.RowCount do + b <- b || (p (A.Item(i,j))) + j <- j+1 + if j = A.ColumnCount then i <- i+1; j <- 0 + b + + /// Checks whether a position dependent predicate holds for all elements of a matrix. + let inline foralli (p: int -> int -> float -> bool) (A: #Matrix) = + let mutable b = true + let mutable i = 0 + let mutable j = 0 + while b && i < A.RowCount do + b <- b && (p i j (A.Item(i,j))) + j <- j+1 + if j = A.ColumnCount then i <- i+1; j <- 0 + b + + /// Checks whether a position dependent predicate holds for at least one element of a matrix. + let inline existsi (p: int -> int -> float -> bool) (A: #Matrix) = + let mutable b = false + let mutable i = 0 + let mutable j = 0 + while not(b) && i < A.RowCount do + b <- b || (p i j (A.Item(i,j))) + j <- j+1 + if j = A.ColumnCount then i <- i+1; j <- 0 + b + + /// Map every matrix element using the given function. + let inline map (f: float -> float) (A: #Matrix) = + let N = A.RowCount + let M = A.ColumnCount + let C = A.Clone() + for i=0 to N-1 do + for j=0 to M-1 do + C.[i,j] <- f (C.Item(i,j)) + C + + /// Map every matrix element using the given position dependent function. + let inline mapi (f: int -> int -> float -> float) (A: #Matrix) = + let N = A.RowCount + let M = A.ColumnCount + let C = A.Clone() + for i=0 to N-1 do + for j=0 to M-1 do + C.[i,j] <- f i j (C.Item(i,j)) + C + + /// In-place map every matrix column using the given position dependent function. + let inline inplaceMapCols (f: int -> Vector -> Vector) (A: #Matrix) = + for j = 0 to A.ColumnCount-1 do + A.SetColumn(j, f j (A.Column(j))) + () + + /// In-place map every matrix row using the given position dependent function. + let inline inplaceMapRows (f: int -> Vector -> Vector) (A: #Matrix) = + for i = 0 to A.RowCount-1 do + A.SetRow(i, f i (A.Row(i))) + () + + /// Map every matrix column using the given position dependent function. + let inline mapCols (f: int -> Vector -> Vector) (A: #Matrix) = + let A = A.Clone() + inplaceMapCols f A + A + + /// Map every matrix row using the given position dependent function. + let inline mapRows (f: int -> Vector -> Vector) (A: #Matrix) = + let A = A.Clone() + inplaceMapRows f A + A + + /// In-place assignment. + let inline inplaceAssign (f: int -> int -> float) (A: #Matrix) = + for i=0 to A.RowCount-1 do + for j=0 to A.ColumnCount-1 do + A.Item(i,j) <- f i j + + /// In-place map of every matrix element using a position dependent function. + let inline inplaceMapi (f: int -> int -> float -> float) (A: #Matrix) = + for i=0 to A.RowCount-1 do + for j=0 to A.ColumnCount-1 do + A.Item(i,j) <- f i j (A.Item(i,j)) + + /// Creates a sequence that iterates the non-zero entries in the matrix. + let inline nonZeroEntries (A: #Matrix) = + seq { for i in 0 .. A.RowCount-1 do + for j in 0 .. A.ColumnCount-1 do + if A.Item(i,j) <> 0.0 then yield (i,j, A.Item(i,j)) } + + /// Returns the sum of all elements of a matrix. + let inline sum (A: #Matrix) = + let mutable f = 0.0 + for i=0 to A.RowCount-1 do + for j=0 to A.ColumnCount-1 do + f <- f + A.Item(i,j) + f + + /// Returns the sum of the results generated by applying a position dependent function to each column of the matrix. + let inline sumColsBy (f: int -> Vector -> 'a) (A: #Matrix) = + A.ColumnEnumerator() |> Seq.map (fun (j,col) -> f j col) |> Seq.reduce (+) + + /// Returns the sum of the results generated by applying a position dependent function to each row of the matrix. + let inline sumRowsBy (f: int -> Vector -> 'a) (A: #Matrix) = + A.RowEnumerator() |> Seq.map (fun (i,row) -> f i row) |> Seq.reduce (+) + + /// Iterates over all elements of a matrix. + let inline iter (f: float -> unit) (A: #Matrix) = + for i=0 to A.RowCount-1 do + for j=0 to A.ColumnCount-1 do + f (A.Item(i,j)) + () + + /// Iterates over all elements of a matrix using the element indices. + let inline iteri (f: int -> int -> float -> unit) (A: #Matrix) = + for i=0 to A.RowCount-1 do + for j=0 to A.ColumnCount-1 do + f i j (A.Item(i,j)) + () + + /// Fold one column. + let inline foldCol (f: 'a -> float -> 'a) acc (A: #Matrix) k = + let mutable macc = acc + for i=0 to A.RowCount-1 do + macc <- f macc (A.Item(i,k)) + macc + + /// Fold one row. + let inline foldRow (f: 'a -> float -> 'a) acc (A: #Matrix) k = + let mutable macc = acc + for i=0 to A.ColumnCount-1 do + macc <- f macc (A.Item(k,i)) + macc + + /// Fold all columns into one row vector. + let inline foldByCol (f: float -> float -> float) acc (A: #Matrix) = + let v = new DenseVector(A.ColumnCount) + for k=0 to A.ColumnCount-1 do + let mutable macc = acc + for i=0 to A.RowCount-1 do + macc <- f macc (A.Item(i,k)) + v.[k] <- macc + v :> Vector + + /// Fold all rows into one column vector. + let inline foldByRow (f: float -> float -> float) acc (A: #Matrix) = + let v = new DenseVector(A.RowCount) + for k=0 to A.RowCount-1 do + let mutable macc = acc + for i=0 to A.ColumnCount-1 do + macc <- f macc (A.Item(k,i)) + v.[k] <- macc + v :> Vector \ No newline at end of file diff --git a/Backup/src/FSharp/SparseMatrix.fs b/Backup/src/FSharp/SparseMatrix.fs new file mode 100644 index 00000000..7d996697 --- /dev/null +++ b/Backup/src/FSharp/SparseMatrix.fs @@ -0,0 +1,75 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://numerics.mathdotnet.com +// http://github.com/mathnet/mathnet-numerics +// http://mathnetnumerics.codeplex.com +// +// Copyright (c) 2009 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +namespace MathNet.Numerics.LinearAlgebra.Double + +open MathNet.Numerics.LinearAlgebra +open MathNet.Numerics.LinearAlgebra.Generic +/// A module which implements functional sparse vector operations. +module SparseMatrix = + + /// Create a matrix from a list of float lists. Every list in the master list specifies a row. + let inline ofList (rows: int) (cols: int) (fll: list) = + let A = new Double.SparseMatrix(rows, cols) + fll |> List.iter (fun (i, j, x) -> A.[i,j] <- x) + A + + /// Create a matrix from a list of sequences. Every sequence in the master sequence specifies a row. + let inline ofSeq (rows: int) (cols: int) (fss: #seq) = + let A = new Double.SparseMatrix(rows, cols) + fss |> Seq.iter (fun (i, j, x) -> A.[i,j] <- x) + A + + /// Create a square matrix with constant diagonal entries. + let inline constDiag (n: int) (f: float) = + let A = new Double.SparseMatrix(n,n) + for i=0 to n-1 do + A.[i,i] <- f + A + + /// Create a square matrix with the vector elements on the diagonal. + let inline diag (v: #Vector) = + let n = v.Count + let A = new Double.SparseMatrix(n,n) + for i=0 to n-1 do + A.[i,i] <- v.Item(i) + A + + /// Initialize a matrix by calling a construction function for every row. + let inline initRow (n: int) (m: int) (f: int -> #Vector) = + let A = new Double.SparseMatrix(n,m) + for i=0 to n-1 do A.SetRow(i, f i) + A + + /// Initialize a matrix by calling a construction function for every column. + let inline initCol (n: int) (m: int) (f: int -> #Vector) = + let A = new Double.SparseMatrix(n,m) + for i=0 to m-1 do A.SetColumn(i, f i) + A \ No newline at end of file diff --git a/Backup/src/FSharp/SparseVector.fs b/Backup/src/FSharp/SparseVector.fs new file mode 100644 index 00000000..e5c748bc --- /dev/null +++ b/Backup/src/FSharp/SparseVector.fs @@ -0,0 +1,48 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://numerics.mathdotnet.com +// http://github.com/mathnet/mathnet-numerics +// http://mathnetnumerics.codeplex.com +// +// Copyright (c) 2009 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +namespace MathNet.Numerics.LinearAlgebra.Double + +open MathNet.Numerics.LinearAlgebra + +/// A module which implements functional sparse vector operations. +module SparseVector = + + /// Create a sparse vector with a given dimension from a list of entry, value pairs. + let inline ofList (dim: int) (fl: list) = + let v = new Double.SparseVector(dim) + fl |> List.iter (fun (i, f) -> v.[i] <- f) + v + + /// Create a sparse vector with a given dimension from a sequence of entry, value pairs. + let inline ofSeq (dim: int) (fs: #seq) = + let v = new Double.SparseVector(dim) + fs |> Seq.iter (fun (i, f) -> v.[i] <- f) + v \ No newline at end of file diff --git a/Backup/src/FSharp/Vector.fs b/Backup/src/FSharp/Vector.fs new file mode 100644 index 00000000..e05a1fe1 --- /dev/null +++ b/Backup/src/FSharp/Vector.fs @@ -0,0 +1,187 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://numerics.mathdotnet.com +// http://github.com/mathnet/mathnet-numerics +// http://mathnetnumerics.codeplex.com +// +// Copyright (c) 2009 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +namespace MathNet.Numerics.LinearAlgebra.Double + +open MathNet.Numerics.LinearAlgebra +open MathNet.Numerics.LinearAlgebra.Generic + +/// A module which implements functional vector operations. +module Vector = + + /// Transform a vector into an array. + let inline toArray (v: #Vector) = + let n = v.Count + Array.init n (fun i -> v.Item(i)) + + /// Transform a vector into an array. + let inline toList (v: #Vector) = + let n = v.Count + List.init n (fun i -> v.Item(i)) + + /// In-place mutation by applying a function to every element of the vector. + let inline mapInPlace (f: float -> float) (v: #Vector) = + for i=0 to v.Count-1 do + v.Item(i) <- f (v.Item(i)) + () + + /// In-place mutation by applying a function to every element of the vector. + let inline mapiInPlace (f: int -> float -> float) (v: #Vector) = + for i=0 to v.Count-1 do + v.Item(i) <- f i (v.Item(i)) + () + + /// In-place vector addition. + let inline addInPlace (v: #Vector) (w: #Vector) = v.Add(w, v) + + /// In place vector subtraction. + let inline subInPlace (v: #Vector) (w: #Vector) = v.Subtract(w, v) + + /// Functional map operator for vectors. + /// + let inline map f (v: #Vector) = + let w = v.Clone() + mapInPlace (fun x -> f x) w + w + + /// Applies a function to all elements of the vector. + let inline iter (f: float -> unit) (v: #Vector) = + for i=0 to v.Count-1 do + f (v.Item i) + + /// Applies a function to all elements of the vector. + let inline iteri (f: int -> float -> unit) (v: #Vector) = + for i=0 to v.Count-1 do + f i (v.Item i) + + /// Maps a vector to a new vector by applying a function to every element. + let inline mapi (f: int -> float -> float) (v: #Vector) = + let w = v.Clone() + mapiInPlace f w + w + + /// Fold all entries of a vector. + let inline fold (f: 'a -> float -> 'a) (acc0: 'a) (v: #Vector) = + let mutable acc = acc0 + for i=0 to v.Count-1 do + acc <- f acc (v.Item(i)) + acc + + /// Fold all entries of a vector in reverse order. + let inline foldBack (f: float -> 'a -> 'a) (acc0: 'a) (v: #Vector) = + let mutable acc = acc0 + for i=2 to v.Count do + acc <- f (v.Item(v.Count - i)) acc + acc + + /// Fold all entries of a vector using a position dependent folding function. + let inline foldi (f: int -> 'a -> float -> 'a) (acc0: 'a) (v: #Vector) = + let mutable acc = acc0 + for i=0 to v.Count-1 do + acc <- f i acc (v.Item(i)) + acc + + /// Checks whether a predicate is satisfied for every element in the vector. + let inline forall (p: float -> bool) (v: #Vector) = + let mutable b = true + let mutable i = 0 + while b && i < v.Count do + b <- b && (p (v.Item(i))) + i <- i+1 + b + + /// Checks whether there is an entry in the vector that satisfies a given predicate. + let inline exists (p: float -> bool) (v: #Vector) = + let mutable b = false + let mutable i = 0 + while not(b) && i < v.Count do + b <- b || (p (v.Item(i))) + i <- i+1 + b + + /// Checks whether a predicate is true for all entries in a vector. + let inline foralli (p: int -> float -> bool) (v: #Vector) = + let mutable b = true + let mutable i = 0 + while b && i < v.Count do + b <- b && (p i (v.Item(i))) + i <- i+1 + b + + /// Checks whether there is an entry in the vector that satisfies a given position dependent predicate. + let inline existsi (p: int -> float -> bool) (v: #Vector) = + let mutable b = false + let mutable i = 0 + while not(b) && i < v.Count do + b <- b || (p i (v.Item(i))) + i <- i+1 + b + + /// Scans a vector; like fold but returns the intermediate result. + let inline scan (f: float -> float -> float) (v: #Vector) = + let w = v.Clone() + let mutable p = v.Item(0) + for i=1 to v.Count-1 do + p <- f p (v.Item(i)) + w.[i] <- p + w + + /// Scans a vector in reverse order; like foldBack but returns the intermediate result. + let inline scanBack (f: float -> float -> float) (v: #Vector) = + let w = v.Clone() + let mutable p = v.Item(v.Count-1) + for i=2 to v.Count do + p <- f (v.Item(v.Count - i)) p + w.[v.Count - i] <- p + w + + /// Reduces a vector: the result of this function will be f(...f(f(v[0],v[1]), v[2]),..., v[n]). + let inline reduce (f: float -> float -> float) (v: #Vector) = + let mutable p = v.Item(0) + for i=1 to v.Count-1 do + p <- f p (v.Item(i)) + p + + /// Reduces a vector in reverse order: the result of this function will be f(v[1], ..., f(v[n-2], f(v[n-1],v[n]))...). + let inline reduceBack (f: float -> float -> float) (v: #Vector) = + let mutable p = v.Item(v.Count-1) + for i=2 to v.Count do + p <- f (v.Item(v.Count - i)) p + p + + /// Creates a new vector and inserts the given value at the given index. + let inline insert index value (v: #Vector) = + let newV = new DenseVector(v.Count + 1) + for i = 0 to index - 1 do + newV.Item(i) <- v.Item(i) + newV.Item(index) <- value + for i = index + 1 to v.Count do + newV.Item(i) <- v.Item(i - 1) + newV \ No newline at end of file diff --git a/Backup/src/FSharpExamples/Apply.fs b/Backup/src/FSharpExamples/Apply.fs new file mode 100644 index 00000000..155b195e --- /dev/null +++ b/Backup/src/FSharpExamples/Apply.fs @@ -0,0 +1,94 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://mathnet.opensourcedotnet.info +// +// Copyright (c) 2009 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +module MathNet.Numerics.FSharp.Examples.Apply + +open System.Numerics +open MathNet.Numerics +open MathNet.Numerics.LinearAlgebra.Double +open MathNet.Numerics.LinearAlgebra.Generic +/// Flag to specify wether we want pretty printing or tab separated output. +let prettyPrint = false + +/// The size of the vector we want to map things for. +let N = 1000000 +/// The number of times we repeat a call. +let T = 10 +/// The list of all functions we want to test. +let FunctionList : (string * (float -> float) * (float -> float)) [] = + [| ("Cosine", cos, System.Math.Cos); + ("Sine", sin, System.Math.Sin); + ("Tangent", tan, System.Math.Tan); + ("Inverse Cosine", acos, System.Math.Acos); + ("Inverse Sine", asin, System.Math.Asin); + ("Inverse Tangent", atan, System.Math.Atan); + ("Hyperbolic Cosine", cosh, System.Math.Cosh); + ("Hyperbolic Sine", sinh, System.Math.Sinh); + ("Hyperbolic Tangent", tanh, System.Math.Tanh); + ("Abs", abs, System.Math.Abs); + ("Exp", exp, System.Math.Exp); + ("Log", log, System.Math.Log); + ("Sqrt", sqrt, System.Math.Sqrt); + ("Error Function", SpecialFunctions.Erf, SpecialFunctions.Erf); + ("Error Function Complement", SpecialFunctions.Erfc, SpecialFunctions.Erfc); + ("Inverse Error Function", SpecialFunctions.ErfInv, SpecialFunctions.ErfInv); + ("Inverse Error Function Complement", SpecialFunctions.ErfcInv, SpecialFunctions.ErfcInv) |] + +/// A vector with random entries. +let w = + let rnd = new Random.MersenneTwister() + (new DenseVector(Array.init N (fun _ -> rnd.NextDouble() * 10.0))) :> Vector + +/// A stopwatch to time the execution. +let sw = new System.Diagnostics.Stopwatch() + + +for (name, fs, dotnet) in FunctionList do + if prettyPrint then printfn "Running %s on an %d dimensional vector for %d iterations:" name N T + else printf "%s" name + + /// Perform the standard F# map function. + do + let v = w.Clone() + sw.Start() + for t in 1 .. T do Vector.mapInPlace fs v + sw.Stop() + if prettyPrint then printfn "\tVector.map (F#): %d milliseconds." sw.ElapsedMilliseconds + else printf "\t%d" sw.ElapsedMilliseconds + sw.Reset() + (* + /// Perform the Apply.Map function. + do + let v = w.Clone() + sw.Start() + for t in 1 .. T do v.Map(fun x -> dotnet x) + sw.Stop() + if prettyPrint then printfn "\tApply.Map (MKL): %d milliseconds." sw.ElapsedMilliseconds + else printf "\t%d" sw.ElapsedMilliseconds + sw.Reset()*) + + printfn "" \ No newline at end of file diff --git a/Backup/src/FSharpExamples/DenseVector.fs b/Backup/src/FSharpExamples/DenseVector.fs new file mode 100644 index 00000000..48f9994f --- /dev/null +++ b/Backup/src/FSharpExamples/DenseVector.fs @@ -0,0 +1,54 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://mathnet.opensourcedotnet.info +// +// Copyright (c) 2009 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +module MathNet.Numerics.FSharp.Examples.DenseVector + +open MathNet.Numerics.FSharp +open MathNet.Numerics.LinearAlgebra + +// Create a new 100 dimensional dense vector. +let v = Double.DenseVector.init 100 (fun i -> float i / 100.0) + +// Another way to create a 100 dimensional dense vector is using the vector function. +let w = vector (List.init 100 (fun i -> float i ** 2.0)) + +// Vectors can also be constructed from sequences. +let t = Double.DenseVector.ofSeq (seq { for i in 1 .. 100 do yield float i }) + +// We can now add two vectors together ... +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 = Double.DenseVector.range 5 10 + +// ... or we can create a vector from a double range with a particular step size. +let r = Double.DenseVector.rangef 0.0 0.1 10.0 \ No newline at end of file diff --git a/Backup/src/FSharpExamples/FSharpExamples.fsproj b/Backup/src/FSharpExamples/FSharpExamples.fsproj new file mode 100644 index 00000000..fef511c7 --- /dev/null +++ b/Backup/src/FSharpExamples/FSharpExamples.fsproj @@ -0,0 +1,77 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {bc81ea37-8ee6-4bf9-b8a9-b30497aef8b1} + Library + FSharpExamples + FSharpExamples + v4.0 + FSharpExamples + + + + true + full + false + false + bin\Debug\ + DEBUG;TRACE + 3 + + + pdbonly + true + true + bin\Release\ + TRACE + 3 + + + pdbonly + true + true + TRACE + 3 + bin\Release-Signed\ + + + + + + + 3.5 + + + + + + FSharp + {37e8e802-a354-4114-bfc1-6e1357da605b} + True + + + Numerics + {b7cae5f4-a23f-4438-b5be-41226618b695} + True + + + + + + + + + + + + \ No newline at end of file diff --git a/Backup/src/FSharpExamples/Histogram.fs b/Backup/src/FSharpExamples/Histogram.fs new file mode 100644 index 00000000..2d5203f5 --- /dev/null +++ b/Backup/src/FSharpExamples/Histogram.fs @@ -0,0 +1,44 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://mathnet.opensourcedotnet.info +// +// Copyright (c) 2009 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +module MathNet.Numerics.FSharp.Examples.Histogram + +open MathNet.Numerics.Statistics + +/// The number of buckets to use in our histogram. +let B = 9 + +/// Create a small dataset. +let data = [| 0.5; 1.5; 2.5; 3.5; 4.5; 5.5; 6.5; 7.5; 8.5; 9.5 |] + +/// A histogram with 9 buckets for this dataset. +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 \ No newline at end of file diff --git a/Backup/src/FSharpExamples/MCMC.fs b/Backup/src/FSharpExamples/MCMC.fs new file mode 100644 index 00000000..d0ee5337 --- /dev/null +++ b/Backup/src/FSharpExamples/MCMC.fs @@ -0,0 +1,201 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://mathnet.opensourcedotnet.info +// +// Copyright (c) 2009 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// +module MathNet.Numerics.FSharp.Examples.Mcmc + +open MathNet.Numerics.Random +open MathNet.Numerics.Statistics +open MathNet.Numerics.Distributions +open MathNet.Numerics.Statistics.Mcmc + +/// The number of samples to gather for each sampler. +let N = 10000 +/// The random number generator we use for the examples. +let rnd = new MersenneTwister() + +// +// Example 1: Sampling a Beta distributed variable through rejection sampling. +// +// Target Distribution: Beta(2.7, 6.3) +// +// ----------------------------------------------------------------------------- +do + printfn "Rejection Sampling Example" + + /// The target distribution. + let beta = new Beta(2.7, 6.3) + + /// Samples uniform distributed variables. + let uniform = new ContinuousUniform(0.0, 1.0, RandomSource = rnd) + + /// Implements the rejection sampling procedure. + let rs = new RejectionSampler( ( fun x -> x**(beta.A-1.0) * (1.0 - x)**(beta.B-1.0) ), + ( fun x -> 0.021 ), + ( fun () -> uniform.Sample()) ) + + /// An array of samples from the rejection sampler. + let arr = rs.Sample(N) + + /// The true distribution. + printfn "\tEmpirical Mean = %f (should be %f)" (Statistics.Mean(arr)) beta.Mean + printfn "\tEmpirical StdDev = %f (should be %f)" (Statistics.StandardDeviation(arr)) beta.StdDev + printfn "\tAcceptance rate = %f" rs.AcceptanceRate + printfn "" + + + +// +// Example 2: Sampling a normal distributed variable through Metropolis sampling. +// +// Target Distribution: Normal(1.0, 3.5) +// +// ----------------------------------------------------------------------------- +do + printfn "Metropolis Sampling Example" + + let mean, stddev = 1.0, 3.5 + let normal = new Normal(mean, stddev) + + /// Implements the rejection sampling procedure. + let ms = new MetropolisSampler( 0.1, (fun x -> log(normal.Density(x))), + (fun x -> Normal.Sample(rnd, x, 0.3)), 20, + RandomSource = rnd ) + + /// An array of samples from the rejection sampler. + let arr = ms.Sample(N) + + /// The true distribution. + printfn "\tEmpirical Mean = %f (should be %f)" (Statistics.Mean(arr)) normal.Mean + printfn "\tEmpirical StdDev = %f (should be %f)" (Statistics.StandardDeviation(arr)) normal.StdDev + printfn "\tAcceptance rate = %f" ms.AcceptanceRate + printfn "" + + + +// +// Example 3: Sampling a normal distributed variable through Metropolis-Hastings sampling +// with a symmetric proposal distribution. +// +// Target Distribution: Normal(1.0, 3.5) +// +// ----------------------------------------------------------------------------------------- +do + printfn "Metropolis Hastings Sampling Example (Symmetric Proposal)" + let mean, stddev = 1.0, 3.5 + let normal = new Normal(mean, stddev) + + /// Evaluates the log normal distribution. + let npdf x m s = -0.5*(x-m)*(x-m)/(s*s) - 0.5 * log(2.0 * System.Math.PI * s * s) + + /// Implements the rejection sampling procedure. + let ms = new MetropolisHastingsSampler( 0.1, (fun x -> log(normal.Density(x))), + (fun x y -> npdf x y 0.3), (fun x -> Normal.Sample(rnd, x, 0.3)), 10, + RandomSource = rnd ) + + /// An array of samples from the rejection sampler. + let arr = ms.Sample(N) + + /// The true distribution. + printfn "\tEmpirical Mean = %f (should be %f)" (Statistics.Mean(arr)) normal.Mean + printfn "\tEmpirical StdDev = %f (should be %f)" (Statistics.StandardDeviation(arr)) normal.StdDev + printfn "\tAcceptance rate = %f" ms.AcceptanceRate + printfn "" + + + +// +// Example 4: Sampling a normal distributed variable through Metropolis-Hastings sampling +// with a asymmetric proposal distribution. +// +// Target Distribution: Normal(1.0, 3.5) +// +// ----------------------------------------------------------------------------------------- +do + printfn "Metropolis Hastings Sampling Example (Assymetric Proposal)" + let mean, stddev = 1.0, 3.5 + let normal = new Normal(mean, stddev) + + /// Evaluates the logarithm of the normal distribution function. + let npdf x m s = -0.5*(x-m)*(x-m)/(s*s) - 0.5 * log(2.0 * System.Math.PI * s * s) + + /// Samples from a mixture that is biased towards samples larger than x. + let mixSample x = + if Bernoulli.Sample(rnd, 0.5) = 1 then + Normal.Sample(rnd, x, 0.3) + else + Normal.Sample(rnd, x + 0.1, 0.3) + + /// The transition kernel for the proposal above. + let krnl xnew x = log (0.5 * exp(npdf xnew x 0.3) + 0.5 * exp(npdf xnew (x+0.1) 0.3)) + + /// Implements the rejection sampling procedure. + let ms = new MetropolisHastingsSampler( 0.1, (fun x -> log(normal.Density(x))), + (fun xnew x -> krnl xnew x), (fun x -> mixSample x), 10, + RandomSource = rnd ) + + /// An array of samples from the rejection sampler. + let arr = ms.Sample(N) + + /// The true distribution. + printfn "\tEmpirical Mean = %f (should be %f)" (Statistics.Mean(arr)) normal.Mean + printfn "\tEmpirical StdDev = %f (should be %f)" (Statistics.StandardDeviation(arr)) normal.StdDev + printfn "\tAcceptance rate = %f" ms.AcceptanceRate + printfn "" + + + +// +// Example 5: Slice sampling a normal distributed random variable. +// +// Target Distribution: Normal(1.0, 3.5) +// +// ----------------------------------------------------------------------------------------- +do + printfn "Slice Sampling Example" + let mean, stddev = 1.0, 3.5 + let normal = new Normal(mean, stddev) + + /// Evaluates the unnormalized logarithm of the normal distribution function. + let npdf x m s = -0.5*(x-m)*(x-m)/(s*s) + + /// Implements the rejection sampling procedure. + let ms = new UnivariateSliceSampler( 0.1, (fun x -> npdf x mean stddev), 5, 1.0, RandomSource = rnd ) + + /// An array of samples from the rejection sampler. + let arr = ms.Sample(N) + + /// The true distribution. + printfn "\tEmpirical Mean = %f (should be %f)" (Statistics.Mean(arr)) normal.Mean + printfn "\tEmpirical StdDev = %f (should be %f)" (Statistics.StandardDeviation(arr)) normal.StdDev + printfn "" + + + + + + +System.Console.ReadLine() |> ignore \ No newline at end of file diff --git a/Backup/src/FSharpUnitTests/App.config b/Backup/src/FSharpUnitTests/App.config new file mode 100644 index 00000000..6c301d33 --- /dev/null +++ b/Backup/src/FSharpUnitTests/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Backup/src/FSharpUnitTests/FSharpUnitTests.fsproj b/Backup/src/FSharpUnitTests/FSharpUnitTests.fsproj new file mode 100644 index 00000000..c6f7cdcf --- /dev/null +++ b/Backup/src/FSharpUnitTests/FSharpUnitTests.fsproj @@ -0,0 +1,76 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {f2f8032b-a31d-4e33-a05e-f2cdcbfaa75d} + Exe + FSharpUnitTests + MathNet.Numerics.FSharp.UnitTests + v4.0 + FSharpUnitTests + + + + true + full + false + false + ..\..\out\test\debug\Net40\ + DEBUG;TRACE + 3 + + + pdbonly + true + true + ..\..\out\test\Net40\ + TRACE + 3 + + + pdbonly + true + true + TRACE + 3 + bin\Release-Signed\ + + + + + + + + Always + + + + + + + + 3.5 + + + FSharp + {37e8e802-a354-4114-bfc1-6e1357da605b} + True + + + Numerics + {b7cae5f4-a23f-4438-b5be-41226618b695} + True + + + + + \ No newline at end of file diff --git a/Backup/src/FSharpUnitTests/FsUnit.fs b/Backup/src/FSharpUnitTests/FsUnit.fs new file mode 100644 index 00000000..a4f7b89c --- /dev/null +++ b/Backup/src/FSharpUnitTests/FsUnit.fs @@ -0,0 +1,244 @@ +(* +Copyright (c) 2008, Raymond W. Vernagus (R.Vernagus@gmail.com) +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Raymond W. Vernagus nor the names of FsUnit's + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*) +namespace FsUnit + +open MathNet.Numerics +open MathNet.Numerics.LinearAlgebra.Double +open MathNet.Numerics.LinearAlgebra.Generic + +type Result = + | Pass + | Fail of string + | Error of string + +type Expectation = + | True + | False + | Empty + | NullOrEmpty + | Null + | SameAs of obj + +type Spec = + abstract Check : unit -> Result + abstract NegatedMessage : string + +[] +module SpecOps = + let internal safeCheck f = + try + f() + with ex -> Error (ex.ToString()) + + let make f nmsg = + { new Spec with + member this.Check() = safeCheck f + member this.NegatedMessage = nmsg } + + let check (s: Spec) = s.Check() + + let not' f x = + let s = f x + match check s with + | Pass -> make (fun () -> Fail s.NegatedMessage) "" + | Fail msg -> make (fun () -> Pass) msg + | Error msg -> make (fun () -> Error msg) msg + + let equal expected actual = + make (fun () -> + if actual.Equals(expected) + then Pass + else Fail (sprintf "Expected: %A\nActual: %A" expected actual)) + (sprintf "NOT Expected: %A\nActual: %A" expected actual) + + let have n lbl s = + make (fun() -> + let len = Seq.length s + if len = n + then Pass + else Fail (sprintf "Expected: %d %s\nActual: %d %s" n lbl len lbl)) + (sprintf "NOT Expected: %d %s\nActual: %d %s" n lbl n lbl) + + let contain x s = + make (fun () -> + let exists = s |> Seq.exists (fun x' -> x' = x) + if exists + then Pass + else Fail (sprintf "Expected %A to contain %A" s x)) + (sprintf "Did NOT expect %A to contain %A" s x) + + let raise'<'a when 'a :> System.Exception> f = + let expType = typeof<'a> + make (fun () -> + try + f() + Fail (sprintf "Expected %s but no exception was raised" expType.FullName) + with ex -> + let actualExType = ex.GetType() + if expType = actualExType + then Pass + else Fail (sprintf "Expected: %s\nActual: %s" expType.FullName actualExType.FullName)) + (sprintf "Did NOT expect %s to be raised" expType.FullName) + + let be expectation x = + let x = box x + let msg = sprintf "Expected: %A\nActual: %A" expectation x + let negmsg = sprintf "NOT Expected: %A\nActual: %A" expectation x + match expectation with + | True -> + make (fun () -> + if x = box true + then Pass + else Fail msg) + negmsg + | False -> + make (fun () -> + if x = box false + then Pass + else Fail msg) + negmsg + | Empty -> + make (fun () -> + if x = box System.String.Empty + then Pass + else Fail msg) + negmsg + | NullOrEmpty -> + make (fun () -> + if System.String.IsNullOrEmpty(x :?> string) + then Pass + else Fail msg) + negmsg + | Null -> + make (fun () -> + if x = null + then Pass + else Fail msg) + negmsg + | SameAs other -> + make (fun () -> + if System.Object.ReferenceEquals(x, other) + then Pass + else Fail (sprintf "Expected actual to be same reference as expected %A" other)) + (sprintf "Expected %A to have different reference than %A" x other) + + let array_equal (expected: float []) (actual: float []) = + make (fun () -> + let mutable f = true + for i=0 to expected.Length-1 do + f <- f && (expected.[i] = actual.[i]) + if f + then Pass + else Fail (sprintf "Expected: %A\nActual: %A" expected actual)) + (sprintf "NOT Expected: %A\nActual: %A" expected actual) + + let array2_equal (expected: float [,]) (actual: float [,]) = + make (fun () -> + let mutable f = true + for i=0 to expected.GetLength(0)-1 do + for j=0 to expected.GetLength(1)-1 do + f <- f && (expected.[i,j] = actual.[i,j]) + if f + then Pass + else Fail (sprintf "Expected: %A\nActual: %A" expected actual)) + (sprintf "NOT Expected: %A\nActual: %A" expected actual) + + let approximately_equal (places : int) (expected: float) (actual: float) = + make (fun () -> + if Precision.AlmostEqualInDecimalPlaces(actual, expected, places) + then Pass + else Fail (sprintf "Expected: %A\nActual: %A" expected actual)) + (sprintf "NOT Expected: %A\nActual: %A" expected actual) + + let approximately_vector_equal (places : int) (expected: #Vector) (actual: #Vector) = + make (fun () -> + let mutable f = true + for i=0 to expected.Count-1 do + f <- f && Precision.AlmostEqualInDecimalPlaces(expected.[i], actual.[i], places) + if f + then Pass + else Fail (sprintf "Expected: %A\nActual: %A" expected actual)) + (sprintf "NOT Expected: %A\nActual: %A" expected actual) + + let approximately_matrix_equal (places : int) (expected: #Matrix) (actual: #Matrix) = + make (fun () -> + let mutable f = true + for i=0 to expected.RowCount-1 do + for j=0 to expected.ColumnCount-1 do + f <- f && Precision.AlmostEqualInDecimalPlaces(expected.[i,j], actual.[i,j], places) + if f + then Pass + else Fail (sprintf "Expected: %A\nActual: %A" expected actual)) + (sprintf "NOT Expected: %A\nActual: %A" expected actual) + +module Results = + open Microsoft.FSharp.Text + + let internal currentResults = new ResizeArray() + + let add = currentResults.Add + + let passedCount () = + currentResults + |> Seq.filter (function _,Pass -> true | _ -> false) + |> Seq.length + + let failed () = + currentResults + |> Seq.filter (function _,Fail _ -> true | _ -> false) + + let failedCount () = + failed() + |> Seq.length + + let erred () = + currentResults + |> Seq.filter (function _,Error _ -> true | _ -> false) + + let erredCount () = + erred() + |> Seq.length + + let summary () = + let buff = new System.Text.StringBuilder() + buff.AppendFormat("{0} passed.\n{1} failed.\n{2} erred.", passedCount(), failedCount(), erredCount()) |> ignore + failed() + |> Seq.iter (function (lbl,Fail msg) -> buff.AppendFormat("\n----\nFailed: {0}\n{1}", lbl, msg) |> ignore | _ -> ()) + erred() + |> Seq.iter (function (lbl,Error msg) -> buff.AppendFormat("\n----\nErred: {0}\n{1}", lbl, msg) |> ignore | _ -> ()) + buff.ToString() + + +[] +module SpecHelpers = + let spec lbl s = (lbl, check s) + + let should f x = f x + + let specs lbl (results: seq) = + results |> Seq.iter (fun x -> Results.add x) diff --git a/Backup/src/FSharpUnitTests/Program.fs b/Backup/src/FSharpUnitTests/Program.fs new file mode 100644 index 00000000..04d43d03 --- /dev/null +++ b/Backup/src/FSharpUnitTests/Program.fs @@ -0,0 +1,224 @@ +open FsUnit +open MathNet.Numerics.FSharp +open MathNet.Numerics.LinearAlgebra.Double +open MathNet.Numerics.LinearAlgebra.Generic + +/// Unit tests for the dense vector type. +let DenseVectorTests = + + /// A small uniform vector. + let smallv = new DenseVector(5, 0.3 ) + + /// A large vector with increasingly large entries + let largev = new DenseVector( Array.init 100 (fun i -> float i / 100.0) ) + + specs "DenseVector" [ + spec "DenseVector.init" + (DenseVector.init 100 (fun i -> float i / 100.0) |> should equal largev) + spec "DenseVector.ofList" + (DenseVector.ofList [ for i in 0 .. 99 -> float i / 100.0 ] |> should equal largev) + spec "DenseVector.ofSeq" + (DenseVector.ofSeq (seq { for i in 0 .. 99 -> float i / 100.0 }) |> should equal largev) + spec "DenseVector.rangef" + (DenseVector.rangef 0.0 0.01 0.99 |> should equal (new DenseVector( [| for i in 0 .. 99 -> 0.01 * float i |] ) )) + spec "DenseVector.range" + (DenseVector.range 0 99 |> should equal (new DenseVector( [| for i in 0 .. 99 -> float i |] ) )) + ] + + +/// Unit tests for the sparse vector type. +let SparseVectorTests = + + /// A small uniform vector. + let smallv = new DenseVector( [|0.0;0.3;0.0;0.0;0.0|] ) :> Vector + + specs "SparseVector" [ + spec "SparseVector.ofList" + ((SparseVector.ofList 5 [ (1,0.3) ] :> Vector) |> should equal smallv) + spec "SparseVector.ofSeq" + ((SparseVector.ofSeq 5 (List.toSeq [ (1,0.3) ]) :> Vector) |> should equal smallv) + ] + + +/// Unit tests for the vector type. +let VectorTests = + + /// A small uniform vector. + let smallv = new DenseVector( [|0.3;0.3;0.3;0.3;0.3|] ) :> Vector + + /// A large vector with increasingly large entries + let largev = new DenseVector( Array.init 100 (fun i -> float i / 100.0) ) :> Vector + + specs "Vector" [ + spec "Vector.toArray" + (Vector.toArray smallv |> should array_equal [|0.3;0.3;0.3;0.3;0.3|]) + spec "Vector.toList" + (Vector.toList smallv |> should equal [0.3;0.3;0.3;0.3;0.3]) + spec "Vector.mapInPlace" + ( let w = smallv.Clone() + Vector.mapInPlace (fun x -> 2.0 * x) w + w |> should equal (2.0 * smallv)) + spec "Vector.mapiInPlace" + ( let w = largev.Clone() + Vector.mapiInPlace (fun i x -> float i / 100.0) w + w |> should equal (largev)) + spec "Vector.addInPlace" + ( let w = largev.Clone() + Vector.addInPlace w largev + w |> should equal (2.0 * largev)) + spec "Vector.subInPlace" + ( let w = largev.Clone() + Vector.subInPlace w largev + w |> should equal (0.0 * largev)) + spec "Vector.map" + (Vector.map (fun x -> 2.0 * x) largev |> should equal (2.0 * largev)) + spec "Vector.mapi" + (Vector.mapi (fun i x -> float i / 100.0) largev |> should equal largev) + spec "Vector.fold" + (Vector.fold (fun a b -> a - b) 0.0 smallv |> should equal -1.5) + spec "Vector.foldBack" + (Vector.foldBack (fun a b -> a - b) 0.0 smallv |> should equal 0.0) + spec "Vector.foldi" + (Vector.foldi (fun i a b -> a + b) 0.0 smallv |> should equal 1.5) + spec "Vector.forall" + (Vector.forall (fun x -> x = 0.3) smallv |> should equal true) + spec "Vector.exists" + (Vector.exists (fun x -> x = 0.3) smallv |> should equal true) + spec "Vector.foralli" + (Vector.foralli (fun i x -> x = 0.3 && i < 5) smallv |> should equal true) + spec "Vector.existsi" + (Vector.existsi (fun i x -> x = 0.3 && i = 2) smallv |> should equal true) + spec "Vector.scan" + (Vector.scan (fun acc x -> acc + x) smallv |> should approximately_vector_equal 14 (new DenseVector( [|0.3;0.6;0.9;1.2;1.5|] ) :> Vector) ) + spec "Vector.scanBack" + (Vector.scanBack (fun x acc -> acc + x) smallv |> should approximately_vector_equal 14 (new DenseVector( [|1.5;1.2;0.9;0.6;0.3|] ) :> Vector) ) + spec "Vector.reduce" + (Vector.reduce (fun acc x -> acc ** x) smallv |> should approximately_equal 14 0.990295218585507) + spec "Vector.reduceBack" + (Vector.reduceBack (fun x acc -> x ** acc) smallv |> should approximately_equal 14 0.488911287726319) + spec "Vector.insert" + (Vector.insert 2 0.5 smallv |> should approximately_vector_equal 14 (new DenseVector ( [|0.3;0.3;0.5;0.3;0.3;0.3|] ) :> Vector) ) + ] + + +/// Unit tests for the matrix type. +let MatrixTests = + + /// A small uniform vector. + let smallM = new DenseMatrix( Array2D.create 2 2 0.3 ) + let failingFoldBackM = DenseMatrix.init 2 3 (fun i j -> 1.0) + + + /// A large vector with increasingly large entries + let largeM = new DenseMatrix( Array2D.init 100 100 (fun i j -> float i * 100.0 + float j) ) + + specs "Matrix" [ + spec "Matrix.fold" + (Matrix.fold (fun a b -> a - b) 0.0 smallM |> should equal -1.2) + spec "Matrix.foldBack" + (Matrix.foldBack (fun a b -> a - b) 0.0 smallM |> should equal 0.0) + spec "Matrix.foldBackSummation" + (Matrix.foldBack( fun a b -> a + b) 0.0 failingFoldBackM |> should equal 6.0) + spec "Matrix.foldi" + (Matrix.foldi (fun i j acc x -> acc + x + float (i+j)) 0.0 smallM |> should equal 5.2) + spec "Matrix.toArray2" + (Matrix.toArray2 smallM |> should array2_equal (Array2D.create 2 2 0.3)) + spec "Matrix.forall" + (Matrix.forall (fun x -> x = 0.3) smallM |> should equal true) + spec "Matrix.exists" + (Matrix.exists (fun x -> x = 0.5) smallM |> should equal false) + spec "Matrix.foralli" + (Matrix.foralli (fun i j x -> x = float i * 100.0 + float j) largeM |> should equal true) + spec "Matrix.existsi" + (Matrix.existsi (fun i j x -> x = float i * 100.0 + float j) largeM |> should equal true) + spec "Matrix.map" + (Matrix.map (fun x -> 2.0 * x) smallM |> should equal (2.0 * smallM)) + spec "Matrix.mapi" + (Matrix.mapi (fun i j x -> float i * 100.0 + float j + x) largeM |> should equal (2.0 * largeM)) + spec "Matrix.mapCols" + (Matrix.mapCols (fun j col -> col.Add(float j)) smallM |> should approximately_matrix_equal 14 (matrix [[0.3;1.3];[0.3;1.3]])) + spec "Matrix.mapRows" + (Matrix.mapRows (fun i row -> row.Add(float i)) smallM |> should approximately_matrix_equal 14 (matrix [[0.3;0.3];[1.3;1.3]])) + spec "Matrix.inplaceAssign" + ( let N = smallM.Clone() + Matrix.inplaceAssign (fun i j -> 0.0) N + N |> should equal (0.0 * smallM)) + spec "Matrix.inplaceMapi" + ( let N = largeM.Clone() + Matrix.inplaceMapi (fun i j x -> 2.0 * (float i * 100.0 + float j) + x) N + N |> should equal (3.0 * largeM)) + spec "Matrix.nonZeroEntries" + (Seq.length (Matrix.nonZeroEntries smallM) |> should equal 4) + spec "Matrix.sum" + (Matrix.sum smallM |> should equal 1.2) + spec "Matrix.sumColsBy" + (Matrix.sumColsBy (fun j col -> col.[0] * col.[1]) (matrix [[1.0; 2.0]; [3.0; 4.0]]) |> should equal 11.0) + spec "Matrix.sumRowsBy" + (Matrix.sumRowsBy (fun i row -> row.[0] * row.[1]) (matrix [[1.0; 2.0]; [3.0; 4.0]]) |> should equal 14.0) + spec "Matrix.foldCol" + (Matrix.foldCol (+) 0.0 largeM 0 |> should equal 495000.0) + spec "Matrix.foldRow" + (Matrix.foldRow (+) 0.0 largeM 0 |> should equal 4950.0) + spec "Matrix.foldByCol" + (Matrix.foldByCol (+) 0.0 smallM |> should equal (DenseVector.ofList [0.6;0.6] :> Vector)) + spec "Matrix.foldByRow" + (Matrix.foldByRow (+) 0.0 smallM |> should equal (DenseVector.ofList [0.6;0.6] :> Vector)) + ] + + +/// Unit tests for the dense matrix type. +let DenseMatrixTests = + + /// A small uniform vector. + let smallM = new DenseMatrix( Array2D.create 2 2 0.3 ) + + /// A large vector with increasingly large entries + let largeM = new DenseMatrix( Array2D.init 100 100 (fun i j -> float i * 100.0 + float j) ) + + specs "DenseMatrix" [ + spec "DenseMatrix.init" + (DenseMatrix.init 100 100 (fun i j -> float i * 100.0 + float j) |> should equal largeM) + spec "DenseMatrix.ofList" + (DenseMatrix.ofList [[0.3;0.3];[0.3;0.3]] |> should equal smallM) + spec "DenseMatrix.ofSeq" + (DenseMatrix.ofSeq (Seq.ofList [[0.3;0.3];[0.3;0.3]]) |> should equal smallM) + spec "DenseMatrix.ofArray2" + (DenseMatrix.ofArray2 (Array2D.create 2 2 0.3) |> should equal smallM) + spec "DenseMatrix.initDense" + (DenseMatrix.initDense 100 100 (seq { for i in 0 .. 99 do + for j in 0 .. 99 -> (i,j, float i * 100.0 + float j)}) |> should equal largeM) + spec "DenseMatrix.constDiag" + (DenseMatrix.constDiag 100 2.0 |> should equal (2.0 * (DenseMatrix.Identity 100))) + spec "DenseMatrix.diag" + (DenseMatrix.diag (new DenseVector(100, 2.0)) |> should equal (2.0 * (DenseMatrix.Identity 100))) + spec "DenseMatrix.init_row" + (DenseMatrix.initRow 100 100 (fun i -> (DenseVector.init 100 (fun j -> float i * 100.0 + float j))) |> should equal largeM) + spec "DenseMatrix.init_col" + (DenseMatrix.initCol 100 100 (fun j -> (DenseVector.init 100 (fun i -> float i * 100.0 + float j))) |> should equal largeM) + ] + + +/// Unit tests for the sparse matrix type. +let SparseMatrixTests = + + /// A small uniform vector. + let smallM = DenseMatrix.init 4 4 (fun i j -> if i = 1 && j = 2 then 1.0 else 0.0) :> Matrix + + specs "SparseMatrix" [ + spec "SparseMatrix.ofList" + ((SparseMatrix.ofList 4 4 [(1,2,1.0)] :> Matrix) |> should equal smallM) + spec "SparseMatrix.ofSeq" + ((SparseMatrix.ofSeq 4 4 (Seq.ofList [(1,2,1.0)]) :> Matrix) |> should equal smallM) + spec "SparseMatrix.constDiag" + (SparseMatrix.constDiag 100 2.0 |> should equal (2.0 * (SparseMatrix.Identity 100))) + spec "SparseMatrix.diag" + (SparseMatrix.diag (new DenseVector(100, 2.0)) |> should equal (2.0 * (SparseMatrix.Identity 100))) + ] + + +/// Report on errors and success and exit. +printfn "F# Test Results:" +printfn "%s" (Results.summary()) + +let code = if Results.erredCount() > 0 || Results.failedCount() > 0 then -1 else 0;; +exit code;; \ No newline at end of file diff --git a/MathNet.Numerics.sln b/MathNet.Numerics.sln index 82a49c1d..7ade3c5b 100644 --- a/MathNet.Numerics.sln +++ b/MathNet.Numerics.sln @@ -1,6 +1,17 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{4D50FB34-10BC-495A-8B2F-482E34B4D771}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{49EE74BD-301F-4C3B-B76A-07F90CC88CE7}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Readme", "Readme", "{C2F37492-38AE-4186-8A7F-17B0B080942C}" + ProjectSection(SolutionItems) = preProject + AUTHORS.markdown = AUTHORS.markdown + COPYRIGHT.markdown = COPYRIGHT.markdown + README.markdown = README.markdown + EndProjectSection +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "src\Examples\Examples.csproj", "{8239A6FF-1EF3-4DA4-A860-95C392DD6899}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Numerics", "src\Numerics\Numerics.csproj", "{B7CAE5F4-A23F-4438-B5BE-41226618B695}" @@ -11,19 +22,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharpExamples", "src\FShar EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharpUnitTests", "src\FSharpUnitTests\FSharpUnitTests.fsproj", "{F2F8032B-A31D-4E33-A05E-F2CDCBFAA75D}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{4D50FB34-10BC-495A-8B2F-482E34B4D771}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{49EE74BD-301F-4C3B-B76A-07F90CC88CE7}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "src\UnitTests\UnitTests.csproj", "{DAF07AA8-C5C9-4963-98F7-2C3285064DAD}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Readme", "Readme", "{C2F37492-38AE-4186-8A7F-17B0B080942C}" - ProjectSection(SolutionItems) = preProject - AUTHORS.markdown = AUTHORS.markdown - COPYRIGHT.markdown = COPYRIGHT.markdown - README.markdown = README.markdown - EndProjectSection -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Numerics.IO", "src\Numerics.IO\Numerics.IO.csproj", "{EB1A5D32-F264-4BCE-BEB7-0B97085075BE}" EndProject Global @@ -80,9 +80,9 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {BC81EA37-8EE6-4BF9-B8A9-B30497AEF8B1} = {49EE74BD-301F-4C3B-B76A-07F90CC88CE7} - {8239A6FF-1EF3-4DA4-A860-95C392DD6899} = {49EE74BD-301F-4C3B-B76A-07F90CC88CE7} {F2F8032B-A31D-4E33-A05E-F2CDCBFAA75D} = {4D50FB34-10BC-495A-8B2F-482E34B4D771} {DAF07AA8-C5C9-4963-98F7-2C3285064DAD} = {4D50FB34-10BC-495A-8B2F-482E34B4D771} + {8239A6FF-1EF3-4DA4-A860-95C392DD6899} = {49EE74BD-301F-4C3B-B76A-07F90CC88CE7} + {BC81EA37-8EE6-4BF9-B8A9-B30497AEF8B1} = {49EE74BD-301F-4C3B-B76A-07F90CC88CE7} EndGlobalSection EndGlobal diff --git a/UpgradeLog.htm b/UpgradeLog.htm new file mode 100644 index 00000000..d2e38eb1 Binary files /dev/null and b/UpgradeLog.htm differ diff --git a/_UpgradeReport_Files/UpgradeReport.css b/_UpgradeReport_Files/UpgradeReport.css new file mode 100644 index 00000000..2edaaf35 --- /dev/null +++ b/_UpgradeReport_Files/UpgradeReport.css @@ -0,0 +1,118 @@ +/* Body style, for the entire document */ +body +{ + background: #F3F3F4; + color: #1E1E1F; + font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; + padding: 0; + margin: 0; +} + +/* Header1 style, used for the main title */ +h1 +{ + padding: 10px 0px 10px 10px; + font-size: 21pt; + background-color: #E2E2E2; + border-bottom: 1px #C1C1C2 solid; + color: #201F20; + margin: 0; + font-weight: normal; +} + +/* Header2 style, used for "Overview" and other sections */ +h2 +{ + font-size: 18pt; + font-weight: normal; + padding: 15px 0 5px 0; + margin: 0; +} + +/* Header3 style, used for sub-sections, such as project name */ +h3 +{ + font-weight: normal; + font-size: 15pt; + margin: 0; + padding: 15px 0 5px 0; + background-color: transparent; +} + +/* Color all hyperlinks one color */ +a +{ + color: #1382CE; +} + +/* Table styles */ +table +{ + border-spacing: 0 0; + border-collapse: collapse; + font-size: 10pt; +} + +table th +{ + background: #E7E7E8; + text-align: left; + text-decoration: none; + font-weight: normal; + padding: 3px 6px 3px 6px; +} + +table td +{ + vertical-align: top; + padding: 3px 6px 5px 5px; + margin: 0px; + border: 1px solid #E7E7E8; + background: #F7F7F8; +} + +/* Local link is a style for hyperlinks that link to file:/// content, there are lots so color them as 'normal' text until the user mouse overs */ +.localLink +{ + color: #1E1E1F; + background: #EEEEED; + text-decoration: none; +} + +.localLink:hover +{ + color: #1382CE; + background: #FFFF99; + text-decoration: none; +} + +/* Center text, used in the over views cells that contain message level counts */ +.textCentered +{ + text-align: center; +} + +/* The message cells in message tables should take up all avaliable space */ +.messageCell +{ + width: 100%; +} + +/* Padding around the content after the h1 */ +#content +{ + padding: 0px 12px 12px 12px; +} + +/* The overview table expands to width, with a max width of 97% */ +#overview table +{ + width: auto; + max-width: 75%; +} + +/* The messages tables are always 97% width */ +#messages table +{ + width: 97%; +} \ No newline at end of file diff --git a/_UpgradeReport_Files/UpgradeReport.xslt b/_UpgradeReport_Files/UpgradeReport.xslt new file mode 100644 index 00000000..b3f857c0 --- /dev/null +++ b/_UpgradeReport_Files/UpgradeReport.xslt @@ -0,0 +1,558 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ + + + + Solution + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Error + Warning + Success + + + + + + + + + + + + + + + + + + + + + + + + + + + + Message + Warning + Error + Message + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ProjectPathErrorsWarningsMessages
+ + + + _UpgradeReport_Files\UpgradeReport_Error.png + _UpgradeReport_Files\UpgradeReport_Warning.png + _UpgradeReport_Files\UpgradeReport_Success.png + + + + + + + + + + + + + + + Solution + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ' + + + + + + + +
+
+ + + + + + + + + + + + + ' + + + + + + + + + + + Show additional messages + + + + + + + + + + + + + + + + + ' + + + + + + + + + + + Hide additional messages + + + + + + + + + + + + + + display: none + + + + + + + + + + + _UpgradeReport_Files\UpgradeReport_Error.png + _UpgradeReport_Files\UpgradeReport_Warning.png + _UpgradeReport_Files\UpgradeReport_Information.png + + + + + + + + + + : + + + + + + + + + + + + + + + + + + + + + + + + + +

Solution

+
+ +

+ +

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Message
+ + + Solution logged no messages. + + logged no messages. +
+
+
+ + + + + + + +]]> + + + + + + + + Migration Report + + + + + +

+ Migration Report - +

+ +
+

Overview

+ + + + +
+ +
+ +

Solution and projects

+ +
+ +
+
+ + +
+ +
\ No newline at end of file diff --git a/_UpgradeReport_Files/UpgradeReport_Error.png b/_UpgradeReport_Files/UpgradeReport_Error.png new file mode 100644 index 00000000..4b489836 Binary files /dev/null and b/_UpgradeReport_Files/UpgradeReport_Error.png differ diff --git a/_UpgradeReport_Files/UpgradeReport_Information.png b/_UpgradeReport_Files/UpgradeReport_Information.png new file mode 100644 index 00000000..fc631e2b Binary files /dev/null and b/_UpgradeReport_Files/UpgradeReport_Information.png differ diff --git a/_UpgradeReport_Files/UpgradeReport_Success.png b/_UpgradeReport_Files/UpgradeReport_Success.png new file mode 100644 index 00000000..c8c27bcf Binary files /dev/null and b/_UpgradeReport_Files/UpgradeReport_Success.png differ diff --git a/_UpgradeReport_Files/UpgradeReport_Warning.png b/_UpgradeReport_Files/UpgradeReport_Warning.png new file mode 100644 index 00000000..7197e030 Binary files /dev/null and b/_UpgradeReport_Files/UpgradeReport_Warning.png differ diff --git a/src/FSharp/FSharp.fsproj b/src/FSharp/FSharp.fsproj index 53e98c55..01ce67bf 100644 --- a/src/FSharp/FSharp.fsproj +++ b/src/FSharp/FSharp.fsproj @@ -43,8 +43,12 @@ ..\..\out\lib\Net40\MathNet.Numerics.FSharp.xml bin\Release-Signed\ - - + + 11 + + + + diff --git a/src/FSharpExamples/FSharpExamples.fsproj b/src/FSharpExamples/FSharpExamples.fsproj index fef511c7..b9a68485 100644 --- a/src/FSharpExamples/FSharpExamples.fsproj +++ b/src/FSharpExamples/FSharpExamples.fsproj @@ -65,8 +65,12 @@ - - + + 11 + + + +