Added missing `// MARK: - …` to implementation files

This commit is contained in:
Vincent Esche 2019-09-23 14:39:51 +02:00
parent 59a14fdbd2
commit 741fa9a4cf
3 changed files with 7 additions and 1 deletions

View File

@ -588,6 +588,8 @@ public func dist<L: UnsafeMemoryAccessible, R: UnsafeMemoryAccessible>(_ lhs: L,
return sqrt(distSq(lhs, rhs))
}
// MARK: - Distance Squared
public func distSq<L: UnsafeMemoryAccessible, R: UnsafeMemoryAccessible>(_ lhs: L, _ rhs: R) -> Float where L.Element == Float, R.Element == Float {
precondition(lhs.count == rhs.count, "Vectors must have equal count")
let sub = lhs .- rhs

View File

@ -30,6 +30,8 @@ public struct Matrix<Scalar> where Scalar: FloatingPoint, Scalar: ExpressibleByF
public let columns: Int
var grid: [Scalar]
// MARK: - Initialization
public init(rows: Int, columns: Int, repeatedValue: Scalar) {
self.rows = rows
self.columns = columns
@ -90,6 +92,8 @@ public struct Matrix<Scalar> where Scalar: FloatingPoint, Scalar: ExpressibleByF
return matrix
}
// MARK: - Subscript
public subscript(row: Int, column: Int) -> Scalar {
get {
assert(indexIsValidForRow(row, column: column))

View File

@ -29,7 +29,7 @@ public struct Vector<Scalar> where Scalar: FloatingPoint, Scalar: ExpressibleByF
}
}
// MARK: - Initialize
// MARK: - Initialization
public init(dimensions: Int, repeatedValue: Scalar) {
let scalars = Array(repeating: repeatedValue, count: dimensions)