Xmipp  v3.23.11-Nereus
Classes | Macros
multidim_array_base.h File Reference
#include <stddef.h>
#include <iostream>
#include "xmipp_array_dim.h"
#include "xmipp_array_coord.h"
Include dependency graph for multidim_array_base.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Matrix1D< T >
 
class  MultidimArrayBase
 

Macros

#define LOOKUP_TABLE_LEN   6
 
MultidimArraysSpeedUp 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 STARTINGX(v)   ((v).xinit)
 
#define FINISHINGX(v)   ((v).xinit + (int)(v).xdim - 1)
 
#define STARTINGY(v)   ((v).yinit)
 
#define FINISHINGY(v)   ((v).yinit + (int)(v).ydim - 1)
 
#define STARTINGZ(v)   ((v).zinit)
 
#define FINISHINGZ(v)   ((v).zinit + (int)(v).zdim - 1)
 
#define INSIDEX(v, x)   ((x) >= STARTINGX(v) && (x) <= FINISHINGX(v))
 
#define INSIDEY(v, y)   ((y) >= STARTINGY(v) && (y) <= FINISHINGY(v))
 
#define INSIDEZ(v, z)   ((z) >= STARTINGZ(v) && (z) <= FINISHINGZ(v))
 
#define INSIDEXY(v, x, y)   (INSIDEX(v, x) && INSIDEY(v, y))
 
#define INSIDEXYZ(v, x, y, z)   (INSIDEX(v, x) && INSIDEY(v, y) && INSIDEZ(v,z))
 
#define XSIZE(v)   ((v).xdim)
 
#define YSIZE(v)   ((v).ydim)
 
#define ZSIZE(v)   ((v).zdim)
 
#define NSIZE(v)   ((v).ndim)
 
#define YXSIZE(v)   ((v).yxdim)
 
#define ZYXSIZE(v)   ((v).zyxdim)
 
#define MULTIDIM_SIZE(v)   ((v).nzyxdim)
 
#define NZYXSIZE(v)   ((v).nzyxdim)
 
#define MULTIDIM_ARRAY(v)   ((v).data)
 
#define DIRECT_NZYX_ELEM(v, l, k, i, j)   ((v).data[(l)*ZYXSIZE(v)+(k)*YXSIZE(v)+((i)*XSIZE(v))+(j)])
 
#define DIRECT_ZYX_ELEM(v, k, i, j)   ((v).data[(k)*YXSIZE(v)+((i)*XSIZE(v))+(j)])
 
#define DIRECT_N_YX_ELEM(v, l, i, j)   ((v).data[(l)*ZYXSIZE(v) +((i)*XSIZE(v))+(j)])
 
#define DIRECT_N__X_ELEM(v, l, j)   ((v).data[(l)*ZYXSIZE(v)+(j)])
 
#define NZYX_ELEM(v, l, k, i, j)   DIRECT_NZYX_ELEM((v), (l), (k) - STARTINGZ(v), (i) - STARTINGY(v), (j) - STARTINGX(v))
 
#define DIRECT_MULTIDIM_ELEM(v, n)   ((v).data[(n)])
 
#define FOR_ALL_DIRECT_ELEMENTS_IN_MULTIDIMARRAY(v)   for (size_t n=0; n<NZYXSIZE(v); ++n)
 
#define FOR_ALL_DIRECT_NZYX_ELEMENTS_IN_MULTIDIMARRAY(V)
 
#define FOR_ALL_NZYX_ELEMENTS_IN_MULTIDIMARRAY(V)
 
#define FOR_ALL_DIRECT_ELEMENTS_IN_MULTIDIMARRAY_ptr(v, n, ptr)   for ((n)=0, (ptr)=(v).data; (n)<NZYXSIZE(v); ++(n), ++(ptr))
 
#define DIRECT_A3D_ELEM(v, k, i, j)   ((v).data[YXSIZE(v)*(k)+((i)*XSIZE(v))+(j)])
 
#define dAkij(V, k, i, j)   DIRECT_A3D_ELEM(V, k, i, j)
 
#define A3D_ELEM(V, k, i, j)   DIRECT_A3D_ELEM((V),(k) - STARTINGZ(V), (i) - STARTINGY(V), (j) - STARTINGX(V))
 
