// // FFTShift.swift // Plinth // // Created by Daniel Clelland on 9/05/22. // import Foundation extension Matrix where Scalar == Float { public func fftShifted() -> Matrix { return shifted(rows: shape.rows / 2, columns: shape.columns / 2) } } extension ComplexMatrix where Scalar == Float { public func fftShifted() -> ComplexMatrix { return ComplexMatrix(real: real.fftShifted(), imaginary: imaginary.fftShifted()) } } extension Matrix where Scalar == Double { public func fftShifted() -> Matrix { return shifted(rows: shape.rows / 2, columns: shape.columns / 2) } } extension ComplexMatrix where Scalar == Double { public func fftShifted() -> ComplexMatrix { return ComplexMatrix(real: real.fftShifted(), imaginary: imaginary.fftShifted()) } }