Public
Edited
Sep 26, 2021
Fork of Simple D3
2 forks
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// 4 1/4-turn rotations should mean x==res4
// each entry is an immutable 2d

// Something somewhere needs to be mutable

mutable mathlog = {
const x1 = A.dot(x0);
const x2 = A.dot(x1);
const x3 = A.dot(x2);
const x4 = A.dot(x3);
return [
await x0.data(),
await x1.data(),
await x2.data(),
await x3.data(),
await x4.data()
];
}
Insert cell
Insert cell
Calculate step
Insert cell
engine = {
/* If we need more results after the 1st 4, go get them... */
n; // run when manually stepped
tick; // we will run every tick
if (n > 4) {
// mon.log("tock: ", await tick);
var tf_new_vector = A.dot(mathlog[mathlog.length - 1]);
var new_vector = await tf_new_vector.data();
if (waste_disposal) {
tf_new_vector.dispose();
}
mathlog.push(new_vector);
yield new_vector;
} else {
yield "cached";
}
}
Insert cell
waste_disposal = false
Insert cell
viewof delay = Inputs.range([0, 1000], { value: 5, step: 1, label: "Delay" })
Insert cell
Insert cell
mathlog[0]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
tf = require("@tensorflow/tfjs")
Insert cell
import { show } from "@zaidalyafeai/show-tensor"
Insert cell
setup = {
// tf.setBackend("cpu");
yield tf.getBackend();
tf.enableDebugMode();
}
Insert cell
md`# Graphics test - ignore for now`
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more