-
Notifications
You must be signed in to change notification settings - Fork 479
Closed
Description
Hi Matt,
I'd like to contribute a series of improvements to Surge.
Surge is already pretty nice for implementing performant number crunching and machine learning algorithms, but I find myself writing my own Vector<Scalar>
types and adding extensions for common Matrix<Scalar>
operations over and over again (especially the scalar variants), so I figured I might as well upstream them:
- Upgrade to recommended project settings. (https://github.com/mattt/Surge/pull/109)
- Add overload of
XCTAssertEqual(_:_:accuracy:)
for collections ofFloatingPoint
. (https://github.com/mattt/Surge/pull/104) - Add basic suite of unit tests for arithmetic functions. (https://github.com/mattt/Surge/pull/105)
- Add basic suite of unit tests for matrix arithmetic functions. (https://github.com/mattt/Surge/pull/108)
- Add missing named function equivalents of
.
-operators (e.g.addInPlace(_:_:)
for.+=(_:_:)
), transforming operators into strictly forwarding calls of explicitly named equivalents. (https://github.com/mattt/Surge/pull/107) - Add Matrix initializers for common diagonal/eye/identity patterns. (https://github.com/mattt/Surge/pull/111)
- Optimize scalar-variants of arithmetic functions (e.g.
func mul(x: [Float], y: Float)
, etc.) where applicable. - Add missing scalar-variants of matrix functions (e.g.
func mul(x: Matrix<Float>, y: Float)
, etc.). (https://github.com/mattt/Surge/pull/110) - Add
Vector<Scalar>
type and unit tests for performant, yet expressive vector arithmetic. (https://github.com/mattt/Surge/pull/110) - Add matrix-vector multiplication and other arithmetic functions (using
Matrix<Scalar>
&Vector<Scalar>
). (https://github.com/mattt/Surge/pull/110)
Why Vector<Scalar>
if we already have [Scalar]
?
Simply using [Float]
requires one to use .+
& Co, due to otherwise colliding with array concatenation, etc. Having an explicit Vector<Scalar>
type also allows for better auto-completion by keeping all the non-vector-space-related Array
/Collection
gunk out of it. Or and it also doesn't spill every operator/function into the global namespace of Collection
.
Metadata
Metadata
Assignees
Labels
No labels