diff --git a/.travis.yml b/.travis.yml index f53c3402..01ce38ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: objective-c xcode_workspace: Upsurge.xcworkspace xcode_scheme: Upsurge OSX -osx_image: xcode7 +osx_image: xcode7.3 diff --git a/Source/1D/LinearOperators.swift b/Source/1D/LinearOperators.swift index 72f10ae5..bf01fd3a 100644 --- a/Source/1D/LinearOperators.swift +++ b/Source/1D/LinearOperators.swift @@ -46,7 +46,8 @@ public func +=(inout lhs: ML, } } -public func +(lhs: ML, var rhs: Double) -> ValueArray { +public func +(lhs: ML, rhs: Double) -> ValueArray { + var rhs = rhs let results = ValueArray(count: lhs.count) withPointer(lhs) { lhsp in vDSP_vsaddD(lhsp + lhs.startIndex, lhs.step, &rhs, results.mutablePointer + results.startIndex, results.step, vDSP_Length(lhs.count)) @@ -132,7 +133,8 @@ public func /(lhs: ML, rhs: Double) - return results } -public func /(var lhs: Double, rhs: ML) -> ValueArray { +public func /(lhs: Double, rhs: ML) -> ValueArray { + var lhs = lhs let results = ValueArray(count: rhs.count) withPointer(rhs) { rhsp in vDSP_svdivD(&lhs, rhsp + rhs.startIndex, rhs.step, results.mutablePointer + results.startIndex, results.step, vDSP_Length(rhs.count)) @@ -154,13 +156,15 @@ public func *(inout lhs: ML, var rhs: Double) { +public func *=(inout lhs: ML, rhs: Double) { + var rhs = rhs withPointer(&lhs) { lhsp in vDSP_vsmulD(lhsp + lhs.startIndex, lhs.step, &rhs, lhsp + lhs.startIndex, lhs.step, vDSP_Length(lhs.count)) } } -public func *(lhs: ML, var rhs: Double) -> ValueArray { +public func *(lhs: ML, rhs: Double) -> ValueArray { + var rhs = rhs let results = ValueArray(count: lhs.count) withPointer(lhs) { lhsp in vDSP_vsmulD(lhsp + lhs.startIndex, lhs.step, &rhs, results.mutablePointer + results.startIndex, results.step, vDSP_Length(lhs.count)) diff --git a/Source/1D/LinearType.swift b/Source/1D/LinearType.swift index f653fe02..f6afd49b 100644 --- a/Source/1D/LinearType.swift +++ b/Source/1D/LinearType.swift @@ -20,7 +20,7 @@ /// The `LinearType` protocol should be implemented by any collection that stores its values in a contiguous memory block. This is the building block for one-dimensional operations that are single-instruction, multiple-data (SIMD). public protocol LinearType: CollectionType, TensorType { - typealias Element + associatedtype Element /// The index of the first valid element var startIndex: Int { get } diff --git a/Source/2D/QuadraticType.swift b/Source/2D/QuadraticType.swift index 405a1439..88629624 100644 --- a/Source/2D/QuadraticType.swift +++ b/Source/2D/QuadraticType.swift @@ -27,7 +27,7 @@ public enum QuadraticArrangement { } public protocol QuadraticType: TensorType { - typealias Element + associatedtype Element /// The arrangement of rows and columns var arrangement: QuadraticArrangement { get } diff --git a/Source/ND/TensorType.swift b/Source/ND/TensorType.swift index 09536fb5..b9e9f04f 100644 --- a/Source/ND/TensorType.swift +++ b/Source/ND/TensorType.swift @@ -19,8 +19,8 @@ // THE SOFTWARE. public protocol TensorType { - typealias Element - typealias Slice + associatedtype Element + associatedtype Slice /// A description of the dimensions over which the TensorType spans var span: Span { get }