From 1268b9d920a9fe1c6b7062108eae45b93466735a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jinguo=20Liu=20=28=E5=88=98=E9=87=91=E5=9B=BD=29?= Date: Wed, 31 Jan 2024 23:53:03 +0800 Subject: [PATCH] Import YaoAPI interfaces: apply_mat! and mat_back! (#492) implement YaoAPI interfaces: apply_mat! and mat_back! --- lib/YaoBlocks/src/YaoBlocks.jl | 4 +++- lib/YaoBlocks/src/autodiff/autodiff.jl | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/YaoBlocks/src/YaoBlocks.jl b/lib/YaoBlocks/src/YaoBlocks.jl index 2be4c067..28149d8b 100644 --- a/lib/YaoBlocks/src/YaoBlocks.jl +++ b/lib/YaoBlocks/src/YaoBlocks.jl @@ -51,7 +51,9 @@ import YaoAPI: subblocks, nparameters, measure!, - measure + measure, + apply_back!, + mat_back! export AbstractBlock, AbstractContainer, diff --git a/lib/YaoBlocks/src/autodiff/autodiff.jl b/lib/YaoBlocks/src/autodiff/autodiff.jl index 7cbf3b93..a77e0302 100644 --- a/lib/YaoBlocks/src/autodiff/autodiff.jl +++ b/lib/YaoBlocks/src/autodiff/autodiff.jl @@ -15,6 +15,7 @@ using BitBasis, YaoArrayRegister, YaoAPI using ..YaoBlocks import ChainRulesCore: rrule, @non_differentiable, NoTangent, Tangent, backing, AbstractTangent, ZeroTangent +import YaoAPI: mat_back!, apply_back! using SparseArrays, LuxurySparse, LinearAlgebra include("NoParams.jl")