#define FOR_ALL_ELEMENTS_IN_ARRAY3D(V)
 
#define FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY3D(V1, V2)
 
#define FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY3D(V)
 
#define DIRECT_A2D_ELEM(v, i, j)   ((v).data[(i)*(v).xdim+(j)])
 
#define dAij(M, i, j)   DIRECT_A2D_ELEM(M, i, j)
 
#define A2D_ELEM(v, i, j)   DIRECT_A2D_ELEM(v, (i) - STARTINGY(v), (j) - STARTINGX(v))
 
#define SAME_SHAPE2D(v1, v2)
 
#define SAME_SHAPE3D(v1, v2)
 
#define FOR_ALL_ELEMENTS_IN_ARRAY2D(m)
 
#define FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY2D(m1, m2)
 
#define FOR_ALL_ELEMENTS_IN_ARRAY3D_BETWEEN(corner1, corner2)
 
#define FOR_ALL_ELEMENTS_IN_ARRAY2D_BETWEEN(corner1, corner2)
 
#define FOR_ALL_ELEMENTS_IN_ARRAY1D_BETWEEN(corner1, corner2)   for (XX(r)=(int) XX((corner1)); XX(r)<=(int) XX((corner2)); ++XX(r))
 
#define FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY2D(m)
 
#define DIRECT_A1D_ELEM(v, i)   ((v).data[(i)])
 
#define dAi(v, i)   DIRECT_A1D_ELEM(v, i)
 
#define A1D_ELEM(v, i)   DIRECT_A1D_ELEM(v, (i) - ((v).xinit))
 
#define FOR_ALL_ELEMENTS_IN_ARRAY1D(v)   for (int i=STARTINGX(v); i<=FINISHINGX(v); ++i)
 
#define FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY1D(v1, v2)
 
#define FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY1D(v)   for (size_t i=0; i<v.xdim; ++i)
 
#define OUTSIDE(i, j)
 
#define OUTSIDE3D(k, i, j)
 

Macro Definition Documentation

◆ A1D_ELEM

#define A1D_ELEM (   v,
  i 
)    DIRECT_A1D_ELEM(v, (i) - ((v).xinit))

Vector element: Logical access

A1D_ELEM(v, -2) = 1;
val = A1D_ELEM(v, -2);

Definition at line 539 of file multidim_array_base.h.

◆ A2D_ELEM

#define A2D_ELEM (   v,
  i,
  j 
)    DIRECT_A2D_ELEM(v, (i) - STARTINGY(v), (j) - STARTINGX(v))

Matrix element: Logical access

A2D_ELEM(m, -2, 1) = 1;
val = A2D_ELEM(m, -2, 1);

Definition at line 354 of file multidim_array_base.h.

◆ A3D_ELEM

#define A3D_ELEM (   V,
  k,
  i,
  j 
)    DIRECT_A3D_ELEM((V),(k) - STARTINGZ(V), (i) - STARTINGY(V), (j) - STARTINGX(V))

Volume element: Logical access.

A3D_ELEM(V, -1, -2, 1) = 1;
val = A3D_ELEM(V, -1, -2, 1);

Definition at line 253 of file multidim_array_base.h.

◆ dAi

#define dAi (   v,
  i 
)    DIRECT_A1D_ELEM(v, i)

A short alias to previous function

Definition at line 530 of file multidim_array_base.h.

◆ dAij

#define dAij (   M,
  i,
  j 
)    DIRECT_A2D_ELEM(M, i, j)

Short alias for DIRECT_A2D_ELEM

Definition at line 345 of file multidim_array_base.h.

◆ dAkij

#define dAkij (   V,
  k,
  i,
  j 
)    DIRECT_A3D_ELEM(V, k, i, j)

A short alias for the previous function.

Definition at line 244 of file multidim_array_base.h.

◆ DIRECT_A1D_ELEM

#define DIRECT_A1D_ELEM (   v,
  i 
)    ((v).data[(i)])

Vector element: Physical access

Be careful because this is physical access, usually vectors follow the C convention of starting index==0. This function should not be used as it goes against the vector library philosophy unless you explicitly want to access directly to any value in the vector without taking into account its logical position.

DIRECT_A1D_ELEM(v, 0) = 1;
val = DIRECT_A1D_ELEM(v, 0);

