Rosetta
|
#include <MathNTensor.hh>
Public Types | |
typedef numeric::Size | Size |
typedef MathNTensorBase< T > | parent |
![]() | |
typedef numeric::Size | Size |
Public Member Functions | |
MathNTensor () | |
Default constructor – make a MathNTensor that's 0-dimensional with 0 elements. More... | |
MathNTensor (utility::fixedsizearray1< Size, N > const &n_bins, T const &value=T()) | |
Constructor: make a MathNTensor from fixedsizearray of dims and single element. More... | |
MathNTensor (utility::vector1< Size > const &n_bins, T const &value=T()) | |
Constructor: make a MathNTensor from vector of dims and single element. More... | |
MathNTensor (MathNTensor const &src) | |
Copy constructor. More... | |
MathNTensorBaseOP< T > | clone () const override |
Implementation of pure virtual clone function from base class. More... | |
MathNTensor< T, N > & | operator= (MathNTensor< T, N > const &rhs) |
Assignment operator. More... | |
~MathNTensor () override | |
Destructor. More... | |
T | sum () const |
bool | is_valid_position (utility::fixedsizearray1< Size, N > const &positions) const |
Is the position in the N-Tensor given by the positions vector a valid position? More... | |
bool | is_valid_position (utility::vector1< Size > const &positions) const override |
Is the given coordinate a valid position in the tensor? More... | |
void | set_value (utility::vector1< Size > const &position, T const &value_in) override |
Set a value in a tensor. More... | |
T const & | value (utility::vector1< Size > const &position) const override |
Get a value from a tensor. More... | |
MathNTensor (utility::fixedsizearray1< Size, N > const &n_bins, T const *data) | |
Raw pointer constructor. Avoid this. More... | |
Size | n_bins (Size const dimension) const override |
return number of bins for ith dimension More... | |
T | min () const override |
Get the minimum value stored in this tensor. More... | |
T | max () const override |
Get the maximum value stored in this tensor. More... | |
Size | num_dimensions () const |
Return number of dimensions overall (i.e. the dimensionality of this MathNTensor). More... | |
void | replace_layer (Size layer, MathNTensor< T, N-1 > const &matrix) |
Copies elements of argument matrix into this object at position ( layer ) More... | |
T const & | data (Size const index) const |
void | replace_layer (Size const layer, MathMatrix< T > const &matrix) |
ONLY for 3-dimensional tensors, replace a layer with a 2D matrix. More... | |
MathMatrix< T > | get_mathmatrix () |
ONLY for 2-dimensional tensors, give me a MathMatrix that's identical to the tensor. (That is, convert the MathNTensor to MathMatrix form. More... | |
T & | operator() (utility::fixedsizearray1< Size, N > const &position) |
Access a position in the N-dimensional tensor. More... | |
T const & | operator() (utility::fixedsizearray1< Size, N > const &position) const |
Use an N-vector of coordinates to access a position in the N-dimensional tensor. More... | |
T & | operator() (utility::vector1< Size > const &position) |
T const & | operator() (utility::vector1< Size > const &position) const |
T & | operator() (Size const b1, Size const b2) |
T & | operator() (Size const b1, Size const b2) const |
T & | operator() (Size const b1, Size const b2, Size const b3) |
T const & | operator() (Size const b1, Size const b2, Size const b3) const |
T & | operator() (Size const b1, Size const b2, Size const b3, Size const b4) |
T const & | operator() (Size const b1, Size const b2, Size const b3, Size const b4) const |
T const & | operator() (Size const b1, Size const b2, Size const b3, Size const b4, Size const b5) const |
T const & | operator() (Size const b1, Size const b2, Size const b3, Size const b4, Size const b5, Size const b6) const |
void | operator/= (Real const divisor) |
Size | size () const |
utility::fixedsizearray1< Size, N > const & | n_bins () const |
![]() | |
MathNTensorBase () | |
Default constructor. More... | |
virtual | ~MathNTensorBase () |
Virtual destructor needed for polymorphism. More... | |
MathNTensorBase (Size const dimensionality_in) | |
Costructor with dimensionality value. More... | |
Size | dimensionality () const |
Get the dimensionality of derived classes. More... | |
Private Attributes | |
utility::fixedsizearray1< Size, N > | n_bins_ |
Size | size_ |
The total number of bins in the MathNTensor (the product of all dimensions). More... | |
T * | data_ |
Array of data stored in this N-tensor. More... | |
Additional Inherited Members | |
![]() | |
void | set_dimensionality (Size const dimensionality_in) |
Lets the derived class set the dimensionality stored in the base class. More... | |
typedef MathNTensorBase<T> numeric::MathNTensor< T, N >::parent |
typedef numeric::Size numeric::MathNTensor< T, N >::Size |
|
inline |
Default constructor – make a MathNTensor that's 0-dimensional with 0 elements.
References numeric::MathNTensor< T, N >::data_, and numeric::MathNTensor< T, N >::size_.
|
inline |
Constructor: make a MathNTensor from fixedsizearray of dims and single element.
The single element gets copied to every entry in the MathNTensor, initializing it.
References numeric::MathNTensor< T, N >::data_, detail::fill(), create_a3b_hbs::i, N, numeric::MathNTensor< T, N >::n_bins(), numeric::MathNTensor< T, N >::size_, and numeric::MathNTensor< T, N >::value().
|
inline |
Constructor: make a MathNTensor from vector of dims and single element.
The single element gets copied to every entry in the MathNTensor, initializing it.
References numeric::MathNTensor< T, N >::data_, detail::fill(), create_a3b_hbs::i, N, numeric::MathNTensor< T, N >::n_bins(), numeric::MathNTensor< T, N >::n_bins_, runtime_assert, utility::fixedsizearray1< T, S >::size(), numeric::MathNTensor< T, N >::size_, and numeric::MathNTensor< T, N >::value().
|
inline |
Copy constructor.
References erraser_util::copy(), numeric::MathNTensor< T, N >::data_, and numeric::MathNTensor< T, N >::size_.
|
inlineoverride |
Destructor.
References numeric::MathNTensor< T, N >::data_.
|
inline |
Raw pointer constructor. Avoid this.
References numeric::MathNTensor< T, N >::data(), numeric::MathNTensor< T, N >::data_, create_a3b_hbs::i, create_a3b_hbs::ii, N, numeric::MathNTensor< T, N >::n_bins_, and numeric::MathNTensor< T, N >::size_.
|
inlineoverridevirtual |
Implementation of pure virtual clone function from base class.
Creates a copy of this object and returns an owning pointer to the copy. Must be implemented by derived classes.
Implements numeric::MathNTensorBase< T >.
Referenced by numeric::deep_copy().
|
inline |
|
inline |
ONLY for 2-dimensional tensors, give me a MathMatrix that's identical to the tensor. (That is, convert the MathNTensor to MathMatrix form.
Throws if this is not a 2D tensor.
References count, numeric::MathNTensor< T, N >::data_, create_a3b_hbs::i, create_a3b_hbs::j, N, numeric::MathNTensor< T, N >::n_bins_, and runtime_assert_string_msg.
|
inline |
Is the position in the N-Tensor given by the positions vector a valid position?
Returns true if each coordinate is in the range [1, dimension], false otherwise.
References create_a3b_hbs::i, N, and numeric::MathNTensor< T, N >::n_bins_.
Referenced by numeric::MathNTensor< T, N >::operator()(), numeric::MathNTensor< T, N >::replace_layer(), numeric::MathNTensor< T, N >::set_value(), and numeric::MathNTensor< T, N >::value().
|
inlineoverridevirtual |
Is the given coordinate a valid position in the tensor?
Returns false if out of range. Pure virtual; must be implemented by derived classes.
Implements numeric::MathNTensorBase< T >.
References create_a3b_hbs::i, N, and numeric::MathNTensor< T, N >::n_bins_.
|
inlineoverridevirtual |
Get the maximum value stored in this tensor.
Implements pure virtual from base class.
Implements numeric::MathNTensorBase< T >.
References numeric::MathNTensor< T, N >::data_, and numeric::MathNTensor< T, N >::size_.
|
inlineoverridevirtual |
Get the minimum value stored in this tensor.
Implements pure virtual from base class.
Implements numeric::MathNTensorBase< T >.
References numeric::MathNTensor< T, N >::data_, and numeric::MathNTensor< T, N >::size_.
|
inline |
References numeric::MathNTensor< T, N >::n_bins_.
Referenced by numeric::MathNTensor< T, N >::MathNTensor(), and numeric::MathNTensor< T, N >::operator()().
|
inlineoverridevirtual |
return number of bins for ith dimension
Implements numeric::MathNTensorBase< T >.
References numeric::MathNTensor< T, N >::n_bins_.
Referenced by numeric::interpolation::multilinear_interpolation(), numeric::interpolation::spline::PolycubicSpline< N >::train(), and numeric::write_tensor_to_file().
|
inline |
Return number of dimensions overall (i.e. the dimensionality of this MathNTensor).
References N.
Referenced by numeric::MathNTensor< T, N >::operator=().
|
inline |
References docking::b1, docking::b2, numeric::MathNTensor< T, N >::data_, N, and numeric::MathNTensor< T, N >::n_bins().
|
inline |
References docking::b1, docking::b2, numeric::MathNTensor< T, N >::data_, N, and numeric::MathNTensor< T, N >::n_bins().
|
inline |
References docking::b1, docking::b2, docking::b3, N, and numeric::MathNTensor< T, N >::n_bins().
|
inline |
References docking::b1, docking::b2, docking::b3, N, and numeric::MathNTensor< T, N >::n_bins().
|
inline |
Access a position in the N-dimensional tensor.
Accessors, both as const and nonconst reference and via fixedsizearray1, vector1, or sequences of values.
References numeric::MathNTensor< T, N >::data_, create_a3b_hbs::i, numeric::MathNTensor< T, N >::is_valid_position(), N, numeric::MathNTensor< T, N >::n_bins_, and runtime_assert_string_msg.
|
inline |
Use an N-vector of coordinates to access a position in the N-dimensional tensor.
Const access (assignment prohibited).
References numeric::MathNTensor< T, N >::data_, create_a3b_hbs::i, numeric::MathNTensor< T, N >::is_valid_position(), N, numeric::MathNTensor< T, N >::n_bins_, and runtime_assert_string_msg.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
ONLY for 3-dimensional tensors, replace a layer with a 2D matrix.
References numeric::MathNTensor< T, N >::data_, create_a3b_hbs::ii, numeric::MathNTensor< T, N >::is_valid_position(), beta_nonlocal::jj, basic::options::OptionKeys::flxbb::layer::layer, matrix, N, numeric::MathNTensor< T, N >::n_bins_, and runtime_assert.
|
inline |
Copies elements of argument matrix into this object at position ( layer )
layer is the FIRST index.
References numeric::MathNTensor< T, N >::data_, create_a3b_hbs::i, create_a3b_hbs::ii, internal_coordinates::indices, numeric::MathNTensor< T, N >::is_valid_position(), basic::options::OptionKeys::flxbb::layer::layer, matrix, N, numeric::MathNTensor< T, N >::n_bins_, offset, kmeans_adaptive_kernel_density_bb_dependent_rotlib::p, and runtime_assert.
|
inlineoverridevirtual |
Set a value in a tensor.
Note that bounds-checking only occurs in debug builds!
Implements numeric::MathNTensorBase< T >.
References debug_assert, create_a3b_hbs::i, numeric::MathNTensor< T, N >::is_valid_position(), N, and runtime_assert.
|
inline |
References numeric::MathNTensor< T, N >::size_.
Referenced by numeric::write_tensor_to_file_without_json().
|
inline |
|
inlineoverridevirtual |
Get a value from a tensor.
Note that bounds-checking only occurs in debug builds!
Implements numeric::MathNTensorBase< T >.
References debug_assert, create_a3b_hbs::i, numeric::MathNTensor< T, N >::is_valid_position(), N, and runtime_assert.
Referenced by numeric::MathNTensor< T, N >::MathNTensor().
|
private |
Array of data stored in this N-tensor.
Referenced by numeric::MathNTensor< T, N >::data(), numeric::MathNTensor< T, N >::get_mathmatrix(), numeric::MathNTensor< T, N >::MathNTensor(), numeric::MathNTensor< T, N >::max(), numeric::MathNTensor< T, N >::min(), numeric::MathNTensor< T, N >::operator()(), numeric::MathNTensor< T, N >::operator/=(), numeric::MathNTensor< T, N >::operator=(), numeric::MathNTensor< T, N >::replace_layer(), numeric::MathNTensor< T, N >::sum(), and numeric::MathNTensor< T, N >::~MathNTensor().
|
private |
Referenced by numeric::MathNTensor< T, N >::get_mathmatrix(), numeric::MathNTensor< T, N >::is_valid_position(), numeric::MathNTensor< T, N >::MathNTensor(), numeric::MathNTensor< T, N >::n_bins(), numeric::MathNTensor< T, N >::operator()(), numeric::MathNTensor< T, N >::operator=(), and numeric::MathNTensor< T, N >::replace_layer().
|
private |
The total number of bins in the MathNTensor (the product of all dimensions).
Referenced by numeric::MathNTensor< T, N >::data(), numeric::MathNTensor< T, N >::MathNTensor(), numeric::MathNTensor< T, N >::max(), numeric::MathNTensor< T, N >::min(), numeric::MathNTensor< T, N >::operator/=(), numeric::MathNTensor< T, N >::operator=(), numeric::MathNTensor< T, N >::size(), and numeric::MathNTensor< T, N >::sum().