Xmipp
v3.23.11-Nereus
|
#include <ctf.h>
Public Member Functions | |
bool | isAnyNaN () |
Constructors | |
Matrix1D (bool column=true) | |
template<class T1 > | |
Matrix1D (T1 dim, bool column=true) | |
Matrix1D (const Matrix1D< T > &v) | |
~Matrix1D () | |
Matrix1D< T > & | operator= (const Matrix1D< T > &op1) |
bool | operator== (const Matrix1D< T > &op1) const |
Matrix1D< T > & | operator= (const std::vector< T > &op1) |
void | clear () |
void | coreInit () |
void | coreAllocate (int _vdim) |
void | coreDeallocate () |
Size and shape of Matrix1D | |
void | resize (size_t Xdim, bool copy=true) |
void | resizeNoCopy (int Xdim) |
template<typename T1 > | |
void | resize (const Matrix1D< T1 > &v) |
template<typename T1 > | |
void | resizeNoCopy (const Matrix1D< T1 > &v) |
template<typename T1 > | |
bool | sameShape (const Matrix1D< T1 > &op) const |
size_t | size () const |
int | isRow () const |
int | isCol () const |
void | setRow () |
void | setCol () |
Initialization of Matrix1D values | |
void | initConstant (T val) |
void | initConstant (size_t Xdim, T val) |
void | enumerate () |
void | initZeros () |
void | initZeros (size_t Xdim) |
template<typename T1 > | |
void | initZeros (const Matrix1D< T1 > &op) |
Public Attributes | |
T * | vdata |
The array itself. More... | |
bool | destroyData |
Destroy data. More... | |
size_t | vdim |
Number of elements. More... | |
bool | row |
<0=column vector (default), 1=row vector More... | |
Matrix1D operators | |
Matrix1D< T > | operator* (T op1) const |
Matrix1D< T > | operator/ (T op1) const |
Matrix1D< T > | operator+ (T op1) const |
Matrix1D< T > | operator- (T op1) const |
void | operator+= (const Matrix1D< T > &op1) const |
void | operator-= (const Matrix1D< T > &op1) const |
void | operator*= (T op1) |
void | operator/= (T op1) |
void | operator+= (T op1) |
void | operator-= (T op1) |
Matrix1D< T > | operator* (const Matrix1D< T > &op1) const |
Matrix1D< T > | operator/ (const Matrix1D< T > &op1) const |
Matrix1D< T > | operator+ (const Matrix1D< T > &op1) const |
Matrix1D< T > | operator- (const Matrix1D< T > &op1) const |
void | operator*= (const Matrix1D< T > &op1) |
void | operator/= (const Matrix1D< T > &op1) |
void | operator+= (const Matrix1D< T > &op1) |
void | operator-= (const Matrix1D< T > &op1) |
Matrix1D< T > | operator- () const |
Matrix1D< T > | operator* (const Matrix2D< T > &M) |
T & | operator() (int i) const |
T & | operator[] (int idx) |
T | operator[] (int idx) const |
Matrix1D< T > | operator* (T op1, const Matrix1D< T > &op2) |
Matrix1D< T > | operator/ (T op1, const Matrix1D< T > &op2) |
Matrix1D< T > | operator+ (T op1, const Matrix1D< T > &op2) |
Matrix1D< T > | operator- (T op1, const Matrix1D< T > &op2) |
Utilities for Matrix1D | |
T * | adaptForNumericalRecipes () const |
void | killAdaptationForNumericalRecipes (T *m) const |
void | selfCEIL () |
void | selfFLOOR () |
void | selfROUND () |
Matrix1D< T > | sort () const |
void | indexSort (Matrix1D< int > &indx) const |
double | computeMean () const |
T | computeMax () const |
void | computeMinMax (T &minval, T &maxval) const |
void | computeMeanAndStddev (double &mean, double &stddev) const |
T | computeMedian () const |
int | maxIndex () const |
int | minIndex () const |
Matrix1D< T > | transpose () const |
void | selfTranspose () |
double | sum (bool average=false) const |
double | sum2 () const |
double | dotProduct (const Matrix1D< T > &op1) const |
double | module () const |
double | angle () const |
void | selfNormalize () |
void | selfReverse () |
void | showWithGnuPlot (const std::string &xlabel, const std::string &title) |
void | numericalDerivative (Matrix1D< double > &result) const |
void | read (const FileName &fn) |
void | write (const FileName &fn) const |
void | edit () |
std::istream & | operator>> (std::istream &in, Matrix1D< T > &v) |
std::ostream & | operator<< (std::ostream &ostrm, const Matrix1D< T > &v) |
Empty constructor
The empty constructor creates a vector with no memory associated, origin=0, size=0, no statistics, ... You can choose between a column vector (by default), or a row one.
Definition at line 286 of file matrix1d.h.
|
inline |
Dimension constructor
The dimension constructor creates a vector with memory associated (but not assigned to anything, could be full of garbage) origin=0, size=the given one. You can choose between a column vector (by default), or a row one.
Definition at line 309 of file matrix1d.h.
Copy constructor
The created vector is a perfect copy of the input vector but with a different memory assignment.
Definition at line 325 of file matrix1d.h.
|
inline |
Produce a vector suitable for working with Numerical Recipes
This function must be used only as a preparation for routines which need that the first physical index is 1 and not 0 as it usually is in C. In fact the vector provided for Numerical recipes is exactly this same one but with the indexes changed.
This function is not ported to Python.
Definition at line 844 of file matrix1d.h.
|
inline |
Angle of the vector
Supposing this vector is in R2 this function returns the angle of this vector with X axis, ie, atan2(YY(v), XX(v))
Definition at line 993 of file matrix1d.h.
void Matrix1D< T >::clear | ( | ) |
T Matrix1D< T >::computeMax | ( | ) | const |
double Matrix1D< T >::computeMean | ( | ) | const |
void Matrix1D< T >::computeMeanAndStddev | ( | double & | mean, |
double & | stddev | ||
) | const |
T Matrix1D< T >::computeMedian | ( | ) | const |
void Matrix1D< T >::computeMinMax | ( | T & | minval, |
T & | maxval | ||
) | const |
|
inline |
|
inline |
void Matrix1D< T >::coreInit | ( | ) |
void Matrix1D< T >::edit | ( | ) |
Edit with xmipp_editor.
This function generates a random filename starting with PPP and edits it with xmipp_editor. After closing the editor the file is removed.
Definition at line 823 of file matrix1d.cpp.
void Matrix1D< T >::enumerate | ( | ) |
Gives a vector with the indexes for a sorted vector
This function returns the indexes of a sorted vector. The input vector is not modified at all. For instance, if the input vector is [3 2 -1 0] the result of this function would be [3 4 2 1] meaning that the lowest value is at index 3, then comes the element at index 4, ... Note that indexes start at 1.
Definition at line 861 of file matrix1d.cpp.
void Matrix1D< T >::initConstant | ( | T | val | ) |
Same value in all components.
The constant must be of a type compatible with the array type, ie, you cannot assign a double to an integer array without a casting. It is not an error if the array is empty, then nothing is done.
Definition at line 83 of file matrix1d.cpp.
void Matrix1D< T >::initConstant | ( | size_t | Xdim, |
T | val | ||
) |
|
inline |
Initialize to zeros with current size.
All values are set to 0. The current size and origin are kept. It is not an error if the array is empty, then nothing is done.
Definition at line 592 of file matrix1d.h.
|
inline |
|
inline |
Initialize to zeros following a pattern.
All values are set to 0, and the origin and size of the pattern are adopted.
Definition at line 616 of file matrix1d.h.
bool Matrix1D< T >::isAnyNaN | ( | ) |
|
inline |
True if vector is a column
Definition at line 532 of file matrix1d.h.
|
inline |
True if vector is a row.
Definition at line 520 of file matrix1d.h.
|
inline |
Kill an array produced for Numerical Recipes.
Nothing needs to be done in fact.
This function is not ported to Python.
Definition at line 855 of file matrix1d.h.
int Matrix1D< T >::maxIndex | ( | ) | const |
Index for the maximum element.
This function returns the index of the maximum element of an matrix1d. Returns -1 if the array is empty
Definition at line 610 of file matrix1d.cpp.
int Matrix1D< T >::minIndex | ( | ) | const |
Index for the minimum element.
This function returns the index of the minimum element of an matrix1d. Returns -1 if the array is empty
Definition at line 627 of file matrix1d.cpp.
|
inline |
Module of the vector
This module is defined as the square root of the sum of the squared components. Euclidean norm of the vector.
Definition at line 983 of file matrix1d.h.
Compute numerical derivative
The numerical derivative is of the same size as the input vector. However, the first two and the last two samples are set to 0, because the numerical method is not able to correctly estimate the derivative there.
Definition at line 746 of file matrix1d.cpp.
|
inline |
Vector element access
Returns the value of a vector logical position. In our example we could access from v(-2) to v(2). The elements can be used either by value or by reference.
Definition at line 819 of file matrix1d.h.
Vector by matrix
Algebraic vector by matrix multiplication. This function is actually implemented in xmippMatrices2D
Definition at line 739 of file matrix2d.cpp.
void Matrix1D< T >::operator*= | ( | T | op1 | ) |
void Matrix1D< T >::operator+= | ( | T | op1 | ) |
Unary minus.
It is used to build arithmetic expressions. You can make a minus of anything as long as it is correct semantically.
Definition at line 444 of file matrix1d.cpp.
void Matrix1D< T >::operator-= | ( | T | op1 | ) |
void Matrix1D< T >::operator/= | ( | T | op1 | ) |
Assignment.
You can build as complex assignment expressions as you like. Multiple assignment is allowed.
Definition at line 33 of file matrix1d.cpp.
|
inline |
Definition at line 824 of file matrix1d.h.
|
inline |
Definition at line 828 of file matrix1d.h.
Read from an ASCII file.
The array must be previously resized to the correct size.
Definition at line 808 of file matrix1d.cpp.
|
inline |
Resize to a given size
This function resize the actual array to the given size. The origin is not modified. If the actual array is larger than the pattern then the values outside the new size are lost, if it is smaller then 0's are added. An exception is thrown if there is no memory.
Definition at line 410 of file matrix1d.h.
|
inline |
Resize according to a pattern.
This function resize the actual array to the same size as the input pattern. If the actual array is larger than the pattern then the trailing values are lost, if it is smaller then 0's are added at the end
Definition at line 476 of file matrix1d.h.
|
inline |
|
inline |
|
inline |
Same shape.
Returns true if this object has got the same shape (origin and size) than the argument
Definition at line 497 of file matrix1d.h.
void Matrix1D< T >::selfCEIL | ( | ) |
CEILING
Applies a CEILING (look for the nearest larger integer) to each array element.
Definition at line 476 of file matrix1d.cpp.
void Matrix1D< T >::selfFLOOR | ( | ) |
FLOOR
Applies a FLOOR (look for the nearest larger integer) to each array element.
Definition at line 499 of file matrix1d.cpp.
void Matrix1D< T >::selfNormalize | ( | ) |
void Matrix1D< T >::selfReverse | ( | ) |
void Matrix1D< T >::selfROUND | ( | ) |
ROUND
Applies a ROUND (look for the nearest larger integer) to each array element.
Definition at line 522 of file matrix1d.cpp.
|
inline |
Algebraic transpose of vector
The same as before but the result is stored in this same object.
Definition at line 944 of file matrix1d.h.
|
inline |
|
inline |
void Matrix1D< T >::showWithGnuPlot | ( | const std::string & | xlabel, |
const std::string & | title | ||
) |
Show using gnuplot
This function uses gnuplot to plot this vector. You must supply the xlabel and title.
Definition at line 763 of file matrix1d.cpp.
|
inline |
Returns the size of this vector
Definition at line 508 of file matrix1d.h.
Sort 1D vector elements
Sort in ascending order the vector elements. You can use the "reverse" function to sort in descending order.
Definition at line 850 of file matrix1d.cpp.
double Matrix1D< T >::sum | ( | bool | average = false | ) | const |
Sum of vector values.
This function returns the sum of all internal values.
Definition at line 652 of file matrix1d.cpp.
double Matrix1D< T >::sum2 | ( | ) | const |
Sum of squared vector values.
This function returns the sum of all internal values to the second power.
Definition at line 673 of file matrix1d.cpp.
Algebraic transpose of vector
You can use the transpose in as complex expressions as you like. The origin of the vector is not changed.
Definition at line 644 of file matrix1d.cpp.
|
friend |
|
friend |
Input from input stream.
Actual size of the array is used to know how many values must be read.
This function is not ported to Python.
Definition at line 1040 of file matrix1d.h.
bool Matrix1D< T >::destroyData |
Destroy data.
Definition at line 261 of file matrix1d.h.
bool Matrix1D< T >::row |
<0=column vector (default), 1=row vector
Definition at line 267 of file matrix1d.h.
T* Matrix1D< T >::vdata |
The array itself.
Definition at line 258 of file matrix1d.h.
size_t Matrix1D< T >::vdim |
Number of elements.
Definition at line 264 of file matrix1d.h.