Stephen Canon
40b5a03063
Merge pull request #105 from compnerd/cmake
...
build: add initial CMake based build system
2020-07-03 09:49:53 -04:00
Stephen Canon
085f6dab2e
Merge branch 'master' into swift-5.3
2020-07-01 09:31:40 -04:00
Stephen Canon
93b8e9f0df
Float16 is unavailable on macOS 11.
2020-06-29 14:50:37 -04:00
Dan Zheng
86f0b33c65
Define Complex.zeroTangentVectorInitializer.
...
The `Differentiable.zeroTangentVectorInitializer` protocol requirement is a
closure producing a zero tangent vector, capturing minimal information from
`self`.
Fixes the `Complex: Differentiable` conformance for master toolchains.
2020-06-08 19:53:43 -07:00
Markus Winter
5f09b7ef22
Update documentation in ComplexModule
...
Replace the now deprecated unsafeLengthSquared reference with the newer lengthSquared in the README.md of the Complex module.
2020-05-26 15:45:37 +02:00
Stephen Canon
4297fbee6a
Remove complex benchmarks from tests for now
...
I'm going to reinstate this as a binary executable target, so that we can ensure it only runs in release (and add some useful command line options via the argument parser). In the short-term, I want to unblock @compnerd's work on supporting Windows, so I'm preemtively removing the test (these tests cannot run on Windows).
2020-05-05 15:13:47 -04:00
Stephen Canon
750170404a
The derivative of Complex.init(_:_:) is broken with the current Xcode toolchain.
...
Remove it for now; it'll still be present on the -5.3 branch, so we'll pick it up again when we're able to.
2020-05-01 08:50:32 -04:00
Stephen Canon
a5cc950a86
Merge pull request #111 from rxwei/complex-derivatives
...
Make 'Complex' differentiable.
2020-04-22 16:43:46 -04:00
Richard Wei
488e250259
Make 'Complex' differentiable.
...
* Conform `Complex` to `Differentiable`.
* Define derivatives for `init(_:_:)`, `real`, `imaginary`, `conjugate`, `+(_:_:)`, `-(_:_:)`, `*(_:_:)`, `/(_:_:)`.
Gated under `#if canImport(_Differentiation)`.
2020-04-22 13:35:36 -07:00
Stephen Canon
59444343c4
Somewhat better implementation of pow(x,n) for Float16.
2020-04-10 16:16:25 -04:00
Stephen Canon
ee082efdaf
Fix bug for very large exponents pow(Float/Double, Int).
...
Just-added tests expose this issue, where the split of n into high/low parts could produce parts with different signs. If both x**high and x**low then overflow and underflow, the resulting computation would be 0*inf (or inf*0) and produce NaN instead of either zero or infinity.
2020-04-10 11:51:57 -04:00
Stephen Canon
ff6a0ff2a5
Fix bug for very large exponents pow(Float/Double, Int).
...
Just-added tests expose this issue, where the split of n into high/low parts could produce parts with different signs. If both x**high and x**low then overflow and underflow, the resulting computation would be 0*inf (or inf*0) and produce NaN instead of either zero or infinity.
2020-04-10 11:46:22 -04:00
Stephen Canon
a35f5ba889
Add Real conformance for Float16.
2020-04-08 15:14:48 -04:00
Stephen Canon
014ce562a4
Update README.md
2020-02-21 09:22:40 -05:00
Stephen Canon
9dba38cc1a
Update README.md
2020-02-21 09:22:40 -05:00
Stephen Canon
0fa2cd458e
Update README.md
2020-02-21 09:22:40 -05:00
Stephen Canon
76954c06a7
Back to trailing 'Module'
2020-02-21 09:22:40 -05:00
Stephen Canon
4352c3a6a1
Put an underscore between the module prefix and name.
...
Ideally we'd be able to use Numerics.Module instead of underscore, but we can't always get what we want.
2020-02-21 09:22:40 -05:00
Stephen Canon
43052f0819
Prefix modules with "Numerics"; use underscored prefix for NumericsShims.
2020-02-21 09:22:40 -05:00
Stephen Canon
016cd6a2fc
AlgebraicField should conform to SignedNumeric, not just Numeric.
...
Because a field necessarily has additive inverses, SignedNumeric conformance is appropriate. (SignedNumeric is poorly named; it doesn't actually mean that a type has a "sign", only that there's a negation operation).
2020-01-24 10:42:11 -05:00
Ben Rimmington
eda432142d
[Complex] Encode and decode using unkeyedContainer
2020-01-22 18:34:20 +00:00
Stephen Canon
7bd2909875
Merge pull request #91 from apple/FieldProtocol
...
Introduce AlgebraicField protocol
2020-01-20 13:35:59 -05:00
Stephen Canon
323542cba1
Add short notes to README docs on AlgebraicField.
2020-01-19 16:06:31 -05:00
Stephen Canon
98f3d25fe8
Rename Field -> AlgebraicField
...
We might walk this back in the future, but for the short-term let's avoid stomping on the generic term "Field".
2020-01-19 15:53:35 -05:00
Stephen Canon
8cbda03867
s/euclidean/Euclidean/
2020-01-16 11:12:46 -05:00
Stephen Canon
b6839260cb
Add some clarification to documentation of .reciprocal.
2020-01-16 11:11:56 -05:00
Stephen Canon
1879299216
Avoid shadowing function argument by using a different name for local var.
2020-01-13 20:56:48 -05:00
Stephen Canon
53af148f0f
Introduce Field protocol
...
For now, this mostly allows one to write code generic over Real and Complex types. TBD whether it should also include finite fields, or be restricted to characteristic-zero. Also bikeshedding to be done on exactly what operations should fall into this protocol and what it should be named. This is just to get discussion started.
2020-01-13 16:19:19 -05:00
Stephen Canon
3d637e1302
Split conformance of Float, Double, Float80 to Real out into separate files.
...
Also reformat these files to be more closely in line with Swift conventions.
2019-12-27 16:39:26 -05:00
Stephen Canon
5bf2f828ef
Initial pass at implementing pow(Self,Int) with desired semantics.
...
We don't need to do anything special for Float80, but Float and Double require some handholding because Int values are not always representable.
2019-11-29 22:56:14 -05:00
Stephen Canon
5e978d85a2
Add inline decls of lgamma_r and friends on Linux, too.
2019-11-22 09:47:36 -05:00
Stephen Canon
f6c2c34910
Rename unsafeLengthSquared -> lengthSquared
...
Also further tweak polar init for Complex to allow (-infinity, θ) when θ is not finite.
2019-11-20 16:15:10 -05:00
Stephen Canon and Richard Wei
5931d036ab
Update Sources/Complex/Complex.swift
...
Co-Authored-By: Richard Wei <rxrwei@gmail.com >
2019-11-20 14:56:31 -05:00
Stephen Canon
565839d673
Address behavior of Complex.init(length:phase:)
...
Instead of being failable, adopt the following policy:
- If length is zero or infinity, the phase does not matter.
- Otherwise, the phase must be finite or a precondition failure occurs.
Discussion here: https://github.com/apple/swift-numerics/issues/51
2019-11-20 14:32:19 -05:00
Ole Begemann
0ed7e786b5
Remove broken link in Real module readme
...
The link target for `[Real]` wasn't defined. I decided toremove the link altogether because the readme would essentially link to itself.
2019-11-12 17:28:36 +01:00
Stephen Canon and Xiaodi Wu
5d783ce458
Update Sources/Real/ScalarConformances.swift
...
Co-Authored-By: Xiaodi Wu <xiaodi.wu@gmail.com >
2019-11-10 22:19:39 -05:00
Stephen Canon and Xiaodi Wu
3fbc22cbe3
Update Sources/Real/ScalarConformances.swift
...
Co-Authored-By: Xiaodi Wu <xiaodi.wu@gmail.com >
2019-11-10 22:19:30 -05:00
Stephen Canon
e24586e2b1
Defer to libm cbrt for root(x,3).
...
This lets us get exact cases right only platforms where cbrt(x) has sub-ulp accuracy. It doesn't get all the other non-power-of-two roots quite right, and is still dependent on the host system, but 2 and 3 are the most common roots people take by far, so it's a good first step.
2019-11-10 22:02:53 -05:00
Stephen Canon
6d904ea56c
Add documentation for AdditiveArithmetic conformance of ElementaryFunctions
2019-11-10 21:12:37 -05:00
NevinBR
6195693e3a
Made ElementaryFunctions refine AdditiveArithmetic
2019-11-10 19:58:07 -05:00
Stephen Canon
3519620ac6
Merge pull request #65 from stephentyrone/split-codable-make-debugDecription-unconditional
...
Split Codable conformance of Complex into Encodable and Decodable. NFC.
2019-11-10 14:59:18 -05:00
Stephen Canon
0ddfd0ead7
Split Codable conformance of Complex into Encodable and Decodable. NFC.
...
Also make conformance to CustomDebugStringConvertible unconditional using String(reflecting:) on x and y.
2019-11-10 14:32:09 -05:00
NevinBR
ab19494638
Fixed typo in a comment
2019-11-10 10:35:22 -05:00
Noah Wilder
b46bd9a83e
Fixed Complex division by zero to return .infinity
2019-11-09 01:37:27 -05:00
araki
cd4a8b41cf
Make Complex SignedNumeric
2019-11-09 10:13:37 +09:00
Stephen Canon
5d4368257e
Merge pull request #36 from Sajjon/fix_typos_in_code
...
Fix typos in source code
2019-11-08 09:33:23 -05:00
Sajjon
0cc4950453
Adding MARK in long source file
2019-11-08 08:39:27 +01:00
Sajjon
c423f9592b
Fix typos in source code
2019-11-08 08:39:07 +01:00
Noah Wilder
0308def714
Added setters for real and imaginary properties of Complex
2019-11-07 23:51:40 -05:00
Stephen Canon
37253aa0b6
Update Real module README to bring it in line with the Swift Numerics blog post.
2019-11-06 12:58:09 -05:00