-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Type-level literals and Nat-dependent vector/matrix (#192)
- Loading branch information
Showing
28 changed files
with
1,702 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "external/FSharp.TypeProvider.SDK"] | ||
path = external/FSharp.TypeProviders.SDK | ||
url = https://github.com/fsprojects/FSharp.TypeProviders.SDK.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
(*** hide ***) | ||
// This block of code is omitted in the generated HTML documentation. Use | ||
// it to define helpers that you do not want to show in the documentation. | ||
#I "../../bin" | ||
|
||
(** | ||
Matrix<'NumType,'Rows,'Cols> | ||
======================================== | ||
This is a fixed size matrix of a (typically) numeric type. | ||
Related Tyes | ||
------------ | ||
- [Vector](type-vector.html): Similar but for vectors | ||
Abstractions | ||
------------ | ||
- [Semigroup](abstraction-semigroup.html) | ||
- [Monoid](abstraction-monoid.html) | ||
- [Functor](abstraction-functor.html) | ||
- [Applicative](abstraction-applicative.html) | ||
Examples | ||
-------- | ||
*) | ||
|
||
|
||
#r @"../../src/FSharpPlus/bin/Release/net45/FSharpPlus.dll" | ||
|
||
open FSharpPlus | ||
open FSharpPlus.Data | ||
|
||
let matrix3x4_1 = | ||
matrix ( | ||
(1, 0, 0, 0), | ||
(0, 1, 0, 0), | ||
(0, 0, 0, 0) | ||
) | ||
|
||
let matrix3x4_2 = | ||
matrix ( | ||
(10, 0, 100, 0), | ||
(30, 1, 100, 0), | ||
(60, 0, 100, 0) | ||
) | ||
|
||
|
||
// Add two matrices | ||
|
||
let matrix3x4_sum = matrix3x4_1 + matrix3x4_2 | ||
|
||
|
||
// Add a scalar | ||
|
||
let matrix3x4_3 = matrix3x4_1 + result 5 | ||
|
||
|
||
// Another way | ||
|
||
open FSharpPlus.Math.Generic | ||
|
||
let vector3d_4 = matrix3x4_1 + 5G |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
(*** hide ***) | ||
// This block of code is omitted in the generated HTML documentation. Use | ||
// it to define helpers that you do not want to show in the documentation. | ||
#I "../../bin" | ||
|
||
(** | ||
Vector<'NumType,'Dimension> | ||
=========================== | ||
This is a fixed size vector of a (typically) numeric type. | ||
Related Tyes | ||
------------ | ||
- [Matrix](type-matrix.html): Similar but for matrices | ||
Abstractions | ||
------------ | ||
- [Semigroup](abstraction-semigroup.html) | ||
- [Monoid](abstraction-monoid.html) | ||
- [Functor](abstraction-functor.html) | ||
- [ZipFunctor](abstraction-misc.html) | ||
- [Applicative](abstraction-applicative.html) | ||
- [Foldable](abstraction-foldable.html) | ||
- [Reducible](abstraction-misc.html) | ||
Examples | ||
-------- | ||
*) | ||
|
||
|
||
#r @"../../src/FSharpPlus/bin/Release/net45/FSharpPlus.dll" | ||
|
||
open FSharpPlus | ||
open FSharpPlus.Data | ||
|
||
|
||
let vector3d_1 = vector (1, 2, 3) | ||
let vector3d_2 = vector (10, 20, 30) | ||
|
||
|
||
// Add two vectors | ||
|
||
let vector3d_sum = vector3d_1 + vector3d_2 | ||
|
||
|
||
// Add a scalar | ||
|
||
let vector3d_3 = vector (1, 2, 3) + result 5 | ||
|
||
|
||
// Another way | ||
|
||
open FSharpPlus.Math.Generic | ||
|
||
let vector3d_4 = vector (1, 2, 3) + 5G |
Submodule FSharp.TypeProviders.SDK
added at
6e3933
Oops, something went wrong.