Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F19244634
CoordinateSelector.hh
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
CoordinateSelector.hh
View Options
#ifndef NPSTAT_COORDINATESELECTOR_HH_
#define NPSTAT_COORDINATESELECTOR_HH_
/*!
// \file CoordinateSelector.hh
//
// \brief Multidimensional functor which picks one of the elements
// from an array of doubles
//
// Author: I. Volobouev
//
// August 2012
*/
#include
<climits>
#include
<stdexcept>
#include
"npstat/nm/AbsMultivariateFunctor.hh"
namespace
npstat
{
/**
// A trivial implementation of AbsMultivariateFunctor which selects
// an element with a certain index from the input array
*/
class
CoordinateSelector
:
public
AbsMultivariateFunctor
{
public
:
inline
explicit
CoordinateSelector
(
const
unsigned
i
)
:
index_
(
i
)
{}
inline
double
operator
()(
const
double
*
point
,
const
unsigned
dim
)
const
{
if
(
dim
<=
index_
)
throw
std
::
invalid_argument
(
"In npstat::CoordinateSelector::operator(): "
"input array dimensionality is too small"
);
return
point
[
index_
];
}
inline
unsigned
minDim
()
const
{
return
index_
+
1U
;}
inline
unsigned
maxDim
()
const
{
return
UINT_MAX
;}
private
:
CoordinateSelector
();
unsigned
index_
;
};
}
#endif
// NPSTAT_COORDINATESELECTOR_HH_
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Tue, Sep 30, 4:44 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6549948
Default Alt Text
CoordinateSelector.hh (1 KB)
Attached To
Mode
rNPSTATSVN npstatsvn
Attached
Detach File
Event Timeline
Log In to Comment