Definition at line 526 of file multidim_array_base.h.

◆ DIRECT_A2D_ELEM

#define DIRECT_A2D_ELEM (   v,
  i,
  j 
)    ((v).data[(i)*(v).xdim+(j)])

Access to a direct element of a matrix. v is the array, i and j define the element v_ij.

Be careful because this is physical access, usually matrices follow the C convention of starting index==0 (X and Y). This function should not be used as it goes against the vector library philosophy unless you explicitly want to access directly to any value in the matrix without taking into account its logical position

DIRECT_A2D_ELEM(m, 0, 0) = 1;
val = DIRECT_A2D_ELEM(m, 0, 0);

Definition at line 341 of file multidim_array_base.h.

◆ DIRECT_A3D_ELEM

#define DIRECT_A3D_ELEM (   v,
  k,
  i,
  j 
)    ((v).data[YXSIZE(v)*(k)+((i)*XSIZE(v))+(j)])

Access to a direct element. v is the array, k is the slice (Z), i is the Y index and j is the X index.

Definition at line 239 of file multidim_array_base.h.

◆ DIRECT_MULTIDIM_ELEM

#define DIRECT_MULTIDIM_ELEM (   v,
  n 
)    ((v).data[(n)])

Access to a direct element. v is the array, k is the slice and n is the number of the pixel (combined i and j) within the slice.

Definition at line 161 of file multidim_array_base.h.

◆ DIRECT_N__X_ELEM

#define DIRECT_N__X_ELEM (   v,
  l,
  j 
)    ((v).data[(l)*ZYXSIZE(v)+(j)])

Access to a direct element. v is the array, l is the image, k =0, i = 0 and j is the X index. i and j) within the slice.

Definition at line 150 of file multidim_array_base.h.

◆ DIRECT_N_YX_ELEM

#define DIRECT_N_YX_ELEM (   v,
  l,
  i,
  j 
)    ((v).data[(l)*ZYXSIZE(v) +((i)*XSIZE(v))+(j)])

Access to a direct element. v is the array, l is the image, k =0, i is the Y index and j is the X index. i and j) within the slice.

Definition at line 145 of file multidim_array_base.h.

◆ DIRECT_NZYX_ELEM

#define DIRECT_NZYX_ELEM (   v,
  l,
  k,
  i,
  j 
)    ((v).data[(l)*ZYXSIZE(v)+(k)*YXSIZE(v)+((i)*XSIZE(v))+(j)])

Access to a direct element. v is the array, l is the image, k is the slice, i is the Y index and j is the X index. i and j) within the slice.

Definition at line 133 of file multidim_array_base.h.

◆ DIRECT_ZYX_ELEM

#define DIRECT_ZYX_ELEM (   v,
  k,
  i,
  j 
)    ((v).data[(k)*YXSIZE(v)+((i)*XSIZE(v))+(j)])

Access to a direct element. v is the array, l is the image, k is the slice, i is the Y index and j is the X index. i and j) within the slice.

Definition at line 139 of file multidim_array_base.h.

◆ FINISHINGX

#define FINISHINGX (   v)    ((v).xinit + (int)(v).xdim - 1)

Returns the last X valid logical index

Definition at line 55 of file multidim_array_base.h.

◆ FINISHINGY

#define FINISHINGY (   v)    ((v).yinit + (int)(v).ydim - 1)

Returns the last Y valid logical index

Definition at line 63 of file multidim_array_base.h.

◆ FINISHINGZ

#define FINISHINGZ (   v)    ((v).zinit + (int)(v).zdim - 1)

Returns the last Z valid logical index

Definition at line 71 of file multidim_array_base.h.

◆ FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY1D

#define FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY1D (   v)    for (size_t i=0; i<v.xdim; ++i)

For all elements in the array, accessed physically

This macro is used to generate loops for the vector in an easy way using physical indexes. It defines internal the index 'i' which ranges the vector using its physical definition.

{
std::cout << DIRECT_A2D_ELEM(v, i) << " ";
}

Definition at line 593 of file multidim_array_base.h.

◆ FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY2D

#define FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY2D (   m)
Value:
for (size_t i=0; i<YSIZE(m); ++i) \
for (size_t j=0; j<XSIZE(m); ++j)
#define YSIZE(v)
#define i
#define XSIZE(v)
#define j
int m

