Post

Replies

Boosts

Views

Activity

Reply to Data storage for a Matrix struct when working with Accelerate
I would also like to mention that running the code below gives me almost identical elapsed times for the matrix array and matrix buffer solutions. So, at least for this case, I'm not seeing any performance differences between the two approaches. func runBenchmark1() { print("Benchmark matrix multiplication") for _ in 1...3 { let tic = Date.now let n = 8_000 let a = Matrix<Double>(rows: n, columns: n, fill: 1.5) let b = Matrix<Double>(rows: n, columns: n, fill: 2.8) let c = a * b let toc = tic.timeIntervalSinceNow.magnitude let elapsed = String(format: "%.4f", toc) print("Elapsed time is \(elapsed) sec, first element is \(c[0, 0])") } }
Jun ’24