From ee14ad272e68d9363202d7f668e0b20302827209 Mon Sep 17 00:00:00 2001 From: hachem Date: Mon, 14 Sep 2026 12:20:52 +0200 Subject: feat: simd + testing + formatting --- include/core/kernel.h | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'include/core/kernel.h') diff --git a/include/core/kernel.h b/include/core/kernel.h index d7976c3..b8b19ea 100644 --- a/include/core/kernel.h +++ b/include/core/kernel.h @@ -16,39 +16,40 @@ enum PsiGateType struct PsiKernel { struct PsiMatrix matrix; - size_t *targets; + size_t* targets; size_t target_count; - char *name; + char* name; enum PsiGateType gate_type; }; -struct PsiKernel psi_new_kernel(const char *name, struct PsiMatrix matrix, const size_t *targets, size_t target_count); +struct PsiKernel psi_new_kernel(const char* name, struct PsiMatrix matrix, const size_t* targets, + size_t target_count); struct PsiKernel psi_clone_kernel(struct PsiKernel kernel); -void psi_free_kernel(struct PsiKernel *kernel); +void psi_free_kernel(struct PsiKernel* kernel); bool psi_kernels_share_qubits(struct PsiKernel a, struct PsiKernel b); bool psi_kernels_commute(struct PsiKernel a, struct PsiKernel b); bool psi_kernels_can_fuse(struct PsiKernel a, struct PsiKernel b); -bool psi_fuse_kernels(struct PsiKernel a, struct PsiKernel b, struct PsiKernel *out); +bool psi_fuse_kernels(struct PsiKernel a, struct PsiKernel b, struct PsiKernel* out); struct PsiKernelBatch { - struct PsiKernel *kernels; + struct PsiKernel* kernels; size_t count; size_t capacity; size_t num_qubits; }; struct PsiKernelBatch psi_new_kernel_batch(size_t num_qubits); -void psi_free_kernel_batch(struct PsiKernelBatch *batch); -void psi_add_kernel(struct PsiKernelBatch *batch, struct PsiKernel kernel); -void psi_optimize_kernel_batch(struct PsiKernelBatch *batch); -void psi_execute_kernel_batch(struct PsiKernelBatch batch, struct PsiVector *state); -void psi_apply_kernel(struct PsiVector *state, struct PsiKernel kernel, size_t num_qubits); +void psi_free_kernel_batch(struct PsiKernelBatch* batch); +void psi_add_kernel(struct PsiKernelBatch* batch, struct PsiKernel kernel); +void psi_optimize_kernel_batch(struct PsiKernelBatch* batch); +void psi_execute_kernel_batch(struct PsiKernelBatch batch, struct PsiVector* state); +void psi_apply_kernel(struct PsiVector* state, struct PsiKernel kernel, size_t num_qubits); struct PsiExecutionLayer { - struct PsiKernel *kernels; + struct PsiKernel* kernels; size_t count; size_t capacity; }; @@ -65,10 +66,10 @@ struct PsiKernelStats struct PsiStructureAwareBatch { - struct PsiKernel *kernels; + struct PsiKernel* kernels; size_t count; size_t capacity; - struct PsiExecutionLayer *layers; + struct PsiExecutionLayer* layers; size_t layer_count; size_t layer_capacity; size_t num_qubits; @@ -76,9 +77,11 @@ struct PsiStructureAwareBatch }; struct PsiStructureAwareBatch psi_new_structure_aware_batch(size_t num_qubits); -void psi_free_structure_aware_batch(struct PsiStructureAwareBatch *batch); -void psi_add_structure_aware_kernel(struct PsiStructureAwareBatch *batch, struct PsiKernel kernel); -void psi_optimize_structure_aware_batch(struct PsiStructureAwareBatch *batch); -void psi_execute_structure_aware_batch(struct PsiStructureAwareBatch batch, struct PsiVector *state); -void psi_execute_structure_aware_batch_layered(struct PsiStructureAwareBatch batch, struct PsiVector *state); +void psi_free_structure_aware_batch(struct PsiStructureAwareBatch* batch); +void psi_add_structure_aware_kernel(struct PsiStructureAwareBatch* batch, struct PsiKernel kernel); +void psi_optimize_structure_aware_batch(struct PsiStructureAwareBatch* batch); +void psi_execute_structure_aware_batch(struct PsiStructureAwareBatch batch, + struct PsiVector* state); +void psi_execute_structure_aware_batch_layered(struct PsiStructureAwareBatch batch, + struct PsiVector* state); struct PsiKernelStats psi_structure_aware_batch_stats(struct PsiStructureAwareBatch batch); -- cgit v1.3