For all elements in the array, accessed physically

This macro is used to generate loops for the matrix in an easy way using physical indexes. It defines internal indexes 'i' and 'j' which ranges the matrix using its physical definition.

Definition at line 509 of file multidim_array_base.h.

◆ FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY3D

#define FOR_ALL_DIRECT_ELEMENTS_IN_ARRAY3D (   V)
Value:
for (size_t k=0; k<ZSIZE(V); ++k) \
for (size_t i=0; i<YSIZE(V); ++i) \
for (size_t j=0; j<XSIZE(V); ++j)
#define YSIZE(v)
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define XSIZE(v)
#define ZSIZE(v)
#define j

For all direct elements in the array.

This macro is used to generate loops for the volume in an easy way. It defines internal indexes 'k','i' and 'j' which ranges the volume using its physical definition.

Definition at line 322 of file multidim_array_base.h.

◆ FOR_ALL_DIRECT_ELEMENTS_IN_MULTIDIMARRAY

#define FOR_ALL_DIRECT_ELEMENTS_IN_MULTIDIMARRAY (   v)    for (size_t n=0; n<NZYXSIZE(v); ++n)

For all direct elements in the array

This macro is used to generate loops for the array in an easy manner. It defines an internal index 'n' which goes over the slices and 'n' that goes over the pixels in each slice.

Definition at line 176 of file multidim_array_base.h.

◆ FOR_ALL_DIRECT_ELEMENTS_IN_MULTIDIMARRAY_ptr

#define FOR_ALL_DIRECT_ELEMENTS_IN_MULTIDIMARRAY_ptr (   v,
  n,
  ptr 
)    for ((n)=0, (ptr)=(v).data; (n)<NZYXSIZE(v); ++(n), ++(ptr))

For all direct elements in the array, pointer version

This macro is used to generate loops for the array in an easy manner. It defines an internal index 'k' which goes over the slices and 'n' that goes over the pixels in each slice. Each element can be accessed through an external pointer called ptr.

T* ptr=NULL;
size_t n;
{
std::cout << *ptr << " ";
}

Definition at line 233 of file multidim_array_base.h.

◆ FOR_ALL_DIRECT_NZYX_ELEMENTS_IN_MULTIDIMARRAY

#define FOR_ALL_DIRECT_NZYX_ELEMENTS_IN_MULTIDIMARRAY (   V)
Value:
for (size_t l=0; l<NSIZE(V); ++l) \
for (size_t k=0; k<ZSIZE(V); ++k) \
for (size_t i=0; i<YSIZE(V); ++i) \
for (size_t j=0; j<XSIZE(V); ++j)
#define NSIZE(v)
#define YSIZE(v)
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define XSIZE(v)
#define ZSIZE(v)
#define j

For all direct elements in the array

This macro is used to generate loops for the array in an easy manner. It defines internal indexes 'l', 'k','i' and 'j' which ranges over the n volume using its physical definition.

Definition at line 192 of file multidim_array_base.h.

◆ FOR_ALL_ELEMENTS_IN_ARRAY1D

#define FOR_ALL_ELEMENTS_IN_ARRAY1D (   v)    for (int i=STARTINGX(v); i<=FINISHINGX(v); ++i)

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).

{
std::cout << v(i) << " ";
}

Definition at line 554 of file multidim_array_base.h.

◆ FOR_ALL_ELEMENTS_IN_ARRAY1D_BETWEEN

#define FOR_ALL_ELEMENTS_IN_ARRAY1D_BETWEEN (   corner1,
  corner2 
)    for (XX(r)=(int) XX((corner1)); XX(r)<=(int) XX((corner2)); ++XX(r))

For all elements in the array between corners

This macro is used to generate loops for a vector in an easy manner. It needs an externally defined MultidimArray< double > r(1). Then XX(r) ranges from (int) XX(corner1) to (int) XX(corner2) (included limits) (notice that corner1 and corner2 need only to be MultidimArray).

MultidimArray< double > corner1(1), corner2(1), r(1);
XX(corner1) = -1;
XX(corner2) = 1;
{
std::cout << v(XX(r)) << " ";
}

Definition at line 493 of file multidim_array_base.h.

◆ FOR_ALL_ELEMENTS_IN_ARRAY2D

