cisst-saw
Loading...
Searching...
No Matches
nmrSingleVariablePowerBasis.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3
4/*
5
6 Author(s): Ofri Sadowsky
7 Created on: 2003-08-20
8
9 (C) Copyright 2003-2007 Johns Hopkins University (JHU), All Rights
10 Reserved.
11
12--- begin cisst license - do not edit ---
13
14This software is provided "as is" under an open source license, with
15no warranty. The complete license can be found in license.txt and
16http://www.cisst.org/cisst/license.txt.
17
18--- end cisst license ---
19*/
20
21
22#ifndef _nmrSingleVariablePowerBasis_h
23#define _nmrSingleVariablePowerBasis_h
24
25
26#include <vector>
27#include <algorithm>
28#include <assert.h>
29
33
34#ifdef CISST_COMPILER_IS_MSVC
35#pragma warning(push)
36#pragma warning(disable:4996)
37#endif // ifdef CISST_COMPILER_IS_MSVC
43{
44public:
45 typedef double VariableType;
47
48private:
49 typedef std::vector<VariableType> PowersContainerType;
50 PowersContainerType PowersContainer;
51
52public:
54 : PowersContainer( std::max<PowerType>(degree+1,2), 0)
55 {
56 PowersContainer[0] = 1;
57 }
58
62 void Initialize(PowerType degree)
63 {
64 PowersContainer.resize(degree+1);
65 PowersContainer.assign(degree+1, 0);
66 PowersContainer[0] = 1;
67 }
68
71 {
72 return PowersContainer.size() - 1;
73 }
74
77 {
78 return PowersContainer[1];
79 }
80
83 {
84 assert(power <= GetDegree());
85 return PowersContainer[power];
86 }
87
90 {
91 return PowersContainer[power];
92 }
93
95 void SetVariable(VariableType variable);
96};
97#ifdef CISST_COMPILER_IS_MSVC
98#pragma warning(pop)
99#endif // ifdef CISST_COMPILER_IS_MSVC
100
101#endif
int PowerType
Definition nmrPolynomialTermPowerIndex.h:98
VariableType GetVariablePower(PowerType power) const
Definition nmrSingleVariablePowerBasis.h:82
double VariableType
Definition nmrSingleVariablePowerBasis.h:45
PowerType GetDegree() const
Definition nmrSingleVariablePowerBasis.h:70
nmrSingleVariablePowerBasis(PowerType degree)
Definition nmrSingleVariablePowerBasis.h:53
void Initialize(PowerType degree)
Definition nmrSingleVariablePowerBasis.h:62
VariableType operator[](PowerType power) const
Definition nmrSingleVariablePowerBasis.h:89
VariableType GetVariable() const
Definition nmrSingleVariablePowerBasis.h:76
void SetVariable(VariableType variable)
nmrPolynomialTermPowerIndex::PowerType PowerType
Definition nmrSingleVariablePowerBasis.h:46
#define CISST_EXPORT
Definition cmnExportMacros.h:50
Portability across compilers and operating systems tools.
#define CISST_DEPRECATED
Definition cmnPortability.h:314
STL namespace.
Rules of exporting.
Declare class nmrPolynomialTermPowerIndex to represent the power index of a single term in a multi-va...