license import { GPGPUProgram } from './gpgpu_math' ; export class DiagProgram implements GPGPUProgram { variableNames = [ 'X' ] ; outputShape : number [ ] ; userCode : string ; constructor ( size ) { this . outputShape = [ size , size ] ; this . userCode = `
      void main() {
          ivec2 coords = getOutputCoords();
          float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;
          setOutput(val);
      }
    ` ; } }