#define FOR_ALL_ELEMENTS_IN_ARRAY2D (   m)
Value:
for (int i=STARTINGY(m); i<=FINISHINGY(m); ++i) \
for (int j=STARTINGX(m); j<=FINISHINGX(m); ++j)
#define FINISHINGX(v)
#define STARTINGX(v)
#define i
#define STARTINGY(v)
#define j
int m
#define FINISHINGY(v)

For all elements in the array

This macro is used to generate loops for the matrix in an easy way. It defines internal indexes 'i' and 'j' which ranges the matrix using its mathematical definition (ie, logical access).

{
std::cout << m(i, j) << " ";
}

Definition at line 390 of file multidim_array_base.h.

◆ FOR_ALL_ELEMENTS_IN_ARRAY2D_BETWEEN

#define FOR_ALL_ELEMENTS_IN_ARRAY2D_BETWEEN (   corner1,
  corner2 
)
Value:
for (YY(r)=YY((corner1)); YY(r)<=YY((corner2)); ++YY(r)) \
for (XX(r)=XX((corner1)); XX(r)<=XX((corner2)); ++XX(r))
#define XX(v)
Definition: matrix1d.h:85
#define YY(v)
Definition: matrix1d.h:93

For all elements in the array between corners

This macro is used to generate loops for a matrix in an easy manner. It needs an externally defined MultidimArray< double > r(2). Then YY(r) and XX(r) range from (int) YY(corner1) to (int)YY(corner2), (int) XX(corner1) to (int) XX(corner2) (included limits) respectively. Notice that corner1 and corner2 need only be MultidimArray.

MultidimArray< double > corner1(2), corner2(2);
XX(corner1) = -1;
XX(corner2) = 1;
YY(corner1) = -2;
YY(corner2) = 2;
{
std::cout << v(r) << " ";
}

Definition at line 472 of file multidim_array_base.h.

◆ FOR_ALL_ELEMENTS_IN_ARRAY3D

#define FOR_ALL_ELEMENTS_IN_ARRAY3D (   V)
Value:
for (int k=STARTINGZ(V); k<=FINISHINGZ(V); ++k) \
for (int i=STARTINGY(V); i<=FINISHINGY(V); ++i) \
for (int j=STARTINGX(V); j<=FINISHINGX(V); ++j)
#define FINISHINGX(v)
#define FINISHINGZ(v)
#define STARTINGX(v)
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define STARTINGY(v)
#define j
#define FINISHINGY(v)
#define STARTINGZ(v)

For all elements in the array.

This macro is used to generate loops for the volume in an easy way. It defines internal indexes 'k','i' and 'j' which ranges the volume using its mathematical definition (ie, logical access).

{
std::cout << V(k, i, j) << " ";
}

Definition at line 269 of file multidim_array_base.h.

◆ FOR_ALL_ELEMENTS_IN_ARRAY3D_BETWEEN

#define FOR_ALL_ELEMENTS_IN_ARRAY3D_BETWEEN (   corner1,
  corner2 
)
Value:
for (ZZ(r)=ZZ((corner1)); ZZ(r)<=ZZ((corner2)); ++ZZ(r)) \
for (YY(r)=YY((corner1)); YY(r)<=YY((corner2)); ++YY(r)) \
for (XX(r)=XX((corner1)); XX(r)<=XX((corner2)); ++XX(r))
#define XX(v)
Definition: matrix1d.h:85
#define YY(v)
Definition: matrix1d.h:93
#define ZZ(v)
Definition: matrix1d.h:101

For all elements in the array between corners.

This macro is used to generate loops for a volume in an easy manner. Then ZZ(r), YY(r) and XX(r) range from

(int) ZZ(corner1) to (int)ZZ(corner2), (int) YY(corner1) to (int)YY(corner2), (int) XX(corner1) to (int) XX(corner2) (included limits) respectively.

Notice that corner1 and corner2 need only be MultidimArray.

MultidimArray< double > corner1(3), corner2(3), r(3);
XX(corner1) = -1; XX(corner2) = 1;
YY(corner1) = -2; YY(corner2) = 2;
ZZ(corner1) = -3; ZZ(corner2) = 3;
{
std::cout << v(r) << " ";
}

Definition at line 445 of file multidim_array_base.h.

◆ FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY1D

