Cache

Cache caches the calculation results of another Gain.

use autd3::prelude::*; use autd3::gain::Cache; fn main() { let _ = Cache::new(Null::new()); }
#include<autd3.hpp> #include <autd3/gain/cache.hpp> int main() { using namespace autd3; gain::Cache(Null{}); return 0; }
using AUTD3Sharp.Gain; new Cache(new Null());
from pyautd3 import Null from pyautd3.gain import Cache Cache(Null())

NOTE: Cache is only effective for Gains with heavy computation, so there is no point in caching Null. Be sure to benchmark when using Cache.