Classes | |
class | Array< T > |
IDIL Array class. More... | |
Array informations | |
template<class T> | |
long | size (const Array< T > &a) |
Returns the size of the Array (read only). | |
template<class T> | |
long * | dim (const Array< T > &a) |
Returns the dimension of the Array. It can be used in reading or writing mode (take care !). | |
template<class T> | |
Array< T > & | redim (Array< T > &t, Array< long > &d) |
Set the dimension of the array. Should be consistant with the array size. | |
template<class T> | |
ostream & | operator<< (ostream &os, Array< T > &a) |
streaming operator <<. | |
template<class T> | |
Array< T > & | insitu (Array< T > &t) |
Tells IDIL that t can be used to store the results of further computations. | |
template<class T> | |
Array< T > & | exsitu (Array< T > &t) |
Cancels the command insitu. Ex: exsitu(sin(insitu(t))). | |
Search elements | |
Array< long > & | where (const Array< bool > &t) |
Retrun an array of the indices where t is true. Ex: w = where(a==0). | |
template<class T> | |
long | find (const Array< T > &t, T e, long fi=-1) |
Type conversion | |
template<class T, class T2> | |
Array< T > & | conv (Array< T2 > &t) |
Convert numeric or string Array to integer Array. | |
template<class T> | |
Array< T > & | conv (Array< string > &t) |
template<class T> | |
Array< string > & | sconv (Array< T > &t) |
Convert an Array of any type to a string Array. | |
template<class T> | |
Array< T > & | getField (Array< string > &s, int field) |
Build an Array of type T containing only a given field of each original string. | |
#define | iconv conv<int> |
Convert numeric or string Array to integer Array. | |
#define | lconv conv<long> |
Convert numeric or string Array to long int Array. | |
#define | fconv conv<float> |
Convert numeric or string Array to float Array. | |
#define | dconv conv<double> |
Convert numeric or string Array to double float Array. | |
Creation from a list of elements | |
template<class T> | |
Array< T > & | vect (const T &x1) |
Create a vector of size 1. | |
template<class T> | |
Array< T > & | vect (const T &x1, const T &x2) |
Create a vector of size 2. | |
template<class T> | |
Array< T > & | vect (const T &x1, const T &x2, const T &x3) |
Create a vector of size 3. | |
template<class T> | |
Array< T > & | vect (const T &x1, const T &x2, const T &x3, const T &x4) |
Create a vector of size 4. | |
template<class T> | |
Array< T > & | vect (const T &x1, const T &x2, const T &x3, const T &x4, const T &x5) |
Create a vector of size 5. | |
template<class T> | |
Array< T > & | vect (const T &x1, const T &x2, const T &x3, const T &x4, const T &x5, const T &x6) |
Create a vector of size 6. | |
template<class T> | |
Array< T > & | vect (const T &x1, const T &x2, const T &x3, const T &x4, const T &x5, const T &x6, const T &x7) |
Create a vector of size 7. | |
template<class T> | |
Array< T > & | vect (const T &x1, const T &x2, const T &x3, const T &x4, const T &x5, const T &x6, const T &x7, const T &x8) |
Create a vector of size 8. | |
template<class T> | |
Array< T > & | vect (const T &x1, const T &x2, const T &x3, const T &x4, const T &x5, const T &x6, const T &x7, const T &x8, const T &x9) |
Create a vector of size 9. | |
template<class T> | |
Array< T > & | vect (const T &x1, const T &x2, const T &x3, const T &x4, const T &x5, const T &x6, const T &x7, const T &x8, const T &x9, const T &x10) |
Create a vector of size 10. | |
Array< float > & | vect (const float &x1) |
Create a vector of size 1. | |
Array< float > & | vect (const float &x1, const float &x2) |
Create a vector of size 2. | |
Array< float > & | vect (const float &x1, const float &x2, const float &x3) |
Create a vector of size 3. | |
Array< float > & | vect (const float &x1, const float &x2, const float &x3, const float &x4) |
Create a vector of size 4. | |
Array< float > & | vect (const float &x1, const float &x2, const float &x3, const float &x4, const float &x5) |
Create a vector of size 5. | |
Array< float > & | vect (const float &x1, const float &x2, const float &x3, const float &x4, const float &x5, const float &x6) |
Create a vector of size 6. | |
Array< float > & | vect (const float &x1, const float &x2, const float &x3, const float &x4, const float &x5, const float &x6, const float &x7) |
Create a vector of size 7. | |
Array< float > & | vect (const float &x1, const float &x2, const float &x3, const float &x4, const float &x5, const float &x6, const float &x7, const float &x8) |
Create a vector of size 8. | |
Array< float > & | vect (const float &x1, const float &x2, const float &x3, const float &x4, const float &x5, const float &x6, const float &x7, const float &x8, const float &x9) |
Create a vector of size 9. | |
Array< float > & | vect (const float &x1, const float &x2, const float &x3, const float &x4, const float &x5, const float &x6, const float &x7, const float &x8, const float &x9, const float &x10) |
Create a vector of size 10. | |
template<class T> | |
Array< T > & | matrix2x2 (const T &x11, const T &x21, const T &x12, const T &x22) |
Create a matrix 2x2. | |
template<class T> | |
Array< T > & | matrix3x3 (const T &x1, const T &x2, const T &x3, const T &x4, const T &x5, const T &x6, const T &x7, const T &x8, const T &x9) |
Create a matrix 3x3 (C-style index). | |
template<class T> | |
Array< T > & | tensor3x3 (const T &x11, const T &x22, const T &x33, const T &x21=0, const T &x31=0, const T &x32=0) |
Create a symmetric tensor 3x3. | |
template<class T> | |
Array< T > & | rotationMatrix (float wx, float wy, float wz, float ang) |
Data generators | |
template<class T> | |
Array< T > & | indgen (long s) |
The function indgen<type>(s) generates an Array of any nuneric type where the value of each element is its index. | |
Array< int > & | iindgen (long s) |
Generates an Array of integers where the value of each element is its index. | |
Array< long > & | lindgen (long s) |
Generates an Array of long where the value of each element is its index. | |
Array< float > & | findgen (long s) |
Generates an Array of float where the value of each element is its index. | |
Array< double > & | dindgen (long s) |
Generates an Array of double where the value of each element is its index. | |
template<class T> | |
Array< T > & | xgen (long sx, long sy, long sz=1, long sc=1, long st=1) |
The function xgen<type> generates an Array of any nuneric type where the value of each element is its index in the x dimension. | |
template<class T> | |
Array< T > & | ygen (long sx, long sy, long sz=1, long sc=1, long st=1) |
The function ygen<type> generates an Array of any nuneric type where the value of each element is its index in the y dimension. | |
template<class T> | |
Array< T > & | zgen (long sx, long sy, long sz=1, long sc=1, long st=1) |
The function ygen<type> generates an Array of any nuneric type where the value of each element is its index in the z dimension. | |
template<class T2, typename T> | |
Array< T2 > & | xgen (Array< T > &t) |
The function xgen<type> generates, using the dimensions of the array t, an Array of any nuneric type where the value of each element is its index in the x dimension. | |
template<class T2, typename T> | |
Array< T2 > & | ygen (Array< T > &t) |
The function ygen<type> generates, using the dimensions of the array t, an Array of any nuneric type where the value of each element is its index in the y dimension. | |
template<class T2, typename T> | |
Array< T2 > & | zgen (Array< T > &t) |
The function zgen<type> generates, using the dimensions of the array t, an Array of any nuneric type where the value of each element is its index in the z dimension. | |
template<class T, int N> | |
Array< T > & | gen (T e,...) |
Generates an Array containing the N listed elements. | |
Array I/O | |
template<class T> | |
int | idilType () |
template<class T> | |
void | write (string fname, Array< T > &t) |
Save the Array t as an ASCII file (1D). | |
template<> | |
int | idilType< bool > () |
template<> | |
int | idilType< char > () |
template<> | |
int | idilType< unsigned char > () |
template<> | |
int | idilType< short > () |
template<> | |
int | idilType< unsigned short > () |
template<> | |
int | idilType< int > () |
template<> | |
int | idilType< unsigned int > () |
template<> | |
int | idilType< long > () |
template<> | |
int | idilType< unsigned long > () |
template<> | |
int | idilType< float > () |
template<> | |
int | idilType< double > () |
template<class T> | |
void | save (string fname, Array< T > &t, string name="", string comment="") |
Save the Array t using the IDIL binary fileformat (.idil). | |
template<typename T> | |
Array< T > & | load (string fname) |
Load an array using the IDIL binary fileformat (.idil). The type of the array should be known, using load<float>("file.idil"). | |
template<class T> | |
void | write (char *fname, Array< T > &t) |
Save the Array t as an ASCII file (1D). | |
Array< string > & | read (char *fname) |
Read from an ASCII file, and return its content as an Array of string, one string per line on the file. | |
Array< string > & | read (string fname) |
Read from an ASCII file, and return its content as an Array of string, one string per line on the file. | |
Reorder elements | |
template<class T> | |
Array< T > & | sort (Array< T > &t) |
Sort the elements of the Array. | |
template<class T> | |
Array< T > & | randomShuffle (Array< T > &t) |
Randomly re-orders the elements of the Array. | |
template<class T> | |
Array< T > & | shift (Array< T > &t, long s) |
Shift the elements of the Array. | |
template<class T> | |
Array< T > & | shift (Array< T > &t, long sx, long sy) |
Shift the elements of the 2D Array or an image. | |
template<class T> | |
Array< T > & | reverse (Array< T > &t) |
Returns an Array with the elements in reverse order. | |
template<typename T> | |
Array< T > & | transpose (Array< T > &im) |
Transpose a matrix or an image. | |
Add/Remove elements | |
template<class T, class T2> | |
Array< T > & | insertElement (Array< T > &t, long index, T2 value) |
Insert an elements in the Array. | |
template<typename T> | |
Array< T > & | replicate (const Array< T > &t, int n) |
Repeat an array n times. | |
template<class T> | |
Array< T > & | removeElement (Array< T > &t, long index) |
Remove an elements from the Array. If the index does not exist, it returns a copy of the array. | |
template<class T> | |
Array< T > & | removeElements (Array< T > &t, Array< long > &index) |
Remove a list of elements from the Array. | |
template<class T, class T2> | |
Array< T > & | insertRow (Array< T > &t, long index, T2 value) |
Insert a new line in the Array. | |
template<class T, class T2> | |
Array< T > & | insertRow (Array< T > &t, long index, Array< T2 > &value) |
Insert a new row in the Array. | |
template<class T> | |
Array< T > & | removeRow (Array< T > &t, long index) |
Remove a row from a 2D Array. If the line number does not exist, it returns a copy of the array. | |
template<class T> | |
Array< T > & | removeRows (Array< T > &t, Array< long > &index) |
Remove a list of rows from the Array. | |
template<class T, class T2> | |
Array< T > & | insertColumn (Array< T > &t, long index, T2 value) |
Insert a new column in the Array. | |
template<class T, class T2> | |
Array< T > & | insertColumn (Array< T > &t, long index, Array< T2 > &value) |
Insert a new column in the Array. | |
template<class T> | |
Array< T > & | removeColumn (Array< T > &t, long index) |
Remove a columns from a 2D Array. If the line number does not exist, it returns a copy of the array. | |
template<class T> | |
Array< T > & | removeColumns (Array< T > &t, Array< long > &index) |
Remove a list of columns from the Array. |
long find | ( | const Array< T > & | t, | |
T | e, | |||
long | fi = -1 | |||
) | [inline] |
Returns the index if the first occurence of e in the array t.
int idilType | ( | ) | [inline] |
Repeat an array n times.
t | : image Array, | |
n | : repetition number Returns the resulting array. |