#define FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY1D (   v1,
  v2 
)
Value:
ispduptmp4 = XMIPP_MAX(STARTINGX(v1), STARTINGX(v2)); \
ispduptmp5 = XMIPP_MIN(FINISHINGX(v1), FINISHINGX(v2)); \
for (int i=ispduptmp4; i<=ispduptmp5; ++i)
#define XMIPP_MAX(x, y)
Definition: xmipp_macros.h:193
#define FINISHINGX(v)
#define STARTINGX(v)
#define i
double v1
#define XMIPP_MIN(x, y)
Definition: xmipp_macros.h:181

For all elements in common

This macro is used to generate loops for all the elements logically in common between two vectors in an easy manner. Then i (locally defined) ranges from MAX(STARTINGX(V1), STARTINGX(V2)) to MIN(FINISHINGX(V1), FINISHINGX(V2)) (included limits) respectively. You need to define SPEED_UP_temps.

v1.setXmippOrigin();
v2.setXmippOrigin();
{
...
}

Definition at line 575 of file multidim_array_base.h.

◆ FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY2D

#define FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY2D (   m1,
  m2 
)
Value:
ispduptmp2 = XMIPP_MAX(STARTINGY(m1), STARTINGY(m2)); \
ispduptmp3 = XMIPP_MIN(FINISHINGY(m1), FINISHINGY(m2)); \
ispduptmp4 = XMIPP_MAX(STARTINGX(m1), STARTINGX(m2)); \
ispduptmp5 = XMIPP_MIN(FINISHINGX(m1), FINISHINGX(m2)); \
for (int i=ispduptmp2; i<=ispduptmp3; ++i) \
for (int j=ispduptmp4; j<=ispduptmp5; ++j)
#define XMIPP_MAX(x, y)
Definition: xmipp_macros.h:193
#define FINISHINGX(v)
#define STARTINGX(v)
#define i
#define STARTINGY(v)
#define XMIPP_MIN(x, y)
Definition: xmipp_macros.h:181
#define j
#define FINISHINGY(v)

For all elements in common

This macro is used to generate loops for all the elements logically in common between two images in an easy manner. Then i and j (locally defined) range from MAX(STARTINGY(V1), STARTINGY(V2)) to MIN(FINISHINGY(V1), FINISHINGY(V2)), MAX(STARTINGX(V1), STARTINGX(V2)) to MIN(FINISHINGX(V1), FINISHINGX(V2)) (included limits) respectively. You need to define SPEED_UP_temps.

MultidimArray< double > m1(10, 10), m2(20, 20);
m1.setXmippOrigin();
m2.setXmippOrigin();
{
...
}

Definition at line 414 of file multidim_array_base.h.

◆ FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY3D

#define FOR_ALL_ELEMENTS_IN_COMMON_IN_ARRAY3D (   V1,
  V2 
)
Value:
ispduptmp0 = XMIPP_MAX(STARTINGZ(V1), STARTINGZ(V2)); \
ispduptmp1 = XMIPP_MIN(FINISHINGZ(V1),FINISHINGZ(V2)); \
ispduptmp2 = XMIPP_MAX(STARTINGY(V1), STARTINGY(V2)); \
ispduptmp3 = XMIPP_MIN(FINISHINGY(V1),FINISHINGY(V2)); \
ispduptmp4 = XMIPP_MAX(STARTINGX(V1), STARTINGX(V2)); \
ispduptmp5 = XMIPP_MIN(FINISHINGX(V1),FINISHINGX(V2)); \
for (int k=ispduptmp0; k<=ispduptmp1; ++k) \
for (int i=ispduptmp2; i<=ispduptmp3; ++i) \
for (int j=ispduptmp4; j<=ispduptmp5; ++j)
#define XMIPP_MAX(x, y)
Definition: xmipp_macros.h:193
#define FINISHINGX(v)
#define FINISHINGZ(v)
#define STARTINGX(v)
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define STARTINGY(v)
#define XMIPP_MIN(x, y)
Definition: xmipp_macros.h:181
#define j
#define FINISHINGY(v)
#define STARTINGZ(v)

For all elements in common.

This macro is used to generate loops for all the elements logically in common between two volumes in an easy manner. Then k, i and j (locally defined) range from

