moved todos, added function to iterator
This commit is contained in:
parent
5881276bd4
commit
6cab30f64c
|
|
@ -196,6 +196,14 @@ class BoundedSumIterator {
|
|||
|
||||
size_t numValues() const { return binom(bound + d, d); }
|
||||
|
||||
std::vector<size_t> numValuesPerFirstIndex() const {
|
||||
std::vector<size_t> result;
|
||||
for (size_t firstIndex = 0; firstIndex <= bound; ++firstIndex) {
|
||||
result.push_back(binom((bound - firstIndex) + (d - 1), d - 1));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator where the last index moves to the front. For an index set defined by a sum
|
||||
* bound, nothing changes.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,17 @@
|
|||
// Copyright (C) 2008-today The SG++ project
|
||||
// This file is part of the SG++ project. For conditions of distribution and
|
||||
// use, please see the copyright notice provided with SG++ or at
|
||||
// sgpp.sparsegrids.org
|
||||
/* Copyright 2019 The fast_sparse_interpolation Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -68,20 +78,6 @@ inline std::ostream &operator<<(std::ostream &os, fsi::MultiDimVector const &v)
|
|||
return os;
|
||||
}
|
||||
|
||||
// TODO: refactoring:
|
||||
/**
|
||||
* - Interface for MultiDimVector
|
||||
* - Separate Functions for L- and U-Multiplication, Creation of LU decomposition, computation of
|
||||
* function values
|
||||
* - Pass a callback function to iterator instead of calling it.next() - this might improve the
|
||||
* vector functions (could be made recursive or even loops for fixed dimension implementation)
|
||||
* - Typed interface?
|
||||
* - Tests?
|
||||
* - More point distributions / Basis functions?
|
||||
* - Forward evaluation?
|
||||
* - Computation of derivatives?
|
||||
*/
|
||||
|
||||
inline double measure_execution_time(std::function<void()> f) {
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
f();
|
||||
|
|
|
|||
|
|
@ -15,9 +15,19 @@ limitations under the License.
|
|||
|
||||
#include "common.hpp"
|
||||
|
||||
// TODO: refactoring:
|
||||
/**
|
||||
* - Interface for MultiDimVector
|
||||
* - Typed interface?
|
||||
* - Tests?
|
||||
* - More point distributions / Basis functions?
|
||||
* - Forward evaluation?
|
||||
* - Computation of derivatives?
|
||||
*/
|
||||
|
||||
void runFunctions() {
|
||||
constexpr size_t d = 8;
|
||||
size_t bound = 24;
|
||||
constexpr size_t d = 3;
|
||||
size_t bound = 100;
|
||||
fsi::TemplateBoundedSumIterator<d> it(bound);
|
||||
// fsi::BoundedSumIterator it(d, bound);
|
||||
std::vector<MonomialFunctions> phi(d);
|
||||
|
|
@ -53,6 +63,6 @@ void runFunctions() {
|
|||
|
||||
// using namespace fsi;
|
||||
int main() {
|
||||
// runFunctions();
|
||||
measurePerformance();
|
||||
runFunctions();
|
||||
// measurePerformance();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue