Mercurial > gemma
changeset 1316:990e2b83b0e6
Removed accidentally commited file.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 23 Nov 2018 19:44:40 +0100 |
parents | 24e4c60c2606 |
children | 5443f5c9154c |
files | pkg/misc/set.go |
diffstat | 1 files changed, 0 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/misc/set.go Fri Nov 23 19:41:31 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -// This is Free Software under GNU Affero General Public License v >= 3.0 -// without warranty, see README.md and license for details. -// -// SPDX-License-Identifier: AGPL-3.0-or-later -// License-Filename: LICENSES/AGPL-3.0.txt -// -// Copyright (C) 2018 by via donau -// – Österreichische Wasserstraßen-Gesellschaft mbH -// Software engineering by Intevation GmbH -// -// Author(s): -// * Sascha L. Teichmann <sascha.teichmann@intevation.de> - -package misc - -import "math" - -func PowerSet(n int, fn func([]int)) { - powerSetSize := int(math.Pow(2, float64(n))) - - subSet := make([]int, n) - for index := 0; index < powerSetSize; index++ { - subSet = subSet[:0] - - for j := 0; j < n; j++ { - if index&(1<<uint(j)) > 0 { - subSet = append(subSet, j) - } - } - fn(subSet) - } -}