MAX(STARTINGZ(V1),STARTINGZ(V2)) to MIN(FINISHINGZ(V1),FINISHINGZ(V2)), MAX(STARTINGY(V1),STARTINGY(V2)) to MIN(FINISHINGY(V1),FINISHINGY(V2)), MAX(STARTINGX(V1),STARTINGX(V2)) to MIN(FINISHINGX(V1),FINISHINGX(V2))

(included limits) respectively. You need to define SPEED_UP_temps.

MultidimArray< double > V1(10, 10, 10), V2(20, 20, 20);
V1.setXmippOrigin();
V2.setXmippOrigin();
{
// ...
}

Definition at line 298 of file multidim_array_base.h.

◆ FOR_ALL_NZYX_ELEMENTS_IN_MULTIDIMARRAY

#define FOR_ALL_NZYX_ELEMENTS_IN_MULTIDIMARRAY (   V)
Value:
for (size_t l=0; l<NSIZE(V); ++l) \
for (int k=STARTINGZ(V); k<=FINISHINGZ(V); ++k) \
for (int i=STARTINGY(V); i<=FINISHINGY(V); ++i) \
for (int j=STARTINGX(V); j<=FINISHINGX(V); ++j)
#define NSIZE(v)
#define FINISHINGX(v)
#define FINISHINGZ(v)
#define STARTINGX(v)
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define STARTINGY(v)
#define j
#define FINISHINGY(v)
#define STARTINGZ(v)

For all direct elements in the array

This macro is used to generate loops for the array in an easy manner. It defines internal indexes 'l', 'k','i' and 'j' which ranges over the n volume using its logical definition.

{
std::cout << NZYX_ELEM(v,l, k, i, j) << " ";
}

Definition at line 211 of file multidim_array_base.h.

◆ INSIDEX

#define INSIDEX (   v,
  x 
)    ((x) >= STARTINGX(v) && (x) <= FINISHINGX(v))

Check if x is inside logical bounds

Definition at line 75 of file multidim_array_base.h.

◆ INSIDEXY

#define INSIDEXY (   v,
  x,
  y 
)    (INSIDEX(v, x) && INSIDEY(v, y))

Check if a position x, y is inside the logical index bounds

Definition at line 84 of file multidim_array_base.h.

◆ INSIDEXYZ

#define INSIDEXYZ (   v,
  x,
  y,
  z 
)    (INSIDEX(v, x) && INSIDEY(v, y) && INSIDEZ(v,z))

Check if a position x, y is inside the logical index bounds

Definition at line 87 of file multidim_array_base.h.

◆ INSIDEY

#define INSIDEY (   v,
  y 
)    ((y) >= STARTINGY(v) && (y) <= FINISHINGY(v))

Check if y is inside logical bounds

Definition at line 78 of file multidim_array_base.h.

◆ INSIDEZ

#define INSIDEZ (   v,
  z 
)    ((z) >= STARTINGZ(v) && (z) <= FINISHINGZ(v))

Check if z is inside logical bounds

Definition at line 81 of file multidim_array_base.h.

◆ LOOKUP_TABLE_LEN

#define LOOKUP_TABLE_LEN   6

Definition at line 609 of file multidim_array_base.h.

◆ MULTIDIM_ARRAY

#define MULTIDIM_ARRAY (   v)    ((v).data)

Array access.

This macro gives you access to the array (T **)

Definition at line 126 of file multidim_array_base.h.

◆ MULTIDIM_SIZE

#define MULTIDIM_SIZE (   v)    ((v).nzyxdim)

Access to XYZN dimension (Nsize*Zsize*Ysize*Xsize)

Definition at line 115 of file multidim_array_base.h.

◆ NSIZE

#define NSIZE (   v)    ((v).ndim)

Access to N dimension (size)

Definition at line 103 of file multidim_array_base.h.

◆ NZYX_ELEM

#define NZYX_ELEM (   v,
  l,
  k,
  i,
  j 
)    DIRECT_NZYX_ELEM((v), (l), (k) - STARTINGZ(v), (i) - STARTINGY(v), (j) - STARTINGX(v))

Multidim element: Logical access.

Definition at line 154 of file multidim_array_base.h.

◆ NZYXSIZE

#define NZYXSIZE (   v)    ((v).nzyxdim)

Access to XYZN dimension (Nsize*Zsize*Ysize*Xsize)

