lsst.geom
ga1e77700b3+df8f93165b
Loading...
Searching...
No Matches
src
polynomials
BinomialMatrix.cc
Go to the documentation of this file.
1
// -*- LSST-C++ -*-
2
/*
3
* Developed for the LSST Data Management System.
4
* This product includes software developed by the LSST Project
5
* (https://www.lsst.org).
6
* See the COPYRIGHT file at the top-level directory of this distribution
7
* for details of code ownership.
8
*
9
* This program is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation, either version 3 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see <https://www.gnu.org/licenses/>.
21
*/
22
23
#include "
lsst/geom/polynomials/BinomialMatrix.h
"
24
25
namespace
lsst
{
namespace
geom {
namespace
polynomials {
26
27
BinomialMatrix::BinomialMatrix
(
int
nMax) : _matrix(Eigen::MatrixXd::Zero(nMax + 1, nMax + 1)) {
28
_matrix.col(0).setConstant(1);
29
_matrix.diagonal().setConstant(1);
30
for
(
int
i = 2; i <= nMax; ++i) {
31
_matrix(i, 0) = 1.0;
32
_matrix(i, i) = 1.0;
33
for
(
int
j = 1; j < i; ++j) {
34
_matrix(i, j) = _matrix(i - 1, j - 1) *
35
(
static_cast<
double
>
(i) /
static_cast<
double
>
(j));
36
}
37
}
38
}
39
40
}}}
// namespace lsst::geom::polynomials
BinomialMatrix.h
lsst::geom::polynomials::BinomialMatrix::BinomialMatrix
BinomialMatrix(int nMax)
Construct an object that can compute binomial coefficients with up to and including the given value.
Definition
BinomialMatrix.cc:27
lsst
Generated on Wed Mar 20 2024 11:08:54 for lsst.geom by
1.10.0