Xmipp
v3.23.11-Nereus
|
Classes | |
class | Matrix1D< T > |
Typedefs | |
typedef Matrix1D< double > | DVector |
typedef Matrix1D< int > | IVector |
Vectors speed up macros | |
This macros are defined to allow high speed in critical parts of your program. They shouldn't be used systematically as usually there is no checking on the correctness of the operation you are performing. Speed comes from three facts: first, they are macros and no function call is performed (although most of the critical functions are inline functions), there is no checking on the correctness of the operation (it could be wrong and you are not warned of it), and destination vectors are not returned saving time in the copy constructor and in the creation/destruction of temporary vectors. | |
#define | MATRIX1D_ARRAY(v) ((v).vdata) |
#define | FOR_ALL_ELEMENTS_IN_MATRIX1D(v) for (size_t i=0; i<v.vdim; i++) |
#define | VEC_XSIZE(m) ((m).vdim) |
#define | XX(v) (v).vdata[0] |
#define | YY(v) (v).vdata[1] |
#define | ZZ(v) (v).vdata[2] |
#define | VECTOR_R2(v, x, y) |
#define | VECTOR_R3(v, x, y, z) |
#define | V2_PLUS_V2(a, b, c) |
#define | V2_MINUS_V2(a, b, c) |
#define | V2_PLUS_CT(a, b, k) |
#define | V2_BY_CT(a, b, k) |
#define | V3_PLUS_V3(a, b, c) |
#define | V3_MINUS_V3(a, b, c) |
#define | V3_PLUS_CT(a, b, c) |
#define | V3_BY_CT(a, b, c) |
#define | VEC_ELEM(v, i) ((v).vdata[(i)]) |
#define | dMi(v, i) ((v).vdata[(i)]) |
#define | VEC_SWAP(v, i, j, aux) {aux = dMi(v, i); dMi(v, i) = dMi(v, j); dMi(v, j) = aux; } |
Vector Related functions | |
These functions are not methods of Matrix1D | |
Matrix1D< double > | vectorR2 (double x, double y) |
Matrix1D< double > | vectorR3 (double x, double y, double z) |
Matrix1D< int > | vectorR3 (int x, int y, int z) |
template<typename T > | |
T | dotProduct (const Matrix1D< T > &v1, const Matrix1D< T > &v2) |
template<typename T > | |
Matrix1D< T > | vectorProduct (const Matrix1D< T > &v1, const Matrix1D< T > &v2) |
template<typename T > | |
void | vectorProduct (const Matrix1D< T > &v1, const Matrix1D< T > &v2, Matrix1D< T > &result) |
template<typename T > | |
void | sortTwoVectors (Matrix1D< T > &v1, Matrix1D< T > &v2) |
template<typename T1 , typename T2 > | |
void | typeCast (const Matrix1D< T1 > &v1, Matrix1D< T2 > &v2) |
template<typename T1 > | |
void | typeCast (const Matrix1D< T1 > &v1, Matrix1D< T1 > &v2) |
Definition at line 246 of file matrix1d.h.
For all elements in the array This macro is used to generate loops for the vector in an easy manner. It defines an internal index 'i' which ranges the vector using its mathematical definition (ie, logical access).
Definition at line 72 of file matrix1d.h.
#define MATRIX1D_ARRAY | ( | v | ) | ((v).vdata) |
Array access. This macro gives you access to the array (T)
Definition at line 58 of file matrix1d.h.
Multiplying/dividing by a constant a R2 vector (a=b*k)
Definition at line 179 of file matrix1d.h.
Adding/subtracting a constant to a R2 vector (a=b-k).
Definition at line 162 of file matrix1d.h.
Multiplying/dividing by a constant a R3 vector (a=b*k)
Definition at line 238 of file matrix1d.h.
Adding/subtracting a constant to a R3 vector (a=b-k)
Definition at line 220 of file matrix1d.h.
Direct access to vector element
Definition at line 245 of file matrix1d.h.
Definition at line 248 of file matrix1d.h.
X dimension of the matrix
Definition at line 77 of file matrix1d.h.
Creates vector in R2 The vector must be created beforehand to the correct size. After this macro the vector is (x, y) in R2.
Definition at line 112 of file matrix1d.h.
Creates vector in R3 The vector must be created beforehand to the correct size. After this macro the vector is (x, y, z) in R3.
Definition at line 124 of file matrix1d.h.
#define XX | ( | v | ) | (v).vdata[0] |
#define YY | ( | v | ) | (v).vdata[1] |
#define ZZ | ( | v | ) | (v).vdata[2] |
Definition at line 1094 of file matrix1d.h.
Definition at line 1095 of file matrix1d.h.
Dot product. Given any two vectors in Rn (n-dimensional vector), this function returns the dot product of both. If the vectors are not of the same size or shape then an exception is thrown. The dot product is defined as the sum of the component by component multiplication.
For the R3 vectors (V1x,V1y,V1z), (V2x, V2y, V2z) the result is V1x*V2x + V1y*V2y + V1z*V2z.
Definition at line 1140 of file matrix1d.h.
Sort two vectors. v1 and v2 must be of the same shape, if not an exception is thrown. After calling this function all components in v1 are the minimum between the corresponding components in v1 and v2, and all components in v2 are the maximum.
For instance, XX(v1)=MIN(XX(v1), XX(v2)), XX(v2)=MAX(XX(v1), XX(v2)). Notice that both vectors are modified. This function is very useful for sorting two corners. After calling it you can certainly perform a non-empty for (from corner1 to corner2) loop.
Definition at line 1206 of file matrix1d.h.
void typeCast | ( | const Matrix1D< T1 > & | v1, |
Matrix1D< T2 > & | v2 | ||
) |
Conversion from one type to another. If we have an integer array and we need a double one, we can use this function. The conversion is done through a type casting of each element If n >= 0, only the nth volumes will be converted, otherwise all NSIZE volumes
Definition at line 1227 of file matrix1d.h.
Conversion from one type to another. In some cases, the two types are the same. So a faster way is simply by assignment.
Definition at line 1244 of file matrix1d.h.
Matrix1D<T> vectorProduct | ( | const Matrix1D< T > & | v1, |
const Matrix1D< T > & | v2 | ||
) |
Vector product in R3. This function takes two R3 vectors and compute their vectorial product. For two vectors (V1x,V1y,V1z), (V2x, V2y, V2z) the result is (V1y*V2z-V1z*v2y, V1z*V2x-V1x*V2z, V1x*V2y-V1y*V2x). Pay attention that this operator is not conmutative. An exception is thrown if the vectors are not of the same shape or they don't belong to R3.
Definition at line 1165 of file matrix1d.h.
void vectorProduct | ( | const Matrix1D< T > & | v1, |
const Matrix1D< T > & | v2, | ||
Matrix1D< T > & | result | ||
) |
Vector product in R3. This function computes the vector product of two R3 vectors. No check is performed, it is assumed that the output vector is already resized
Definition at line 1186 of file matrix1d.h.
Matrix1D<double> vectorR2 | ( | double | x, |
double | y | ||
) |
Creates vector in R2. After this function the vector is (x,y) in R2.
Definition at line 884 of file matrix1d.cpp.
Matrix1D<double> vectorR3 | ( | double | x, |
double | y, | ||
double | z | ||
) |
Creates vector in R3. After this function the vector is (x,y,z) in R3.
Definition at line 892 of file matrix1d.cpp.
Matrix1D<int> vectorR3 | ( | int | x, |
int | y, | ||
int | z | ||
) |