Definition at line 119 of file multidim_array_base.h.

◆ OUTSIDE

#define OUTSIDE (   i,
  j 
)
Value:
((j) < STARTINGX(*this) || (j) > FINISHINGX(*this) || \
(i) < STARTINGY(*this) || (i) > FINISHINGY(*this))
#define FINISHINGX(v)
#define STARTINGX(v)
#define i
#define STARTINGY(v)
#define j
#define FINISHINGY(v)

Macro to check whether a point is inside or outside a given matrix.

Definition at line 597 of file multidim_array_base.h.

◆ OUTSIDE3D

#define OUTSIDE3D (   k,
  i,
  j 
)
Value:
((j) < STARTINGX(*this) || (j) > FINISHINGX(*this) || \
(i) < STARTINGY(*this) || (i) > FINISHINGY(*this) || \
(k) < STARTINGZ(*this) || (k) > FINISHINGZ(*this))
#define FINISHINGX(v)
#define FINISHINGZ(v)
#define STARTINGX(v)
#define i
ql0001_ & k(htemp+1),(cvec+1),(atemp+1),(bj+1),(bl+1),(bu+1),(x+1),(clamda+1), &iout, infoqp, &zero,(w+1), &lenw,(iw+1), &leniw, &glob_grd.epsmac
#define STARTINGY(v)
#define j
#define FINISHINGY(v)
#define STARTINGZ(v)

Macro to check whether a point is inside or outside a given matrix.

Definition at line 602 of file multidim_array_base.h.

◆ SAME_SHAPE2D

#define SAME_SHAPE2D (   v1,
  v2 
)
Value:
(XSIZE(v1) == XSIZE(v2) && \
YSIZE(v1) == YSIZE(v2) && \
STARTINGX(v1) == STARTINGX(v2) && \
STARTINGY(v1) == STARTINGY(v2))
#define YSIZE(v)
#define STARTINGX(v)
#define STARTINGY(v)
double v1
#define XSIZE(v)

TRUE if both arrays have the same shape

Two arrays have the same shape if they have the same size and the same starting point. Be aware that this is a macro which simplifies to a boolean.

Definition at line 362 of file multidim_array_base.h.

◆ SAME_SHAPE3D

#define SAME_SHAPE3D (   v1,
  v2 
)
Value:
(XSIZE(v1) == XSIZE(v2) && \
YSIZE(v1) == YSIZE(v2) && \
ZSIZE(v1) == ZSIZE(v2) && \
STARTINGX(v1) == STARTINGX(v2) && \
STARTINGY(v1) == STARTINGY(v2) && \
STARTINGZ(v1) == STARTINGZ(v2))
#define YSIZE(v)
#define STARTINGX(v)
#define STARTINGY(v)
double v1
#define XSIZE(v)
#define ZSIZE(v)
#define STARTINGZ(v)

Definition at line 368 of file multidim_array_base.h.

◆ STARTINGX

#define STARTINGX (   v)    ((v).xinit)

Returns the first X valid logical index

Definition at line 51 of file multidim_array_base.h.

◆ STARTINGY

#define STARTINGY (   v)    ((v).yinit)

Returns the first Y valid logical index

Definition at line 59 of file multidim_array_base.h.

◆ STARTINGZ

#define STARTINGZ (   v)    ((v).zinit)

Returns the first Z valid logical index

Definition at line 67 of file multidim_array_base.h.

◆ XSIZE

#define XSIZE (   v)    ((v).xdim)

Access to X dimension (size)

Definition at line 91 of file multidim_array_base.h.

◆ YSIZE

#define YSIZE (   v)    ((v).ydim)

Access to Y dimension (size)

Definition at line 95 of file multidim_array_base.h.

◆ YXSIZE

#define YXSIZE (   v)    ((v).yxdim)

Access to XY dimension (Ysize*Xsize)

Definition at line 107 of file multidim_array_base.h.

◆ ZSIZE

#define ZSIZE (   v)    ((v).zdim)

Access to Z dimension (size)

Definition at line 99 of file multidim_array_base.h.

◆ ZYXSIZE

#define ZYXSIZE (   v)    ((v).zyxdim)

Access to XYZ dimension (Zsize*Ysize*Xsize)

Definition at line 111 of file multidim_array_base.h.