Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"cfavml",
"cfavml-gemm",
"cfavml-utils",
"cfavml-complex",
# Testing and profiling
"cfavml/asm-view"
"cfavml/asm-view",
]
43 changes: 43 additions & 0 deletions cfavml-complex/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[package]
name = "cfavml-complex"
version = "0.3.0"
edition = "2021"
rust-version = "1.75"
authors = ["Harrison Burt <[email protected]>"]
description = "CF's Accelerated Vector Math Library providing SIMD optimzied routines for vector operations"
keywords = ["linear-algebra", "vector", "simd", "complex"]
categories = ["no-std", "no-std::no-alloc", "concurrency"]
readme = "README.md"
repository = "https://github.com/ChillFish8/cfavml"
license = "MIT OR Apache-2.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
num-complex = "0.4.6"
cfavml = { path = "../cfavml" }
num-traits = "0.2.19"

[dev-dependencies]
rand_chacha = "0.3.1"
rand = "0.8.5"
paste = "1.0.14"

[features]
# Enables nightly only features like fast-math optimizations for fallback routines and AVX512 support.
#
# This feature generally needs to be enabled in order to get the best optimizations.
nightly = []
# Enables std library support
#
# This primarily provides runtime CPU feature selection, if this is not enabled only compile time
# dispatch can be used.
std = []
# The default features enabled.
#
# If you are compiling for no-std you will need to pass default-features = false
default = ["std"]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
3 changes: 3 additions & 0 deletions cfavml-complex/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# cfavml-complex

todo
42 changes: 42 additions & 0 deletions cfavml-complex/src/danger/complex_ops.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
use cfavml::danger::SimdRegister;
use num_complex::Complex;

pub trait ComplexOps<T>
where
Complex<T>: Copy,
{
type Register: Copy;
type HalfRegister: Copy;

/// returns the conjugates of the complex register
unsafe fn conj(value: Self::Register) -> Self::Register;
/// returns the inverse of the complex number, adapted from num_complex finv
unsafe fn inv(value: Self::Register) -> Self::Register;
}

// the ops that only make sense for SIMD registers
pub trait ComplexSimdOps<T>
where
Complex<T>: Copy,
{
type Register: Copy;
/// returns the real components of the complex register duplicated over their imaginary counterparts
unsafe fn dup_real_components(value: Self::Register) -> Self::Register;
/// returns the imaginary component of a complex register duplicated over their real counterparts
unsafe fn dup_imag_components(value: Self::Register) -> Self::Register;
#[inline(always)]
/// Duplicates the real and imaginary components of a the input into separate registers
unsafe fn dup_complex_components(
value: Self::Register,
) -> (Self::Register, Self::Register) {
(
Self::dup_real_components(value),
Self::dup_imag_components(value),
)
}
/// returns the squared_norm of the complex number duplicated into even/odd index pairs
unsafe fn dup_norm(value: Self::Register) -> Self::Register;

/// Swaps the real and imaginary components of a complex register
unsafe fn swap_complex_components(value: Self::Register) -> Self::Register;
}
Loading