v0.3.0-dev-9 #324
@ -0,0 +1,47 @@
|
|||||||
|
package space.kscience.kmath.tensors
|
||||||
|
|
||||||
|
public interface ComplexTensorAlgebra<T,
|
||||||
|
RealTensorType : TensorStructure<T>,
|
||||||
|
ComplexTensorType : ComplexTensorStructure<T, RealTensorType>>
|
||||||
|
: TensorPartialDivisionAlgebra<T, ComplexTensorType>{
|
||||||
|
|
||||||
|
//https://pytorch.org/docs/stable/generated/torch.view_as_complex.html
|
||||||
|
public fun RealTensorType.viewAsComplex(): ComplexTensorType
|
||||||
|
|
||||||
|
//https://pytorch.org/docs/stable/generated/torch.angle.html
|
||||||
|
public fun ComplexTensorType.angle(): RealTensorType
|
||||||
|
|
||||||
|
//https://pytorch.org/docs/stable/generated/torch.stft.html#torch.stft
|
||||||
|
public fun ComplexTensorType.stft(
|
||||||
|
nFFT: Int,
|
||||||
|
hopLength: Int,
|
||||||
|
winLength: Int,
|
||||||
|
window: RealTensorType,
|
||||||
|
normalised: Boolean,
|
||||||
|
oneSided: Boolean
|
||||||
|
)
|
||||||
|
|
||||||
|
//https://pytorch.org/docs/stable/generated/torch.istft.html#torch.istft
|
||||||
|
public fun ComplexTensorType.istft(
|
||||||
|
nFFT: Int,
|
||||||
|
hopLength: Int,
|
||||||
|
winLength: Int,
|
||||||
|
window: RealTensorType,
|
||||||
|
center: Boolean,
|
||||||
|
normalised: Boolean,
|
||||||
|
oneSided: Boolean,
|
||||||
|
length: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
//https://pytorch.org/docs/stable/generated/torch.bartlett_window.html#torch.bartlett_window
|
||||||
|
public fun bartlettWindow(windowLength: Int, periodic: Boolean): RealTensorType
|
||||||
|
|
||||||
|
//https://pytorch.org/docs/stable/generated/torch.blackman_window.html#torch.blackman_window
|
||||||
|
public fun blackmanWindow(windowLength: Int, periodic: Boolean): RealTensorType
|
||||||
|
|
||||||
|
//https://pytorch.org/docs/stable/generated/torch.hamming_window.html#torch.hamming_window
|
||||||
|
public fun hammingWindow(windowLength: Int, periodic: Boolean, alpha: T, beta: T): RealTensorType
|
||||||
|
|
||||||
|
//https://pytorch.org/docs/stable/generated/torch.kaiser_window.html#torch.kaiser_window
|
||||||
|
public fun kaiserWindow(windowLength: Int, periodic: Boolean, beta: T): RealTensorType
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package space.kscience.kmath.tensors
|
||||||
|
|
||||||
|
public interface ComplexTensorStructure<T, RealTensorType: TensorStructure<T>> : TensorStructure<T> {
|
||||||
|
|
||||||
|
//https://pytorch.org/docs/master/generated/torch.view_as_real.html
|
||||||
|
public fun viewAsReal(): RealTensorType
|
||||||
|
|
||||||
|
//https://pytorch.org/docs/stable/generated/torch.real.html
|
||||||
|
public fun realPart(): RealTensorType
|
||||||
|
|
||||||
|
//https://pytorch.org/docs/stable/generated/torch.imag.html
|
||||||
|
public fun imaginaryPart(): RealTensorType
|
||||||
|
|
||||||
|
}
|
@ -146,5 +146,5 @@ public class RealAnalyticTensorAlgebra:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun <R> RealAnalyticTensorAlgebra(block: RealTensorAlgebra.() -> R): R =
|
public inline fun <R> RealAnalyticTensorAlgebra(block: RealAnalyticTensorAlgebra.() -> R): R =
|
||||||
RealAnalyticTensorAlgebra().block()
|
RealAnalyticTensorAlgebra().block()
|
@ -127,5 +127,5 @@ public class RealLinearOpsTensorAlgebra :
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public inline fun <R> RealLinearOpsTensorAlgebra(block: RealTensorAlgebra.() -> R): R =
|
public inline fun <R> RealLinearOpsTensorAlgebra(block: RealLinearOpsTensorAlgebra.() -> R): R =
|
||||||
RealLinearOpsTensorAlgebra().block()
|
RealLinearOpsTensorAlgebra().block()
|
Loading…
Reference in New Issue
Block a user