pub fn det_frule<T, C>(
ctx: &mut C,
tensor: &Tensor<T>,
tangent: &Tensor<T>,
) -> AdResult<(Tensor<T>, Tensor<T>)>where
T: KernelLinalgScalar + ScaleTensorByRealSameShape<C>,
C: TensorLinalgContextFor<T> + TensorScalarContextFor<Standard<T>> + TensorScalarContextFor<Standard<T::Real>> + TensorMetadataContextFor,
C::Backend: 'static,
C::MetadataBackend: TensorMetadataPrims<Context = C>,
<C as TensorScalarContextFor<Standard<T>>>::ScalarBackend: TensorMetadataCastPrims<T, Context = C>,
<C as TensorScalarContextFor<Standard<T::Real>>>::ScalarBackend: TensorMetadataCastPrims<T::Real, Context = C>,Expand description
Forward-mode AD rule for determinant (JVP / pushforward).
ยงExamples
use tenferro_linalg::det_frule;
use tenferro_prims::CpuContext;
use tenferro_tensor::{Tensor, MemoryOrder};
use tenferro_device::LogicalMemorySpace;
let col = MemoryOrder::ColumnMajor;
let mem = LogicalMemorySpace::MainMemory;
let mut ctx = CpuContext::new(1);
let a = Tensor::<f64>::eye(3, mem, col).unwrap();
let da = Tensor::<f64>::ones(&[3, 3], mem, col).unwrap();
let (d, dd) = det_frule(&mut ctx, &a, &da).unwrap();