Example #1
0
 new WglConfiguredShader(destinationTexture => {
     Util.need(operation.width() === 2 && operation.height() === 2);
     let [ar, ai, br, bi, cr, ci, dr, di] = operation.rawBuffer();
     CUSTOM_SINGLE_QUBIT_OPERATION_SHADER.withArgs(
         WglArg.vec2("inputSize", destinationTexture.width, destinationTexture.height),
         WglArg.texture("inputTexture", inputTexture, 0),
         WglArg.float("qubitIndexMask", 1 << qubitIndex),
         WglArg.texture("controlTexture", controlTexture, 1),
         WglArg.vec2("matrix_a", ar, ai),
         WglArg.vec2("matrix_b", br, bi),
         WglArg.vec2("matrix_c", cr, ci),
         WglArg.vec2("matrix_d", dr, di)
     ).renderTo(destinationTexture);
 });
Example #2
0
 assertThrows(() => Util.need(false));
Example #3
0
suite.test("need", () => {
    assertThrows(() => Util.need(false));
    Util.need(true);
});