| 94 | } |
| 95 | |
| 96 | func (tg *SimMatGrid) MinSize() math32.Vector2 { |
| 97 | tg.rowMinBlank, tg.rowNGps, tg.rowMaxSz = tg.SizeLabel(tg.SimMat.Rows, false) |
| 98 | tg.colMinBlank, tg.colNGps, tg.colMaxSz = tg.SizeLabel(tg.SimMat.Columns, true) |
| 99 | |
| 100 | tg.colMaxSz.Y += tg.rowMaxSz.Y // needs one more for some reason |
| 101 | |
| 102 | rtxtsz := tg.rowMaxSz.Y / float32(tg.rowMinBlank+1) |
| 103 | ctxtsz := tg.colMaxSz.X / float32(tg.colMinBlank+1) |
| 104 | txtsz := math32.Max(rtxtsz, ctxtsz) |
| 105 | |
| 106 | rows, cols, _, _ := tensor.Projection2DShape(tg.Tensor.Shape(), tg.Display.OddRow) |
| 107 | rowEx := tg.rowNGps |
| 108 | colEx := tg.colNGps |
| 109 | frw := float32(rows) + float32(rowEx)*tg.Display.DimExtra // extra spacing |
| 110 | fcl := float32(cols) + float32(colEx)*tg.Display.DimExtra // extra spacing |
| 111 | max := float32(math32.Max(frw, fcl)) |
| 112 | gsz := tg.Display.TotPrefSize / max |
| 113 | gsz = math32.Max(gsz, tg.Display.GridMinSize) |
| 114 | gsz = math32.Max(gsz, txtsz) |
| 115 | gsz = math32.Min(gsz, tg.Display.GridMaxSize) |
| 116 | return math32.Vec2(tg.rowMaxSz.X+LabelSpace+gsz*float32(cols), tg.colMaxSz.Y+LabelSpace+gsz*float32(rows)) |
| 117 | } |
| 118 | |
| 119 | func (tg *SimMatGrid) Render() { |
| 120 | if tg.SimMat == nil || tg.SimMat.Mat.Len() == 0 { |