From 43052f0819f41da3c09a7554eb188da093b56bdc Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Thu, 23 Jan 2020 20:35:38 -0500 Subject: [PATCH 01/10] Prefix modules with "Numerics"; use underscored prefix for NumericsShims. --- Package.swift | 16 ++++++++-------- Sources/Numerics/Numerics.swift | 4 ++-- .../Arithmetic.swift | 2 +- .../{Complex => NumericsComplex}/Complex.swift | 2 +- Sources/{Complex => NumericsComplex}/README.md | 0 .../{Real => NumericsReal}/AlgebraicField.swift | 0 Sources/{Real => NumericsReal}/Double+Real.swift | 2 +- .../ElementaryFunctions.swift | 0 Sources/{Real => NumericsReal}/Float+Real.swift | 2 +- .../{Real => NumericsReal}/Float80+Real.swift | 2 +- Sources/{Real => NumericsReal}/README.md | 0 Sources/{Real => NumericsReal}/Real.swift | 0 .../{Real => NumericsReal}/RealFunctions.swift | 0 .../{NumericsShims => _NumericsShims}/README.md | 0 .../_NumericsShims.c} | 2 +- .../include/_NumericsShims.h} | 0 .../ComplexTests/ArithmeticBenchmarkTests.swift | 4 ++-- Tests/ComplexTests/ArithmeticTests.swift | 4 ++-- Tests/ComplexTests/PropertyTests.swift | 4 ++-- Tests/RealTests/IntegerExponentTests.swift | 2 +- Tests/RealTests/RealTestSupport.swift | 2 +- Tests/RealTests/RealTests.swift | 2 +- 22 files changed, 25 insertions(+), 25 deletions(-) rename Sources/{Complex => NumericsComplex}/Arithmetic.swift (99%) rename Sources/{Complex => NumericsComplex}/Complex.swift (99%) rename Sources/{Complex => NumericsComplex}/README.md (100%) rename Sources/{Real => NumericsReal}/AlgebraicField.swift (100%) rename Sources/{Real => NumericsReal}/Double+Real.swift (99%) rename Sources/{Real => NumericsReal}/ElementaryFunctions.swift (100%) rename Sources/{Real => NumericsReal}/Float+Real.swift (99%) rename Sources/{Real => NumericsReal}/Float80+Real.swift (99%) rename Sources/{Real => NumericsReal}/README.md (100%) rename Sources/{Real => NumericsReal}/Real.swift (100%) rename Sources/{Real => NumericsReal}/RealFunctions.swift (100%) rename Sources/{NumericsShims => _NumericsShims}/README.md (100%) rename Sources/{NumericsShims/NumericsShims.c => _NumericsShims/_NumericsShims.c} (96%) rename Sources/{NumericsShims/include/NumericsShims.h => _NumericsShims/include/_NumericsShims.h} (100%) diff --git a/Package.swift b/Package.swift index f91f4414..45a06ef9 100644 --- a/Package.swift +++ b/Package.swift @@ -15,19 +15,19 @@ import PackageDescription let package = Package( name: "swift-numerics", products: [ - .library(name: "Complex", targets: ["Complex"]), + .library(name: "NumericsComplex", targets: ["NumericsComplex"]), .library(name: "Numerics", targets: ["Numerics"]), - .library(name: "Real", targets: ["Real"]), + .library(name: "NumericsReal", targets: ["NumericsReal"]), ], dependencies: [ ], targets: [ - .target(name: "Complex", dependencies: ["Real"]), - .target(name: "Numerics", dependencies: ["Complex", "Real"]), - .target(name: "NumericsShims", dependencies: []), - .target(name: "Real", dependencies: ["NumericsShims"]), + .target(name: "NumericsComplex", dependencies: ["NumericsReal"]), + .target(name: "Numerics", dependencies: ["NumericsComplex", "NumericsReal"]), + .target(name: "_NumericsShims", dependencies: []), + .target(name: "NumericsReal", dependencies: ["_NumericsShims"]), - .testTarget(name: "ComplexTests", dependencies: ["Complex", "NumericsShims"]), - .testTarget(name: "RealTests", dependencies: ["Real"]), + .testTarget(name: "ComplexTests", dependencies: ["NumericsComplex", "_NumericsShims"]), + .testTarget(name: "RealTests", dependencies: ["NumericsReal"]), ] ) diff --git a/Sources/Numerics/Numerics.swift b/Sources/Numerics/Numerics.swift index 72e83f17..45fb9746 100644 --- a/Sources/Numerics/Numerics.swift +++ b/Sources/Numerics/Numerics.swift @@ -10,5 +10,5 @@ //===----------------------------------------------------------------------===// // A module that re-exports the complete Swift Numerics public API. -@_exported import Real -@_exported import Complex +@_exported import NumericsReal +@_exported import NumericsComplex diff --git a/Sources/Complex/Arithmetic.swift b/Sources/NumericsComplex/Arithmetic.swift similarity index 99% rename from Sources/Complex/Arithmetic.swift rename to Sources/NumericsComplex/Arithmetic.swift index 654f9b89..6cb56227 100644 --- a/Sources/Complex/Arithmetic.swift +++ b/Sources/NumericsComplex/Arithmetic.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import Real +import NumericsReal // MARK: - Additive structure extension Complex: AdditiveArithmetic { diff --git a/Sources/Complex/Complex.swift b/Sources/NumericsComplex/Complex.swift similarity index 99% rename from Sources/Complex/Complex.swift rename to Sources/NumericsComplex/Complex.swift index 00fe5ca0..10643cb5 100644 --- a/Sources/Complex/Complex.swift +++ b/Sources/NumericsComplex/Complex.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import Real +import NumericsReal /// A complex number represented by real and imaginary parts. /// diff --git a/Sources/Complex/README.md b/Sources/NumericsComplex/README.md similarity index 100% rename from Sources/Complex/README.md rename to Sources/NumericsComplex/README.md diff --git a/Sources/Real/AlgebraicField.swift b/Sources/NumericsReal/AlgebraicField.swift similarity index 100% rename from Sources/Real/AlgebraicField.swift rename to Sources/NumericsReal/AlgebraicField.swift diff --git a/Sources/Real/Double+Real.swift b/Sources/NumericsReal/Double+Real.swift similarity index 99% rename from Sources/Real/Double+Real.swift rename to Sources/NumericsReal/Double+Real.swift index addf1e65..05e44e92 100644 --- a/Sources/Real/Double+Real.swift +++ b/Sources/NumericsReal/Double+Real.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import NumericsShims +import _NumericsShims extension Double: Real { @_transparent diff --git a/Sources/Real/ElementaryFunctions.swift b/Sources/NumericsReal/ElementaryFunctions.swift similarity index 100% rename from Sources/Real/ElementaryFunctions.swift rename to Sources/NumericsReal/ElementaryFunctions.swift diff --git a/Sources/Real/Float+Real.swift b/Sources/NumericsReal/Float+Real.swift similarity index 99% rename from Sources/Real/Float+Real.swift rename to Sources/NumericsReal/Float+Real.swift index 04dfd8f2..b5df21ff 100644 --- a/Sources/Real/Float+Real.swift +++ b/Sources/NumericsReal/Float+Real.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import NumericsShims +import _NumericsShims extension Float: Real { @_transparent diff --git a/Sources/Real/Float80+Real.swift b/Sources/NumericsReal/Float80+Real.swift similarity index 99% rename from Sources/Real/Float80+Real.swift rename to Sources/NumericsReal/Float80+Real.swift index c3357343..9ae7e922 100644 --- a/Sources/Real/Float80+Real.swift +++ b/Sources/NumericsReal/Float80+Real.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import NumericsShims +import _NumericsShims // Restrict extension to platforms for which Float80 exists. #if (arch(i386) || arch(x86_64)) && !os(Windows) && !os(Android) diff --git a/Sources/Real/README.md b/Sources/NumericsReal/README.md similarity index 100% rename from Sources/Real/README.md rename to Sources/NumericsReal/README.md diff --git a/Sources/Real/Real.swift b/Sources/NumericsReal/Real.swift similarity index 100% rename from Sources/Real/Real.swift rename to Sources/NumericsReal/Real.swift diff --git a/Sources/Real/RealFunctions.swift b/Sources/NumericsReal/RealFunctions.swift similarity index 100% rename from Sources/Real/RealFunctions.swift rename to Sources/NumericsReal/RealFunctions.swift diff --git a/Sources/NumericsShims/README.md b/Sources/_NumericsShims/README.md similarity index 100% rename from Sources/NumericsShims/README.md rename to Sources/_NumericsShims/README.md diff --git a/Sources/NumericsShims/NumericsShims.c b/Sources/_NumericsShims/_NumericsShims.c similarity index 96% rename from Sources/NumericsShims/NumericsShims.c rename to Sources/_NumericsShims/_NumericsShims.c index 40751743..8ac212f3 100644 --- a/Sources/NumericsShims/NumericsShims.c +++ b/Sources/_NumericsShims/_NumericsShims.c @@ -16,4 +16,4 @@ // If any shims are added that are not pure header inlines, whatever runtime // support they require can be added to this file. -#include "NumericsShims.h" +#include "_NumericsShims.h" diff --git a/Sources/NumericsShims/include/NumericsShims.h b/Sources/_NumericsShims/include/_NumericsShims.h similarity index 100% rename from Sources/NumericsShims/include/NumericsShims.h rename to Sources/_NumericsShims/include/_NumericsShims.h diff --git a/Tests/ComplexTests/ArithmeticBenchmarkTests.swift b/Tests/ComplexTests/ArithmeticBenchmarkTests.swift index 14f01b5d..6a2b7845 100644 --- a/Tests/ComplexTests/ArithmeticBenchmarkTests.swift +++ b/Tests/ComplexTests/ArithmeticBenchmarkTests.swift @@ -10,10 +10,10 @@ //===----------------------------------------------------------------------===// import XCTest -import Complex +import NumericsComplex // For CComplex and shims -import NumericsShims +import _NumericsShims extension Complex where RealType == Double { @_transparent diff --git a/Tests/ComplexTests/ArithmeticTests.swift b/Tests/ComplexTests/ArithmeticTests.swift index de4c7e8d..d48eefd4 100644 --- a/Tests/ComplexTests/ArithmeticTests.swift +++ b/Tests/ComplexTests/ArithmeticTests.swift @@ -10,8 +10,8 @@ //===----------------------------------------------------------------------===// import XCTest -import Complex -import Real +import NumericsComplex +import NumericsReal // TODO: improve this to be a general-purpose complex comparison with tolerance func relativeError(_ a: Complex, _ b: Complex) -> T { diff --git a/Tests/ComplexTests/PropertyTests.swift b/Tests/ComplexTests/PropertyTests.swift index 6c21791a..eec7f705 100644 --- a/Tests/ComplexTests/PropertyTests.swift +++ b/Tests/ComplexTests/PropertyTests.swift @@ -10,8 +10,8 @@ //===----------------------------------------------------------------------===// import XCTest -import Complex -import Real +import NumericsComplex +import NumericsReal final class PropertyTests: XCTestCase { diff --git a/Tests/RealTests/IntegerExponentTests.swift b/Tests/RealTests/IntegerExponentTests.swift index b1ec3f97..800d692f 100644 --- a/Tests/RealTests/IntegerExponentTests.swift +++ b/Tests/RealTests/IntegerExponentTests.swift @@ -10,7 +10,7 @@ //===----------------------------------------------------------------------===// import XCTest -import Real +import NumericsReal internal extension Real where Self: BinaryFloatingPoint { static func testIntegerExponentCommon() { diff --git a/Tests/RealTests/RealTestSupport.swift b/Tests/RealTests/RealTestSupport.swift index 63edcd84..d2a1d92e 100644 --- a/Tests/RealTests/RealTestSupport.swift +++ b/Tests/RealTests/RealTestSupport.swift @@ -10,7 +10,7 @@ //===----------------------------------------------------------------------===// import XCTest -import Real +import NumericsReal #if (arch(i386) || arch(x86_64)) && !os(Windows) && !os(Android) typealias TestLiteralType = Float80 diff --git a/Tests/RealTests/RealTests.swift b/Tests/RealTests/RealTests.swift index bd3a21d6..8a8c70ac 100644 --- a/Tests/RealTests/RealTests.swift +++ b/Tests/RealTests/RealTests.swift @@ -10,7 +10,7 @@ //===----------------------------------------------------------------------===// import XCTest -import Real +import NumericsReal internal extension ElementaryFunctions where Self: BinaryFloatingPoint { static func elementaryFunctionChecks() { From 4352c3a6a1cc4c048b1227eb87ac613d32da44c7 Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Mon, 17 Feb 2020 15:59:53 -0500 Subject: [PATCH 02/10] 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. --- Package.swift | 16 ++++++++-------- README.md | 9 ++++----- Sources/Numerics/Numerics.swift | 4 ++-- .../Arithmetic.swift | 2 +- .../Complex.swift | 2 +- .../README.md | 4 ++-- .../AlgebraicField.swift | 0 .../Double+Real.swift | 2 +- .../ElementaryFunctions.swift | 0 .../Float+Real.swift | 2 +- .../Float80+Real.swift | 2 +- .../{NumericsReal => Numerics_Real}/README.md | 0 .../{NumericsReal => Numerics_Real}/Real.swift | 0 .../RealFunctions.swift | 0 .../README.md | 0 .../_Numerics_Shims.c} | 2 +- .../include/_Numerics_Shims.h} | 0 .../ComplexTests/ArithmeticBenchmarkTests.swift | 4 ++-- Tests/ComplexTests/ArithmeticTests.swift | 4 ++-- Tests/ComplexTests/PropertyTests.swift | 4 ++-- Tests/RealTests/IntegerExponentTests.swift | 2 +- Tests/RealTests/RealTestSupport.swift | 2 +- Tests/RealTests/RealTests.swift | 2 +- 23 files changed, 31 insertions(+), 32 deletions(-) rename Sources/{NumericsComplex => Numerics_Complex}/Arithmetic.swift (99%) rename Sources/{NumericsComplex => Numerics_Complex}/Complex.swift (99%) rename Sources/{NumericsComplex => Numerics_Complex}/README.md (98%) rename Sources/{NumericsReal => Numerics_Real}/AlgebraicField.swift (100%) rename Sources/{NumericsReal => Numerics_Real}/Double+Real.swift (99%) rename Sources/{NumericsReal => Numerics_Real}/ElementaryFunctions.swift (100%) rename Sources/{NumericsReal => Numerics_Real}/Float+Real.swift (99%) rename Sources/{NumericsReal => Numerics_Real}/Float80+Real.swift (99%) rename Sources/{NumericsReal => Numerics_Real}/README.md (100%) rename Sources/{NumericsReal => Numerics_Real}/Real.swift (100%) rename Sources/{NumericsReal => Numerics_Real}/RealFunctions.swift (100%) rename Sources/{_NumericsShims => _Numerics_Shims}/README.md (100%) rename Sources/{_NumericsShims/_NumericsShims.c => _Numerics_Shims/_Numerics_Shims.c} (96%) rename Sources/{_NumericsShims/include/_NumericsShims.h => _Numerics_Shims/include/_Numerics_Shims.h} (100%) diff --git a/Package.swift b/Package.swift index 45a06ef9..7a416dc0 100644 --- a/Package.swift +++ b/Package.swift @@ -15,19 +15,19 @@ import PackageDescription let package = Package( name: "swift-numerics", products: [ - .library(name: "NumericsComplex", targets: ["NumericsComplex"]), + .library(name: "Numerics_Complex", targets: ["Numerics_Complex"]), .library(name: "Numerics", targets: ["Numerics"]), - .library(name: "NumericsReal", targets: ["NumericsReal"]), + .library(name: "Numerics_Real", targets: ["Numerics_Real"]), ], dependencies: [ ], targets: [ - .target(name: "NumericsComplex", dependencies: ["NumericsReal"]), - .target(name: "Numerics", dependencies: ["NumericsComplex", "NumericsReal"]), - .target(name: "_NumericsShims", dependencies: []), - .target(name: "NumericsReal", dependencies: ["_NumericsShims"]), + .target(name: "Numerics_Complex", dependencies: ["Numerics_Real"]), + .target(name: "Numerics", dependencies: ["Numerics_Complex", "Numerics_Real"]), + .target(name: "_Numerics_Shims", dependencies: []), + .target(name: "Numerics_Real", dependencies: ["_Numerics_Shims"]), - .testTarget(name: "ComplexTests", dependencies: ["NumericsComplex", "_NumericsShims"]), - .testTarget(name: "RealTests", dependencies: ["NumericsReal"]), + .testTarget(name: "ComplexTests", dependencies: ["Numerics_Complex", "_Numerics_Shims"]), + .testTarget(name: "RealTests", dependencies: ["Numerics_Real"]), ] ) diff --git a/README.md b/README.md index 28848e31..04f3f177 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ These modules fall broadly into two categories: There is some overlap between these two categories, and API that begins in the first category may migrate to the second as it matures and new uses are discovered. -Swift Numerics modules are fine-grained; if you need support for Complex numbers, you can import the Complex module without pulling in everything else in the library as well: +Swift Numerics modules are fine-grained; if you need support for Complex numbers, you can import the Numerics_Complex module without pulling in everything else in the library as well: ```swift -import Complex +import Numerics_Complex let z = Complex.i ``` @@ -51,8 +51,8 @@ To fix a bug, or make smaller improvements: Questions about how to use Swift Numerics modules, or issues that are not clearly bugs can be discussed in the ["Swift Numerics" section of the Swift forums.](https://forums.swift.org/c/related-projects/swift-numerics) ## Modules -1. [Real](Sources/Real/README.md) -2. [Complex](Sources/Complex/README.md) +1. [Numerics_Real](Sources/Numerics_Real/README.md) +2. [Numerics_Complex](Sources/Numerics_Complex/README.md) ## Future expansion 1. [Approximate Equality](https://github.com/apple/swift-numerics/issues/3) @@ -60,4 +60,3 @@ Questions about how to use Swift Numerics modules, or issues that are not clearl 3. [Arbitrary-Precision Integers](https://github.com/apple/swift-numerics/issues/5) 4. [Shaped Arrays](https://github.com/apple/swift-numerics/issues/6) 5. [Decimal Floating-point](https://github.com/apple/swift-numerics/issues/7) -6. [Float16](https://github.com/apple/swift-numerics/issues/8) diff --git a/Sources/Numerics/Numerics.swift b/Sources/Numerics/Numerics.swift index 45fb9746..74315f23 100644 --- a/Sources/Numerics/Numerics.swift +++ b/Sources/Numerics/Numerics.swift @@ -10,5 +10,5 @@ //===----------------------------------------------------------------------===// // A module that re-exports the complete Swift Numerics public API. -@_exported import NumericsReal -@_exported import NumericsComplex +@_exported import Numerics_Real +@_exported import Numerics_Complex diff --git a/Sources/NumericsComplex/Arithmetic.swift b/Sources/Numerics_Complex/Arithmetic.swift similarity index 99% rename from Sources/NumericsComplex/Arithmetic.swift rename to Sources/Numerics_Complex/Arithmetic.swift index 6cb56227..48e6b806 100644 --- a/Sources/NumericsComplex/Arithmetic.swift +++ b/Sources/Numerics_Complex/Arithmetic.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import NumericsReal +import Numerics_Real // MARK: - Additive structure extension Complex: AdditiveArithmetic { diff --git a/Sources/NumericsComplex/Complex.swift b/Sources/Numerics_Complex/Complex.swift similarity index 99% rename from Sources/NumericsComplex/Complex.swift rename to Sources/Numerics_Complex/Complex.swift index 10643cb5..2d72f1e8 100644 --- a/Sources/NumericsComplex/Complex.swift +++ b/Sources/Numerics_Complex/Complex.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import NumericsReal +import Numerics_Real /// A complex number represented by real and imaginary parts. /// diff --git a/Sources/NumericsComplex/README.md b/Sources/Numerics_Complex/README.md similarity index 98% rename from Sources/NumericsComplex/README.md rename to Sources/Numerics_Complex/README.md index 3c9dc0c4..6b05fc34 100644 --- a/Sources/NumericsComplex/README.md +++ b/Sources/Numerics_Complex/README.md @@ -2,7 +2,7 @@ This module provides a `Complex` number type generic over an underlying `RealType`: ```swift -1> import Complex +1> import Numerics_Complex 2> let z = Complex(1,1) // z = 1 + i ``` This module provides approximate feature parity and memory layout compatibility with C, Fortran, and C++ complex types (although the importer cannot map the types for you, buffers may be reinterpreted to shim API defined in other languages). @@ -10,7 +10,7 @@ This module provides approximate feature parity and memory layout compatibility The usual arithmetic operators are provided for Complex numbers, as well as conversion to and from polar coordinates and many useful properties, plus conformances to the obvious usual protocols: `Equatable`, `Hashable`, `Codable` (if the underlying `RealType` is), and `AlgebraicField` (hence also `AdditiveArithmetic` and `SignedNumeric`). ### Dependencies: -- The `Real` module. +- The `Numerics_Real` module. ## Design notes diff --git a/Sources/NumericsReal/AlgebraicField.swift b/Sources/Numerics_Real/AlgebraicField.swift similarity index 100% rename from Sources/NumericsReal/AlgebraicField.swift rename to Sources/Numerics_Real/AlgebraicField.swift diff --git a/Sources/NumericsReal/Double+Real.swift b/Sources/Numerics_Real/Double+Real.swift similarity index 99% rename from Sources/NumericsReal/Double+Real.swift rename to Sources/Numerics_Real/Double+Real.swift index 05e44e92..80c85573 100644 --- a/Sources/NumericsReal/Double+Real.swift +++ b/Sources/Numerics_Real/Double+Real.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import _NumericsShims +import _Numerics_Shims extension Double: Real { @_transparent diff --git a/Sources/NumericsReal/ElementaryFunctions.swift b/Sources/Numerics_Real/ElementaryFunctions.swift similarity index 100% rename from Sources/NumericsReal/ElementaryFunctions.swift rename to Sources/Numerics_Real/ElementaryFunctions.swift diff --git a/Sources/NumericsReal/Float+Real.swift b/Sources/Numerics_Real/Float+Real.swift similarity index 99% rename from Sources/NumericsReal/Float+Real.swift rename to Sources/Numerics_Real/Float+Real.swift index b5df21ff..4d076f54 100644 --- a/Sources/NumericsReal/Float+Real.swift +++ b/Sources/Numerics_Real/Float+Real.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import _NumericsShims +import _Numerics_Shims extension Float: Real { @_transparent diff --git a/Sources/NumericsReal/Float80+Real.swift b/Sources/Numerics_Real/Float80+Real.swift similarity index 99% rename from Sources/NumericsReal/Float80+Real.swift rename to Sources/Numerics_Real/Float80+Real.swift index 9ae7e922..e3e5f39a 100644 --- a/Sources/NumericsReal/Float80+Real.swift +++ b/Sources/Numerics_Real/Float80+Real.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import _NumericsShims +import _Numerics_Shims // Restrict extension to platforms for which Float80 exists. #if (arch(i386) || arch(x86_64)) && !os(Windows) && !os(Android) diff --git a/Sources/NumericsReal/README.md b/Sources/Numerics_Real/README.md similarity index 100% rename from Sources/NumericsReal/README.md rename to Sources/Numerics_Real/README.md diff --git a/Sources/NumericsReal/Real.swift b/Sources/Numerics_Real/Real.swift similarity index 100% rename from Sources/NumericsReal/Real.swift rename to Sources/Numerics_Real/Real.swift diff --git a/Sources/NumericsReal/RealFunctions.swift b/Sources/Numerics_Real/RealFunctions.swift similarity index 100% rename from Sources/NumericsReal/RealFunctions.swift rename to Sources/Numerics_Real/RealFunctions.swift diff --git a/Sources/_NumericsShims/README.md b/Sources/_Numerics_Shims/README.md similarity index 100% rename from Sources/_NumericsShims/README.md rename to Sources/_Numerics_Shims/README.md diff --git a/Sources/_NumericsShims/_NumericsShims.c b/Sources/_Numerics_Shims/_Numerics_Shims.c similarity index 96% rename from Sources/_NumericsShims/_NumericsShims.c rename to Sources/_Numerics_Shims/_Numerics_Shims.c index 8ac212f3..ae2fa3d7 100644 --- a/Sources/_NumericsShims/_NumericsShims.c +++ b/Sources/_Numerics_Shims/_Numerics_Shims.c @@ -16,4 +16,4 @@ // If any shims are added that are not pure header inlines, whatever runtime // support they require can be added to this file. -#include "_NumericsShims.h" +#include "_Numerics_Shims.h" diff --git a/Sources/_NumericsShims/include/_NumericsShims.h b/Sources/_Numerics_Shims/include/_Numerics_Shims.h similarity index 100% rename from Sources/_NumericsShims/include/_NumericsShims.h rename to Sources/_Numerics_Shims/include/_Numerics_Shims.h diff --git a/Tests/ComplexTests/ArithmeticBenchmarkTests.swift b/Tests/ComplexTests/ArithmeticBenchmarkTests.swift index 6a2b7845..0300fac1 100644 --- a/Tests/ComplexTests/ArithmeticBenchmarkTests.swift +++ b/Tests/ComplexTests/ArithmeticBenchmarkTests.swift @@ -10,10 +10,10 @@ //===----------------------------------------------------------------------===// import XCTest -import NumericsComplex +import Numerics_Complex // For CComplex and shims -import _NumericsShims +import _Numerics_Shims extension Complex where RealType == Double { @_transparent diff --git a/Tests/ComplexTests/ArithmeticTests.swift b/Tests/ComplexTests/ArithmeticTests.swift index d48eefd4..f33b5d5b 100644 --- a/Tests/ComplexTests/ArithmeticTests.swift +++ b/Tests/ComplexTests/ArithmeticTests.swift @@ -10,8 +10,8 @@ //===----------------------------------------------------------------------===// import XCTest -import NumericsComplex -import NumericsReal +import Numerics_Complex +import Numerics_Real // TODO: improve this to be a general-purpose complex comparison with tolerance func relativeError(_ a: Complex, _ b: Complex) -> T { diff --git a/Tests/ComplexTests/PropertyTests.swift b/Tests/ComplexTests/PropertyTests.swift index eec7f705..27f70d9e 100644 --- a/Tests/ComplexTests/PropertyTests.swift +++ b/Tests/ComplexTests/PropertyTests.swift @@ -10,8 +10,8 @@ //===----------------------------------------------------------------------===// import XCTest -import NumericsComplex -import NumericsReal +import Numerics_Complex +import Numerics_Real final class PropertyTests: XCTestCase { diff --git a/Tests/RealTests/IntegerExponentTests.swift b/Tests/RealTests/IntegerExponentTests.swift index 800d692f..b643c413 100644 --- a/Tests/RealTests/IntegerExponentTests.swift +++ b/Tests/RealTests/IntegerExponentTests.swift @@ -10,7 +10,7 @@ //===----------------------------------------------------------------------===// import XCTest -import NumericsReal +import Numerics_Real internal extension Real where Self: BinaryFloatingPoint { static func testIntegerExponentCommon() { diff --git a/Tests/RealTests/RealTestSupport.swift b/Tests/RealTests/RealTestSupport.swift index d2a1d92e..c699678e 100644 --- a/Tests/RealTests/RealTestSupport.swift +++ b/Tests/RealTests/RealTestSupport.swift @@ -10,7 +10,7 @@ //===----------------------------------------------------------------------===// import XCTest -import NumericsReal +import Numerics_Real #if (arch(i386) || arch(x86_64)) && !os(Windows) && !os(Android) typealias TestLiteralType = Float80 diff --git a/Tests/RealTests/RealTests.swift b/Tests/RealTests/RealTests.swift index 8a8c70ac..09441525 100644 --- a/Tests/RealTests/RealTests.swift +++ b/Tests/RealTests/RealTests.swift @@ -10,7 +10,7 @@ //===----------------------------------------------------------------------===// import XCTest -import NumericsReal +import Numerics_Real internal extension ElementaryFunctions where Self: BinaryFloatingPoint { static func elementaryFunctionChecks() { From 76954c06a77bf6ff186b824a38e108dc02234346 Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Thu, 20 Feb 2020 12:26:19 -0500 Subject: [PATCH 03/10] Back to trailing 'Module' --- Package.swift | 16 ++++++++-------- README.md | 8 ++++---- .../Arithmetic.swift | 2 +- .../Complex.swift | 2 +- .../README.md | 4 ++-- Sources/Numerics/Numerics.swift | 4 ++-- .../AlgebraicField.swift | 0 .../Double+Real.swift | 2 +- .../ElementaryFunctions.swift | 0 .../Float+Real.swift | 2 +- .../Float80+Real.swift | 2 +- Sources/{Numerics_Real => RealModule}/README.md | 0 Sources/{Numerics_Real => RealModule}/Real.swift | 0 .../RealFunctions.swift | 0 .../README.md | 0 .../_NumericsShims.c} | 2 +- .../include/_NumericsShims.h} | 0 .../ComplexTests/ArithmeticBenchmarkTests.swift | 4 ++-- Tests/ComplexTests/ArithmeticTests.swift | 4 ++-- Tests/ComplexTests/PropertyTests.swift | 4 ++-- Tests/RealTests/IntegerExponentTests.swift | 2 +- Tests/RealTests/RealTestSupport.swift | 2 +- Tests/RealTests/RealTests.swift | 2 +- 23 files changed, 31 insertions(+), 31 deletions(-) rename Sources/{Numerics_Complex => ComplexModule}/Arithmetic.swift (99%) rename Sources/{Numerics_Complex => ComplexModule}/Complex.swift (99%) rename Sources/{Numerics_Complex => ComplexModule}/README.md (98%) rename Sources/{Numerics_Real => RealModule}/AlgebraicField.swift (100%) rename Sources/{Numerics_Real => RealModule}/Double+Real.swift (99%) rename Sources/{Numerics_Real => RealModule}/ElementaryFunctions.swift (100%) rename Sources/{Numerics_Real => RealModule}/Float+Real.swift (99%) rename Sources/{Numerics_Real => RealModule}/Float80+Real.swift (99%) rename Sources/{Numerics_Real => RealModule}/README.md (100%) rename Sources/{Numerics_Real => RealModule}/Real.swift (100%) rename Sources/{Numerics_Real => RealModule}/RealFunctions.swift (100%) rename Sources/{_Numerics_Shims => _NumericsShims}/README.md (100%) rename Sources/{_Numerics_Shims/_Numerics_Shims.c => _NumericsShims/_NumericsShims.c} (96%) rename Sources/{_Numerics_Shims/include/_Numerics_Shims.h => _NumericsShims/include/_NumericsShims.h} (100%) diff --git a/Package.swift b/Package.swift index 7a416dc0..566bf44e 100644 --- a/Package.swift +++ b/Package.swift @@ -15,19 +15,19 @@ import PackageDescription let package = Package( name: "swift-numerics", products: [ - .library(name: "Numerics_Complex", targets: ["Numerics_Complex"]), + .library(name: "ComplexModule", targets: ["ComplexModule"]), .library(name: "Numerics", targets: ["Numerics"]), - .library(name: "Numerics_Real", targets: ["Numerics_Real"]), + .library(name: "RealModule", targets: ["RealModule"]), ], dependencies: [ ], targets: [ - .target(name: "Numerics_Complex", dependencies: ["Numerics_Real"]), - .target(name: "Numerics", dependencies: ["Numerics_Complex", "Numerics_Real"]), - .target(name: "_Numerics_Shims", dependencies: []), - .target(name: "Numerics_Real", dependencies: ["_Numerics_Shims"]), + .target(name: "ComplexModule", dependencies: ["RealModule"]), + .target(name: "Numerics", dependencies: ["ComplexModule", "RealModule"]), + .target(name: "_NumericsShims", dependencies: []), + .target(name: "RealModule", dependencies: ["_NumericsShims"]), - .testTarget(name: "ComplexTests", dependencies: ["Numerics_Complex", "_Numerics_Shims"]), - .testTarget(name: "RealTests", dependencies: ["Numerics_Real"]), + .testTarget(name: "ComplexTests", dependencies: ["ComplexModule", "_NumericsShims"]), + .testTarget(name: "RealTests", dependencies: ["RealModule"]), ] ) diff --git a/README.md b/README.md index 04f3f177..58c7aa84 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ These modules fall broadly into two categories: There is some overlap between these two categories, and API that begins in the first category may migrate to the second as it matures and new uses are discovered. -Swift Numerics modules are fine-grained; if you need support for Complex numbers, you can import the Numerics_Complex module without pulling in everything else in the library as well: +Swift Numerics modules are fine-grained; if you need support for Complex numbers, you can import the ComplexModule module without pulling in everything else in the library as well: ```swift -import Numerics_Complex +import ComplexModule let z = Complex.i ``` @@ -51,8 +51,8 @@ To fix a bug, or make smaller improvements: Questions about how to use Swift Numerics modules, or issues that are not clearly bugs can be discussed in the ["Swift Numerics" section of the Swift forums.](https://forums.swift.org/c/related-projects/swift-numerics) ## Modules -1. [Numerics_Real](Sources/Numerics_Real/README.md) -2. [Numerics_Complex](Sources/Numerics_Complex/README.md) +1. [RealModule](Sources/RealModule/README.md) +2. [ComplexModule](Sources/ComplexModule/README.md) ## Future expansion 1. [Approximate Equality](https://github.com/apple/swift-numerics/issues/3) diff --git a/Sources/Numerics_Complex/Arithmetic.swift b/Sources/ComplexModule/Arithmetic.swift similarity index 99% rename from Sources/Numerics_Complex/Arithmetic.swift rename to Sources/ComplexModule/Arithmetic.swift index 48e6b806..c08b4cf9 100644 --- a/Sources/Numerics_Complex/Arithmetic.swift +++ b/Sources/ComplexModule/Arithmetic.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import Numerics_Real +import RealModule // MARK: - Additive structure extension Complex: AdditiveArithmetic { diff --git a/Sources/Numerics_Complex/Complex.swift b/Sources/ComplexModule/Complex.swift similarity index 99% rename from Sources/Numerics_Complex/Complex.swift rename to Sources/ComplexModule/Complex.swift index 2d72f1e8..eb235997 100644 --- a/Sources/Numerics_Complex/Complex.swift +++ b/Sources/ComplexModule/Complex.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import Numerics_Real +import RealModule /// A complex number represented by real and imaginary parts. /// diff --git a/Sources/Numerics_Complex/README.md b/Sources/ComplexModule/README.md similarity index 98% rename from Sources/Numerics_Complex/README.md rename to Sources/ComplexModule/README.md index 6b05fc34..c4cd31cb 100644 --- a/Sources/Numerics_Complex/README.md +++ b/Sources/ComplexModule/README.md @@ -2,7 +2,7 @@ This module provides a `Complex` number type generic over an underlying `RealType`: ```swift -1> import Numerics_Complex +1> import ComplexModule 2> let z = Complex(1,1) // z = 1 + i ``` This module provides approximate feature parity and memory layout compatibility with C, Fortran, and C++ complex types (although the importer cannot map the types for you, buffers may be reinterpreted to shim API defined in other languages). @@ -10,7 +10,7 @@ This module provides approximate feature parity and memory layout compatibility The usual arithmetic operators are provided for Complex numbers, as well as conversion to and from polar coordinates and many useful properties, plus conformances to the obvious usual protocols: `Equatable`, `Hashable`, `Codable` (if the underlying `RealType` is), and `AlgebraicField` (hence also `AdditiveArithmetic` and `SignedNumeric`). ### Dependencies: -- The `Numerics_Real` module. +- The `RealModule` module. ## Design notes diff --git a/Sources/Numerics/Numerics.swift b/Sources/Numerics/Numerics.swift index 74315f23..360ba9a3 100644 --- a/Sources/Numerics/Numerics.swift +++ b/Sources/Numerics/Numerics.swift @@ -10,5 +10,5 @@ //===----------------------------------------------------------------------===// // A module that re-exports the complete Swift Numerics public API. -@_exported import Numerics_Real -@_exported import Numerics_Complex +@_exported import RealModule +@_exported import ComplexModule diff --git a/Sources/Numerics_Real/AlgebraicField.swift b/Sources/RealModule/AlgebraicField.swift similarity index 100% rename from Sources/Numerics_Real/AlgebraicField.swift rename to Sources/RealModule/AlgebraicField.swift diff --git a/Sources/Numerics_Real/Double+Real.swift b/Sources/RealModule/Double+Real.swift similarity index 99% rename from Sources/Numerics_Real/Double+Real.swift rename to Sources/RealModule/Double+Real.swift index 80c85573..05e44e92 100644 --- a/Sources/Numerics_Real/Double+Real.swift +++ b/Sources/RealModule/Double+Real.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import _Numerics_Shims +import _NumericsShims extension Double: Real { @_transparent diff --git a/Sources/Numerics_Real/ElementaryFunctions.swift b/Sources/RealModule/ElementaryFunctions.swift similarity index 100% rename from Sources/Numerics_Real/ElementaryFunctions.swift rename to Sources/RealModule/ElementaryFunctions.swift diff --git a/Sources/Numerics_Real/Float+Real.swift b/Sources/RealModule/Float+Real.swift similarity index 99% rename from Sources/Numerics_Real/Float+Real.swift rename to Sources/RealModule/Float+Real.swift index 4d076f54..b5df21ff 100644 --- a/Sources/Numerics_Real/Float+Real.swift +++ b/Sources/RealModule/Float+Real.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import _Numerics_Shims +import _NumericsShims extension Float: Real { @_transparent diff --git a/Sources/Numerics_Real/Float80+Real.swift b/Sources/RealModule/Float80+Real.swift similarity index 99% rename from Sources/Numerics_Real/Float80+Real.swift rename to Sources/RealModule/Float80+Real.swift index e3e5f39a..9ae7e922 100644 --- a/Sources/Numerics_Real/Float80+Real.swift +++ b/Sources/RealModule/Float80+Real.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import _Numerics_Shims +import _NumericsShims // Restrict extension to platforms for which Float80 exists. #if (arch(i386) || arch(x86_64)) && !os(Windows) && !os(Android) diff --git a/Sources/Numerics_Real/README.md b/Sources/RealModule/README.md similarity index 100% rename from Sources/Numerics_Real/README.md rename to Sources/RealModule/README.md diff --git a/Sources/Numerics_Real/Real.swift b/Sources/RealModule/Real.swift similarity index 100% rename from Sources/Numerics_Real/Real.swift rename to Sources/RealModule/Real.swift diff --git a/Sources/Numerics_Real/RealFunctions.swift b/Sources/RealModule/RealFunctions.swift similarity index 100% rename from Sources/Numerics_Real/RealFunctions.swift rename to Sources/RealModule/RealFunctions.swift diff --git a/Sources/_Numerics_Shims/README.md b/Sources/_NumericsShims/README.md similarity index 100% rename from Sources/_Numerics_Shims/README.md rename to Sources/_NumericsShims/README.md diff --git a/Sources/_Numerics_Shims/_Numerics_Shims.c b/Sources/_NumericsShims/_NumericsShims.c similarity index 96% rename from Sources/_Numerics_Shims/_Numerics_Shims.c rename to Sources/_NumericsShims/_NumericsShims.c index ae2fa3d7..8ac212f3 100644 --- a/Sources/_Numerics_Shims/_Numerics_Shims.c +++ b/Sources/_NumericsShims/_NumericsShims.c @@ -16,4 +16,4 @@ // If any shims are added that are not pure header inlines, whatever runtime // support they require can be added to this file. -#include "_Numerics_Shims.h" +#include "_NumericsShims.h" diff --git a/Sources/_Numerics_Shims/include/_Numerics_Shims.h b/Sources/_NumericsShims/include/_NumericsShims.h similarity index 100% rename from Sources/_Numerics_Shims/include/_Numerics_Shims.h rename to Sources/_NumericsShims/include/_NumericsShims.h diff --git a/Tests/ComplexTests/ArithmeticBenchmarkTests.swift b/Tests/ComplexTests/ArithmeticBenchmarkTests.swift index 0300fac1..6b2d94d2 100644 --- a/Tests/ComplexTests/ArithmeticBenchmarkTests.swift +++ b/Tests/ComplexTests/ArithmeticBenchmarkTests.swift @@ -10,10 +10,10 @@ //===----------------------------------------------------------------------===// import XCTest -import Numerics_Complex +import ComplexModule // For CComplex and shims -import _Numerics_Shims +import _NumericsShims extension Complex where RealType == Double { @_transparent diff --git a/Tests/ComplexTests/ArithmeticTests.swift b/Tests/ComplexTests/ArithmeticTests.swift index f33b5d5b..ba88d94c 100644 --- a/Tests/ComplexTests/ArithmeticTests.swift +++ b/Tests/ComplexTests/ArithmeticTests.swift @@ -10,8 +10,8 @@ //===----------------------------------------------------------------------===// import XCTest -import Numerics_Complex -import Numerics_Real +import ComplexModule +import RealModule // TODO: improve this to be a general-purpose complex comparison with tolerance func relativeError(_ a: Complex, _ b: Complex) -> T { diff --git a/Tests/ComplexTests/PropertyTests.swift b/Tests/ComplexTests/PropertyTests.swift index 27f70d9e..ca371484 100644 --- a/Tests/ComplexTests/PropertyTests.swift +++ b/Tests/ComplexTests/PropertyTests.swift @@ -10,8 +10,8 @@ //===----------------------------------------------------------------------===// import XCTest -import Numerics_Complex -import Numerics_Real +import ComplexModule +import RealModule final class PropertyTests: XCTestCase { diff --git a/Tests/RealTests/IntegerExponentTests.swift b/Tests/RealTests/IntegerExponentTests.swift index b643c413..0d8997b2 100644 --- a/Tests/RealTests/IntegerExponentTests.swift +++ b/Tests/RealTests/IntegerExponentTests.swift @@ -10,7 +10,7 @@ //===----------------------------------------------------------------------===// import XCTest -import Numerics_Real +import RealModule internal extension Real where Self: BinaryFloatingPoint { static func testIntegerExponentCommon() { diff --git a/Tests/RealTests/RealTestSupport.swift b/Tests/RealTests/RealTestSupport.swift index c699678e..8296c430 100644 --- a/Tests/RealTests/RealTestSupport.swift +++ b/Tests/RealTests/RealTestSupport.swift @@ -10,7 +10,7 @@ //===----------------------------------------------------------------------===// import XCTest -import Numerics_Real +import RealModule #if (arch(i386) || arch(x86_64)) && !os(Windows) && !os(Android) typealias TestLiteralType = Float80 diff --git a/Tests/RealTests/RealTests.swift b/Tests/RealTests/RealTests.swift index 09441525..60afb5d8 100644 --- a/Tests/RealTests/RealTests.swift +++ b/Tests/RealTests/RealTests.swift @@ -10,7 +10,7 @@ //===----------------------------------------------------------------------===// import XCTest -import Numerics_Real +import RealModule internal extension ElementaryFunctions where Self: BinaryFloatingPoint { static func elementaryFunctionChecks() { From a7c141e8183eb9349a0b7f13619773a610357fdf Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Thu, 20 Feb 2020 12:37:07 -0500 Subject: [PATCH 04/10] Update README.md --- README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 58c7aa84..0ec8468d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ These modules fall broadly into two categories: There is some overlap between these two categories, and API that begins in the first category may migrate to the second as it matures and new uses are discovered. -Swift Numerics modules are fine-grained; if you need support for Complex numbers, you can import the ComplexModule module without pulling in everything else in the library as well: +Swift Numerics modules are fine-grained; if you need support for Complex numbers, you can import ComplexModule[1](#footnote1) without pulling in everything else in the library as well: ```swift import ComplexModule @@ -60,3 +60,23 @@ Questions about how to use Swift Numerics modules, or issues that are not clearl 3. [Arbitrary-Precision Integers](https://github.com/apple/swift-numerics/issues/5) 4. [Shaped Arrays](https://github.com/apple/swift-numerics/issues/6) 5. [Decimal Floating-point](https://github.com/apple/swift-numerics/issues/7) + +## Notes +1 Swift is unable to use the fully-qualified name for types when a type and module have the same name. +This would prevent users of Swift Numerics who don't need generic types from doing things like: +```swift +import Complex +// I know I only ever want Complex, so I shouldn't need the generic parameter. +typealias Complex = Complex.Complex // doesn't work, because name lookup fails. +```swift +For this reason, modules that would have this ambiguity are suffixed with `Module` within Swift Numerics: +``` +import ComplexModule +// I know I only ever want Complex, so I shouldn't need the generic parameter. +typealias Complex = ComplexModule.Complex +// But I can still refer to the generic type by qualifying the name if I need it occasionally: +let a = ComplexModule.Complex +``` +The `Real` module does not contain a `Real` type, but does contain a `Real` protocol, and users may want to define their own `Real` type (and possibly re-export the `Real` module), so the suffix is also applied there. + New modules have to evaluate this decision carefully, but can err on the side of adding the suffix. + It's expected that most users will simply `import Numerics`, so this isn't an issue for them. From 6951647e4caaad1a71263ff29c2b407f32fc858e Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Thu, 20 Feb 2020 12:37:33 -0500 Subject: [PATCH 05/10] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0ec8468d..751c5cf9 100644 --- a/README.md +++ b/README.md @@ -68,9 +68,9 @@ This would prevent users of Swift Numerics who don't need generic types from doi import Complex // I know I only ever want Complex, so I shouldn't need the generic parameter. typealias Complex = Complex.Complex // doesn't work, because name lookup fails. -```swift -For this reason, modules that would have this ambiguity are suffixed with `Module` within Swift Numerics: ``` +For this reason, modules that would have this ambiguity are suffixed with `Module` within Swift Numerics: +```swift import ComplexModule // I know I only ever want Complex, so I shouldn't need the generic parameter. typealias Complex = ComplexModule.Complex From ba4469d3fd61194cd66bb49d5f8565bf6bda6fe1 Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Thu, 20 Feb 2020 12:39:36 -0500 Subject: [PATCH 06/10] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 751c5cf9..62c2c05e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ These modules fall broadly into two categories: There is some overlap between these two categories, and API that begins in the first category may migrate to the second as it matures and new uses are discovered. -Swift Numerics modules are fine-grained; if you need support for Complex numbers, you can import ComplexModule[1](#footnote1) without pulling in everything else in the library as well: +Swift Numerics modules are fine-grained; if you need support for Complex numbers, you can import ComplexModule[1](#foot1) without pulling in everything else in the library as well: ```swift import ComplexModule @@ -62,7 +62,7 @@ Questions about how to use Swift Numerics modules, or issues that are not clearl 5. [Decimal Floating-point](https://github.com/apple/swift-numerics/issues/7) ## Notes -1 Swift is unable to use the fully-qualified name for types when a type and module have the same name. +[1](#back1) Swift is unable to use the fully-qualified name for types when a type and module have the same name. This would prevent users of Swift Numerics who don't need generic types from doing things like: ```swift import Complex From be3d09ab26f1aedc00edd4edb832a368669301ea Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Fri, 21 Feb 2020 09:00:42 -0500 Subject: [PATCH 07/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 62c2c05e..1f166c06 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Questions about how to use Swift Numerics modules, or issues that are not clearl 5. [Decimal Floating-point](https://github.com/apple/swift-numerics/issues/7) ## Notes -[1](#back1) Swift is unable to use the fully-qualified name for types when a type and module have the same name. +[1](#back1) Swift is currently unable to use the fully-qualified name for types when a type and module have the same name (discussion here: https://forums.swift.org/t/pitch-fully-qualified-name-syntax/28482). This would prevent users of Swift Numerics who don't need generic types from doing things like: ```swift import Complex From 0fa2cd458e29dd70512c4ce404560bd5225e3e2d Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Fri, 21 Feb 2020 09:02:06 -0500 Subject: [PATCH 08/10] Update README.md --- Sources/RealModule/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/RealModule/README.md b/Sources/RealModule/README.md index a4752edf..8744de6f 100644 --- a/Sources/RealModule/README.md +++ b/Sources/RealModule/README.md @@ -1,8 +1,8 @@ -# Real +# Real Module [SE-0246] proposed an API for "basic math functions" that would make operations like sine and logarithm available in generic contexts. It was accepted, but because of limitations in the compiler, the API could not be added to the standard library in a source-stable manner. -The `Real` module provides that API as a separate module so that you can use it right away to get access to the improved API for these operations in your projects. +`RealModule` provides that API as a separate module so that you can use it right away to get access to the improved API for these operations in your projects. ## Protocols and Methods @@ -34,7 +34,7 @@ The primary use of this protocol is for writing code that is generic over real a ## Using Real -First, either import `Real` directly or import the `Numerics` umbrella module. +First, either import `RealModule` directly or import the `Numerics` umbrella module. Suppose we were experimenting with some basic machine learning, and needed a generic [sigmoid function][Sigmoid] activation function: From 9dba38cc1ab3104f0d111cf4c54fb9f7dce3a4f1 Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Fri, 21 Feb 2020 09:03:28 -0500 Subject: [PATCH 09/10] Update README.md --- Sources/ComplexModule/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ComplexModule/README.md b/Sources/ComplexModule/README.md index c4cd31cb..a8b33700 100644 --- a/Sources/ComplexModule/README.md +++ b/Sources/ComplexModule/README.md @@ -10,7 +10,7 @@ This module provides approximate feature parity and memory layout compatibility The usual arithmetic operators are provided for Complex numbers, as well as conversion to and from polar coordinates and many useful properties, plus conformances to the obvious usual protocols: `Equatable`, `Hashable`, `Codable` (if the underlying `RealType` is), and `AlgebraicField` (hence also `AdditiveArithmetic` and `SignedNumeric`). ### Dependencies: -- The `RealModule` module. +- `RealModule`. ## Design notes From 014ce562a48bdeb6f5dcfb63dd9257b4815d4f84 Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Fri, 21 Feb 2020 09:04:17 -0500 Subject: [PATCH 10/10] Update README.md --- Sources/RealModule/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/RealModule/README.md b/Sources/RealModule/README.md index 8744de6f..a77d6fec 100644 --- a/Sources/RealModule/README.md +++ b/Sources/RealModule/README.md @@ -69,7 +69,7 @@ When new basic floating-point types are added to Swift, like `Float16` or `Float Not having this protocol is a significant missing feature for numerical computing in Swift, and I'm really looking forward to seeing what people do with it. ### Dependencies: -- The C standard math library (`libm`) via the `NumericShims` target. +- The C standard math library (`libm`) via the `_NumericsShims` target. [ErrorFunction]: https://en.wikipedia.org/wiki/Error_function [GammaFunction]: https://en.wikipedia.org/wiki/Gamma_function