Apple released Swift math project: Swift Numerics

Swift standard library team members Steve Canon  announced  Swift Adds an open source ecosystem -  Swift Numerics . This is the Numerical API for Swift, the source code is hosted on GitHub, designed to quickly fill some important gaps existing in the API standard library, and open up new areas for the Swift program.

According to reports, Swift Swift Numerics developers can provide basis for building numerical operations, correlation value calculation block are bundled together, and are published in Swift separate components.

Steve Canon has built two high voice module in mathematical calculations Swift Numerics's GitHub repository, are real module (Real Number) and complex (Complex Number) providing a plurality of computing modules. SE-0246 proposal was added to the base in a mathematical function API Swift, there is provided a trigonometric function such as a general-purpose computing logarithm. The proposal has been accepted, but due to the compiler, the API can not yet be added to the standard library, so the real number of modules will separate module provides API, developers can now use these features in your project.

Real protocol defines three modules. The most common is that ElementaryFunctionsit provides the following functions:

  • Exponential expfunction: ,expMinusOne
  • Logarithmic logfunction: ,log(onePlus:)
  • Trigonometric cosfunctions: sin, ,tan
  • Inverse trigonometric acosfunctions: asin, ,atan
  • Hyperbolic coshfunctions: sinh, ,tanh
  • Inverse hyperbolic acoshfunctions: asinh, ,atanh
  • Power function and root powfunction: sqrt, ,root

Plural module is founded on the basis of type real (official statement is complex modules are built based on real module). We all know that the plural is often used in mathematical calculations, especially when performing a Fourier transformation, or audio processing circuit simulation will be used in the plural. Steve Canon mentioned that when developers use every day, the library is usually automatically hide these complex messages, but when related to the development of the library, the complex module will be very important tool.

Steve Canon also explains why Swift Numerics provides functionality not in the standard library functions, and to use the component in the form of release. He said this in which there are many reasons, but the main reason is that he believes that not all content should be placed in the standard function library. With the time change, some of the features Swift Numerics might be put into standard function library, but by default, some default modules should be added to every project, they should have its own unique place, and Swift Numerics is this kind of mathematical calculation module collection, just like SwiftNIO component is designed to provide the same network-related functions.

In addition, the benefits of a component package also includes Swift Numerics update Swift will not release a time limit, developers can before entering the stable version, first released a test module for testing.

Steve Canon also mentioned that they will join the next important ShapedArray agreement and the type of support for Swift Numerics, so that developers can easily homogeneous surface data Da Duowei degrees, in addition to also increase support for the Float16.

Reference: https://www.ithome.com.tw/news/134151

Guess you like

Origin www.oschina.net/news/111317/swift-numerics