1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-09-02 03:02:34 +02:00

use for directly

This commit is contained in:
Justin Lin
2021-04-23 21:20:36 +08:00
parent 3921f1e2ce
commit 1004fad157

View File

@@ -1,7 +1,6 @@
use <util/flat.scad>; use <util/flat.scad>;
use <util/has.scad>; use <util/has.scad>;
use <util/rand.scad>; use <util/rand.scad>;
use <util/slice.scad>;
use <util/some.scad>; use <util/some.scad>;
use <util/every.scad>; use <util/every.scad>;
use <util/map/hashmap.scad>; use <util/map/hashmap.scad>;
@@ -125,26 +124,16 @@ function _wf_entropy(weights, states, state_leng, sumOfWeights, sumOfWeightLogWe
function _replaceStatesAt(wf, x, y, states) = function _replaceStatesAt(wf, x, y, states) =
let( let(
eigenstates = wf_eigenstates(wf), eigenstates = wf_eigenstates(wf),
rowsBeforeY = slice(eigenstates, 0, y),
rowY = eigenstates[y], rowY = eigenstates[y],
rowsAfterY = slice(eigenstates, y + 1), leng_rowY = len(rowY),
statesBeforeX = slice(rowY, 0, x), leng_eigenstates = len(eigenstates),
statesAfterX = slice(rowY, x + 1), newRowY = [for(i = 0; i < leng_rowY; i = i + 1) i == x ? states : rowY[i]]
newRowY = concat(
statesBeforeX,
[states],
statesAfterX
)
) )
[ [
wf_width(wf), wf_width(wf),
wf_height(wf), wf_height(wf),
wf_weights(wf), wf_weights(wf),
concat( [for(i = 0; i < leng_eigenstates; i = i + 1) i == y ? newRowY : eigenstates[i]]
rowsBeforeY,
[newRowY],
rowsAfterY
)
]; ];
function wf_not_collapsed_coords(wf) = [ function wf_not_collapsed_coords(wf) = [