All Projects → apple → Swift Numerics

apple / Swift Numerics

Licence: apache-2.0
Numerical APIs for Swift

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Swift Numerics

bcmath-extended
Extends php BCMath lib for missing functions like floor, ceil, round, abs, min, max, rand for big numbers. Also wraps existing BCMath functions.
Stars: ✭ 59 (-94.39%)
Mutual labels:  math, complex-numbers
Algebra
means completeness and balancing, from the Arabic word الجبر
Stars: ✭ 92 (-91.25%)
Mutual labels:  math, complex-numbers
Swift Complex
Complex numbers in Swift
Stars: ✭ 66 (-93.73%)
Mutual labels:  math, complex-numbers
Calc
C-style arbitrary precision calculator
Stars: ✭ 127 (-87.93%)
Mutual labels:  math, complex-numbers
mathcore
Advanced .NET math library (.NET Standard).
Stars: ✭ 24 (-97.72%)
Mutual labels:  math, complex-numbers
Mathjs
An extensive math library for JavaScript and Node.js
Stars: ✭ 11,861 (+1027.47%)
Mutual labels:  math, complex-numbers
Numphp
Mathematical PHP library for scientific computing
Stars: ✭ 120 (-88.59%)
Mutual labels:  math, complex-numbers
java.math.expression.parser
java math expression parser is faster than JEP
Stars: ✭ 25 (-97.62%)
Mutual labels:  math, complex-numbers
Grassmann.jl
⟨Leibniz-Grassmann-Clifford⟩ differential geometric algebra / multivector simplicial complex
Stars: ✭ 289 (-72.53%)
Mutual labels:  math, complex-numbers
Dominhhai.github.io
My Blog
Stars: ✭ 8 (-99.24%)
Mutual labels:  math
Sharpmath
A small .NET math library.
Stars: ✭ 36 (-96.58%)
Mutual labels:  math
Hx Mathparser
Evaluates math expressions. Written in Haxe.
Stars: ✭ 7 (-99.33%)
Mutual labels:  math
Bacomathiques
Bacomathiques est un petit site web qui contient tout ce dont vous avez besoin pour réviser vos maths en toute tranquillité de la Première à la Terminale ! Que vous cherchiez à passer votre BAC ou que vous souhaitiez simplement réviser votre cours : tout est possible et tout est gratuit.
Stars: ✭ 12 (-98.86%)
Mutual labels:  math
Blog
About math, programming and procedural generation
Stars: ✭ 37 (-96.48%)
Mutual labels:  math
Percent
📈 Percent control done right
Stars: ✭ 7 (-99.33%)
Mutual labels:  math
Jglm
Java OpenGL Mathematics Library
Stars: ✭ 44 (-95.82%)
Mutual labels:  math
Ionengine
3D graphics engine designed for rapid prototyping and extensibility
Stars: ✭ 25 (-97.62%)
Mutual labels:  math
Pas Coogeo
Pas-CooGeo is coordinate geometry library for Pascal.
Stars: ✭ 25 (-97.62%)
Mutual labels:  math
Phobos
The standard library of the D programming language
Stars: ✭ 1,038 (-1.33%)
Mutual labels:  math
Prosemirror Math
Schema and plugins for "first-class" math support in ProseMirror!
Stars: ✭ 43 (-95.91%)
Mutual labels:  math

Swift Numerics

Introduction

Swift Numerics provides a set of modules that support numerical computing in Swift. These modules fall broadly into two categories:

  • API that is too specialized to go into the standard library, but which is sufficiently general to be centralized in a single common package.
  • API that is under active development toward possible future inclusion in the standard library.

There is some overlap between these two categories, and an API that begins in the first category may migrate into the second as it matures and new uses are discovered.

Swift Numerics modules are fine-grained. For example, if you need support for Complex numbers, you can import ComplexModule¹ as a standalone module:

import ComplexModule

let z = Complex<Double>.i

There is also a top-level Numerics module that re-exports the complete public interface of Swift Numerics:

import Numerics

// The entire Swift Numerics API is now available

Swift Numerics modules have minimal dependencies on other projects.

The current modules assume only the availability of the Swift and C standard libraries and the runtime support provided by compiler-rt.

Future expansion may assume the availability of other standard interfaces, such as BLAS (Basic Linear Algebra Subprograms) and LAPACK (Linear Algebra Package), but modules with more specialized dependencies (or dependencies that are not available on all platforms supported by Swift) belong in a separate package.

Because we intend to make it possible to adopt Swift Numerics modules in the standard library at some future point, Swift Numerics uses the same license and contribution guidelines as the Swift project.

Using Swift Numerics in your project

To use Swift Numerics in a SwiftPM project:

  1. Add the following line to the dependencies in your Package.swift file:
.package(url: "https://github.com/apple/swift-numerics", from: "0.1.0"),
  1. Add Numerics as a dependency for your target:
.target(name: "MyTarget", dependencies: [
  .product(name: "Numerics", package: "swift-numerics"),
  "AnotherModule"
]),
  1. Add import Numerics in your source code.

Contributing to Swift Numerics

Swift Numerics is a standalone library that is separate from the core Swift project, but it will sometimes act as a staging ground for APIs that will later be incorporated into the Swift Standard Library. When that happens, such changes will be proposed to the Swift Standard Library using the established evolution process of the Swift project.

Swift Numerics uses GitHub issues to track bugs and features. We use pull requests for development.

How to propose a new module

  1. Raise an issue with the [new module] tag.
  2. Raise a PR with an implementation sketch.
  3. Once you have some consensus, ask an admin to create a feature branch against which PRs can be raised.
  4. When the design has stabilized and is functional enough to be useful, raise a PR to merge the new module to master.

How to propose a new feature for an existing module

  1. Raise an issue with the [enhancement] tag.
  2. Raise a PR with your implementation, and discuss the implementation there.
  3. Once there is a consensus that the new feature is desirable and the design is suitable, it can be merged.

How to fix a bug, or make smaller improvements

  1. Raise a PR with your change.
  2. Make sure to add test coverage for whatever changes you are making.

Forums

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.

Modules

  1. RealModule
  2. ComplexModule

Future expansion

  1. Large Fixed-Width Integers
  2. Arbitrary-Precision Integers
  3. Shaped Arrays
  4. Decimal Floating-point

Notes

¹ 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 such as:

import Complex
// I know I only ever want Complex<Double>, so I shouldn't need the generic parameter.
typealias Complex = Complex.Complex<Double> // This doesn't work, because name lookup fails.

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<Double>, so I shouldn't need the generic parameter.
typealias Complex = ComplexModule.Complex<Double>
// But I can still refer to the generic type by qualifying the name if I need it occasionally:
let a = ComplexModule.Complex<Float>

The Real module does not contain a Real type, but does contain a Real protocol. Users may want to define their own Real type (and possibly re-export the Real module)--that is why 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].