30 #if defined(ARMA_USE_TBB_ALLOC) 31 scalable_free((
void *)(mem));
79 ,
n_elem(in_n_rows*in_n_cols*in_n_slices)
101 ( (
n_rows > 0x0FFF) || (
n_cols > 0x0FFF) || (n_slices > 0xFF) )
105 "Cube::init(): requested size is too large" 116 #if defined(ARMA_USE_TBB_ALLOC) 143 template<
typename eT>
157 bool err_state =
false;
165 "Cube::init(): size is fixed and hence cannot be changed" 173 ( (in_n_rows > 0x0FFF) || (in_n_cols > 0x0FFF) || (in_n_slices > 0xFF) )
174 ? ( (
float(in_n_rows) *
float(in_n_cols) *
float(in_n_slices)) >
float(
ARMA_MAX_UWORD) )
177 "Cube::init(): requested size is too large" 183 const uword new_n_elem = in_n_rows * in_n_cols * in_n_slices;
185 if(old_n_elem == new_n_elem)
201 arma_debug_check( (t_mem_state == 2),
"Cube::init(): requested size is not compatible with the size of auxiliary memory" );
211 #if defined(ARMA_USE_TBB_ALLOC) 212 scalable_free((
void *)(
mem));
229 #if defined(ARMA_USE_TBB_ALLOC) 230 access::rw(
mem) = (eT *)scalable_malloc(
sizeof(eT)*new_n_elem);
264 template<
typename eT>
265 template<
typename T1,
typename T2>
276 typedef typename T1::elem_type T;
290 init_warm(X.get_n_rows(), X.get_n_cols(), X.get_n_slices());
294 ea_type1 PX = X.get_ea();
295 ea_type2 PY = Y.get_ea();
297 for(
uword i=0; i<N; ++i)
299 out_mem[i] = std::complex<T>(PX[i], PY[i]);
307 template<
typename eT>
338 for(
uword i=0; i < x_n_slices; ++i)
354 (*this).operator=(x);
361 template<
typename eT>
384 template<
typename eT>
415 template<
typename eT>
430 template<
typename eT>
445 template<
typename eT>
460 template<
typename eT>
475 template<
typename eT>
490 template<
typename eT>
513 template<
typename eT>
538 template<
typename eT>
545 ,
n_elem ( aux_n_rows*aux_n_cols*aux_n_slices )
546 ,
mem_state ( copy_aux_mem ? 0 : (strict ? 2 : 1) )
548 ,
mem ( copy_aux_mem ? 0 : aux_mem )
552 if(copy_aux_mem ==
true)
568 template<
typename eT>
575 ,
n_elem(aux_n_rows*aux_n_cols*aux_n_slices)
590 template<
typename eT>
607 template<
typename eT>
624 template<
typename eT>
641 template<
typename eT>
658 template<
typename eT>
659 template<
typename T1,
typename T2>
683 template<
typename eT>
705 template<
typename eT>
712 const bool alias = (
this == &(X.
m));
733 template<
typename eT>
748 template<
typename eT>
763 template<
typename eT>
778 template<
typename eT>
793 template<
typename eT>
803 "Cube::slice(): index out of bounds" 812 template<
typename eT>
822 "Cube::slice(): index out of bounds" 831 template<
typename eT>
840 (in_slice1 > in_slice2) || (in_slice2 >=
n_slices),
841 "Cube::slices(): indices out of bounds or incorrectly used" 844 const uword subcube_n_slices = in_slice2 - in_slice1 + 1;
852 template<
typename eT>
861 (in_slice1 > in_slice2) || (in_slice2 >=
n_slices),
862 "Cube::rows(): indices out of bounds or incorrectly used" 865 const uword subcube_n_slices = in_slice2 - in_slice1 + 1;
873 template<
typename eT>
882 (in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2) ||
884 "Cube::subcube(): indices out of bounds or incorrectly used" 887 const uword subcube_n_rows = in_row2 - in_row1 + 1;
888 const uword subcube_n_cols = in_col2 - in_col1 + 1;
889 const uword subcube_n_slices = in_slice2 - in_slice1 + 1;
891 return subview_cube<eT>(*
this, in_row1, in_col1, in_slice1, subcube_n_rows, subcube_n_cols, subcube_n_slices);
897 template<
typename eT>
906 (in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2) ||
908 "Cube::subcube(): indices out of bounds or incorrectly used" 911 const uword subcube_n_rows = in_row2 - in_row1 + 1;
912 const uword subcube_n_cols = in_col2 - in_col1 + 1;
913 const uword subcube_n_slices = in_slice2 - in_slice1 + 1;
915 return subview_cube<eT>(*
this, in_row1, in_col1, in_slice1, subcube_n_rows, subcube_n_cols, subcube_n_slices);
921 template<
typename eT>
928 const bool row_all = row_span.
whole;
929 const bool col_all = col_span.
whole;
930 const bool slice_all = slice_span.
whole;
936 const uword in_row1 = row_all ? 0 : row_span.
a;
937 const uword in_row2 = row_span.
b;
938 const uword subcube_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
940 const uword in_col1 = col_all ? 0 : col_span.
a;
941 const uword in_col2 = col_span.
b;
942 const uword subcube_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1;
944 const uword in_slice1 = slice_all ? 0 : slice_span.
a;
945 const uword in_slice2 = slice_span.
b;
946 const uword subcube_n_slices = slice_all ? local_n_slices : in_slice2 - in_slice1 + 1;
950 ( row_all ?
false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) )
952 ( col_all ?
false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) )
954 ( slice_all ?
false : ((in_slice1 > in_slice2) || (in_slice2 >= local_n_slices)) )
956 "Cube::subcube(): indices out of bounds or incorrectly used" 959 return subview_cube<eT>(*
this, in_row1, in_col1, in_slice1, subcube_n_rows, subcube_n_cols, subcube_n_slices);
965 template<
typename eT>
972 const bool row_all = row_span.
whole;
973 const bool col_all = col_span.
whole;
974 const bool slice_all = slice_span.
whole;
980 const uword in_row1 = row_all ? 0 : row_span.
a;
981 const uword in_row2 = row_span.
b;
982 const uword subcube_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
984 const uword in_col1 = col_all ? 0 : col_span.
a;
985 const uword in_col2 = col_span.
b;
986 const uword subcube_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1;
988 const uword in_slice1 = slice_all ? 0 : slice_span.
a;
989 const uword in_slice2 = slice_span.
b;
990 const uword subcube_n_slices = slice_all ? local_n_slices : in_slice2 - in_slice1 + 1;
994 ( row_all ?
false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) )
996 ( col_all ?
false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) )
998 ( slice_all ?
false : ((in_slice1 > in_slice2) || (in_slice2 >= local_n_slices)) )
1000 "Cube::subcube(): indices out of bounds or incorrectly used" 1003 return subview_cube<eT>(*
this, in_row1, in_col1, in_slice1, subcube_n_rows, subcube_n_cols, subcube_n_slices);
1008 template<
typename eT>
1015 return (*this).subcube(row_span, col_span, slice_span);
1020 template<
typename eT>
1027 return (*this).subcube(row_span, col_span, slice_span);
1033 template<
typename eT>
1048 template<
typename eT>
1057 (in_slice1 > in_slice2) || (in_slice2 >=
n_slices),
1058 "Cube::shed_slices(): indices out of bounds or incorrectly used" 1061 const uword n_keep_front = in_slice1;
1066 if(n_keep_front > 0)
1068 X.slices( 0, (n_keep_front-1) ) =
slices( 0, (in_slice1-1) );
1073 X.slices( n_keep_front, (n_keep_front+n_keep_back-1) ) =
slices( (in_slice2+1), (
n_slices-1) );
1083 template<
typename eT>
1092 const uword A_n_slices = slice_num;
1093 const uword B_n_slices = t_n_slices - slice_num;
1096 arma_debug_check( (slice_num > t_n_slices),
"Cube::insert_slices(): out of bounds");
1109 out.
slices(slice_num + N, t_n_slices + N - 1) =
slices(slice_num, t_n_slices-1);
1112 if(set_to_zero ==
true)
1116 for(
uword i=slice_num; i < (slice_num + N); ++i)
1118 out.
slice(i).zeros();
1130 template<
typename eT>
1131 template<
typename T1>
1141 const uword N = C.n_slices;
1145 const uword A_n_slices = slice_num;
1146 const uword B_n_slices = t_n_slices - slice_num;
1149 arma_debug_check( (slice_num > t_n_slices),
"Cube::insert_slices(): out of bounds");
1154 "Cube::insert_slices(): given object has an incompatible dimensions" 1168 out.
slices(slice_num + N, t_n_slices + N - 1) =
slices(slice_num, t_n_slices - 1);
1171 out.
slices(slice_num, slice_num + N - 1) = C;
1180 template<
typename eT>
1181 template<
typename gen_type>
1202 template<
typename eT>
1203 template<
typename gen_type>
1219 template<
typename eT>
1220 template<
typename gen_type>
1234 template<
typename eT>
1235 template<
typename gen_type>
1249 template<
typename eT>
1250 template<
typename gen_type>
1264 template<
typename eT>
1265 template<
typename gen_type>
1280 template<
typename eT>
1281 template<
typename T1,
typename op_type>
1297 op_type::apply(*
this, X);
1303 template<
typename eT>
1304 template<
typename T1,
typename op_type>
1313 op_type::apply(*
this, X);
1321 template<
typename eT>
1322 template<
typename T1,
typename op_type>
1333 return (*this).operator+=(m);
1339 template<
typename eT>
1340 template<
typename T1,
typename op_type>
1351 return (*this).operator-=(m);
1357 template<
typename eT>
1358 template<
typename T1,
typename op_type>
1369 return (*this).operator%=(m);
1375 template<
typename eT>
1376 template<
typename T1,
typename op_type>
1387 return (*this).operator/=(m);
1393 template<
typename eT>
1394 template<
typename T1,
typename eop_type>
1412 eop_type::apply(*
this, X);
1418 template<
typename eT>
1419 template<
typename T1,
typename eop_type>
1428 const bool bad_alias = ( X.
P.has_subview && X.
P.is_alias(*
this) );
1430 if(bad_alias ==
false)
1434 eop_type::apply(*
this, X);
1449 template<
typename eT>
1450 template<
typename T1,
typename eop_type>
1459 eop_type::apply_inplace_plus(*
this, X);
1467 template<
typename eT>
1468 template<
typename T1,
typename eop_type>
1477 eop_type::apply_inplace_minus(*
this, X);
1485 template<
typename eT>
1486 template<
typename T1,
typename eop_type>
1495 eop_type::apply_inplace_schur(*
this, X);
1503 template<
typename eT>
1504 template<
typename T1,
typename eop_type>
1513 eop_type::apply_inplace_div(*
this, X);
1521 template<
typename eT>
1522 template<
typename T1,
typename op_type>
1536 op_type::apply(*
this, X);
1542 template<
typename eT>
1543 template<
typename T1,
typename op_type>
1550 op_type::apply(*
this, X);
1558 template<
typename eT>
1559 template<
typename T1,
typename op_type>
1568 return (*this).operator+=(m);
1574 template<
typename eT>
1575 template<
typename T1,
typename op_type>
1584 return (*this).operator-=(m);
1590 template<
typename eT>
1591 template<
typename T1,
typename op_type>
1600 return (*this).operator%=(m);
1606 template<
typename eT>
1607 template<
typename T1,
typename op_type>
1616 return (*this).operator/=(m);
1622 template<
typename eT>
1623 template<
typename T1,
typename T2,
typename glue_type>
1642 template<
typename eT>
1643 template<
typename T1,
typename T2,
typename glue_type>
1653 glue_type::apply(*
this, X);
1660 template<
typename eT>
1661 template<
typename T1,
typename T2,
typename glue_type>
1673 return (*this).operator+=(m);
1679 template<
typename eT>
1680 template<
typename T1,
typename T2,
typename glue_type>
1692 return (*this).operator-=(m);
1698 template<
typename eT>
1699 template<
typename T1,
typename T2,
typename glue_type>
1711 return (*this).operator%=(m);
1717 template<
typename eT>
1718 template<
typename T1,
typename T2,
typename glue_type>
1730 return (*this).operator/=(m);
1736 template<
typename eT>
1737 template<
typename T1,
typename T2,
typename eglue_type>
1756 eglue_type::apply(*
this, X);
1762 template<
typename eT>
1763 template<
typename T1,
typename T2,
typename eglue_type>
1773 const bool bad_alias = ( (X.
P1.has_subview && X.
P1.is_alias(*
this)) || (X.
P2.has_subview && X.
P2.is_alias(*
this)) );
1775 if(bad_alias ==
false)
1779 eglue_type::apply(*
this, X);
1794 template<
typename eT>
1795 template<
typename T1,
typename T2,
typename eglue_type>
1805 eglue_type::apply_inplace_plus(*
this, X);
1813 template<
typename eT>
1814 template<
typename T1,
typename T2,
typename eglue_type>
1824 eglue_type::apply_inplace_minus(*
this, X);
1832 template<
typename eT>
1833 template<
typename T1,
typename T2,
typename eglue_type>
1843 eglue_type::apply_inplace_schur(*
this, X);
1851 template<
typename eT>
1852 template<
typename T1,
typename T2,
typename eglue_type>
1862 eglue_type::apply_inplace_div(*
this, X);
1870 template<
typename eT>
1871 template<
typename T1,
typename T2,
typename glue_type>
1885 glue_type::apply(*
this, X);
1891 template<
typename eT>
1892 template<
typename T1,
typename T2,
typename glue_type>
1899 glue_type::apply(*
this, X);
1907 template<
typename eT>
1908 template<
typename T1,
typename T2,
typename glue_type>
1917 return (*this).operator+=(m);
1923 template<
typename eT>
1924 template<
typename T1,
typename T2,
typename glue_type>
1933 return (*this).operator-=(m);
1939 template<
typename eT>
1940 template<
typename T1,
typename T2,
typename glue_type>
1949 return (*this).operator%=(m);
1955 template<
typename eT>
1956 template<
typename T1,
typename T2,
typename glue_type>
1965 return (*this).operator/=(m);
1971 template<
typename eT>
1984 template<
typename eT>
1996 template<
typename eT>
2008 template<
typename eT>
2020 template<
typename eT>
2032 template<
typename eT>
2044 template<
typename eT>
2056 "Cube::operator(): index out of bounds" 2065 template<
typename eT>
2077 "Cube::operator(): index out of bounds" 2086 template<
typename eT>
2098 template<
typename eT>
2110 template<
typename eT>
2122 template<
typename eT>
2133 template<
typename eT>
2145 template<
typename eT>
2156 template<
typename eT>
2168 template<
typename eT>
2180 template<
typename eT>
2192 template<
typename eT>
2209 return ( (a <= b) && (b <
n_elem) );
2216 template<
typename eT>
2227 template<
typename eT>
2235 const uword in_row1 = row_span.
a;
2236 const uword in_row2 = row_span.
b;
2238 const uword in_col1 = col_span.
a;
2239 const uword in_col2 = col_span.
b;
2241 const uword in_slice1 = slice_span.
a;
2242 const uword in_slice2 = slice_span.
b;
2245 const bool rows_ok = row_span.
whole ?
true : ( (in_row1 <= in_row2) && (in_row2 <
n_rows) );
2246 const bool cols_ok = col_span.
whole ?
true : ( (in_col1 <= in_col2) && (in_col2 <
n_cols) );
2247 const bool slices_ok = slice_span.
whole ?
true : ( (in_slice1 <= in_slice2) && (in_slice2 <
n_slices) );
2250 return ( (rows_ok ==
true) && (cols_ok ==
true) && (slices_ok ==
true) );
2256 template<
typename eT>
2262 return const_cast<eT*
>(
mem);
2268 template<
typename eT>
2280 template<
typename eT>
2292 template<
typename eT>
2304 template<
typename eT>
2316 template<
typename eT>
2331 template<
typename eT>
2338 if(extra_text.length() != 0)
2340 cout << extra_text <<
'\n';
2351 template<
typename eT>
2358 if(extra_text.length() != 0)
2360 user_stream << extra_text <<
'\n';
2372 template<
typename eT>
2379 if(extra_text.length() != 0)
2381 cout << extra_text <<
'\n';
2393 template<
typename eT>
2400 if(extra_text.length() != 0)
2402 user_stream << extra_text <<
'\n';
2411 template<
typename eT>
2418 init_warm(in_n_rows, in_n_cols, in_n_slices);
2424 template<
typename eT>
2431 *
this =
arma::reshape(*
this, in_rows, in_cols, in_slices, dim);
2437 template<
typename eT>
2444 *
this =
arma::resize(*
this, in_rows, in_cols, in_slices);
2450 template<
typename eT>
2451 template<
typename eT2>
2464 template<
typename eT>
2478 template<
typename eT>
2485 return (*this).fill(eT(0));
2490 template<
typename eT>
2497 set_size(in_rows, in_cols, in_slices);
2499 return (*this).fill(eT(0));
2504 template<
typename eT>
2511 return (*this).fill(eT(1));
2516 template<
typename eT>
2523 set_size(in_rows, in_cols, in_slices);
2525 return (*this).fill(eT(1));
2530 template<
typename eT>
2542 for(i=0, j=1; j<N; i+=2, j+=2)
2558 template<
typename eT>
2565 set_size(in_rows, in_cols, in_slices);
2567 return (*this).randu();
2572 template<
typename eT>
2582 for(
uword i=0; i<N; ++i)
2592 template<
typename eT>
2599 set_size(in_rows, in_cols, in_slices);
2601 return (*this).randn();
2606 template<
typename eT>
2618 template<
typename eT>
2619 template<
typename T1>
2631 template<
typename eT>
2632 template<
typename T1>
2644 template<
typename eT>
2659 template<
typename eT>
2674 template<
typename eT>
2688 template<
typename eT>
2702 template<
typename eT>
2717 const uword j = i - offset;
2719 row_of_min_val = j %
n_rows;
2720 col_of_min_val = j /
n_rows;
2721 slice_of_min_val = in_slice;
2728 template<
typename eT>
2743 const uword j = i - offset;
2745 row_of_max_val = j %
n_rows;
2746 col_of_max_val = j /
n_rows;
2747 slice_of_max_val = in_slice;
2755 template<
typename eT>
2787 arma_warn(print_status,
"Cube::save(): unsupported file type");
2791 arma_warn( (print_status && (save_okay ==
false)),
"Cube::save(): couldn't write to ", name);
2799 template<
typename eT>
2831 arma_warn(print_status,
"Cube::save(): unsupported file type");
2835 arma_warn( (print_status && (save_okay ==
false)),
"Cube::save(): couldn't write to given stream");
2843 template<
typename eT>
2851 std::string err_msg;
2880 arma_warn(print_status,
"Cube::load(): unsupported file type");
2884 if( (print_status ==
true) && (load_okay ==
false) )
2886 if(err_msg.length() > 0)
2888 arma_warn(
true,
"Cube::load(): ", err_msg, name);
2892 arma_warn(
true,
"Cube::load(): couldn't read ", name);
2896 if(load_okay ==
false)
2907 template<
typename eT>
2915 std::string err_msg;
2944 arma_warn(print_status,
"Cube::load(): unsupported file type");
2949 if( (print_status ==
true) && (load_okay ==
false) )
2951 if(err_msg.length() > 0)
2953 arma_warn(
true,
"Cube::load(): ", err_msg,
"the given stream");
2957 arma_warn(
true,
"Cube::load(): couldn't load from the given stream");
2961 if(load_okay ==
false)
2972 template<
typename eT>
2979 return (*this).save(name, type,
false);
2985 template<
typename eT>
2992 return (*this).save(os, type,
false);
2998 template<
typename eT>
3005 return (*this).load(name, type,
false);
3011 template<
typename eT>
3018 return (*this).load(is, type,
false);
3023 template<
typename eT>
3035 template<
typename eT>
3047 template<
typename eT>
3059 template<
typename eT>
3071 template<
typename eT>
3085 template<
typename eT>
3099 template<
typename eT>
3113 template<
typename eT>
3127 template<
typename eT>
3128 template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
3135 if(fixed_n_elem > 0)
3165 template<
typename eT>
3175 for(i=0, j=1; j<
n_elem; i+=2, j+=2)
3190 template<
typename T>
3201 template<
typename eT>
3211 for(i=0, j=1; j<
n_elem; i+=2, j+=2)
3226 template<
typename T>
3237 template<
typename eT>
3247 for(i=0, j=1; j<
n_elem; i+=2, j+=2)
3262 template<
typename T>
3273 template<
typename eT>
3283 for(i=0, j=1; j<
n_elem; i+=2, j+=2)
3298 template<
typename T>
3308 template<
typename eT,
typename T1>
3325 template<
typename eT,
typename T1>
3335 template<
typename T,
typename T1>
3342 typedef typename std::complex<T> eT;
3349 out.n_rows, out.n_cols, out.n_slices,
3350 A.get_n_rows(), A.get_n_cols(), A.get_n_slices(),
3355 eT* out_mem = out.memptr();
3356 ea_type PA = A.get_ea();
3361 out_mem[i] = std::complex<T>( PA[i], out_mem[i].imag() );
3367 template<
typename T,
typename T1>
3374 typedef typename std::complex<T> eT;
3381 out.n_rows, out.n_cols, out.n_slices,
3382 A.get_n_rows(), A.get_n_cols(), A.get_n_slices(),
3387 eT* out_mem = out.memptr();
3388 ea_type PA = A.get_ea();
3393 out_mem[i] = std::complex<T>( out_mem[i].real(), PA[i] );
3399 #ifdef ARMA_EXTRA_CUBE_MEAT 3400 #include ARMA_INCFILE_WRAP(ARMA_EXTRA_CUBE_MEAT) Portable Pixel Map (colour image), used by the field and cube classes.
support class for generator functions (eg. zeros, randu, randn, ...)
static bool save_raw_binary(const Mat< eT > &x, const std::string &final_name)
Save a matrix as raw binary (no header)
static arma_inline void prefix_mm(Cube< eT > &x)
prefix –
arma_inline arma_warn_unused eT * slice_colptr(const uword in_slice, const uword in_col)
returns a pointer to array of eTs used by the specified slice in the cube
arma_inline uword get_n_cols() const
arma_inline arma_warn_unused eT * slice_memptr(const uword slice)
returns a pointer to array of eTs used by the specified slice in the cube
arma_inline subview_cube< eT > slices(const uword in_slice1, const uword in_slice2)
creation of subview_cube (subcube comprised of specified slices)
slice_iterator end_slice(const uword slice_num)
void set_imag(const BaseCube< pod_type, T1 > &X)
static void minus_inplace(Cube< eT > &out, const subview_cube &in)
cube X -= Y.subcube(...)
static bool load_arma_binary(Mat< eT > &x, const std::string &name, std::string &err_msg)
arma_hot static arma_inline void copy(eT *dest, const eT *src, const uword n_elem)
arma_aligned const uword n_cols
arma_inline subview_cube< eT > subcube(const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_row2, const uword in_col2, const uword in_slice2)
creation of subview_cube (generic subcube)
arma_warn_unused eT min() const
void shed_slices(const uword in_slice1, const uword in_slice2)
remove specified slices
arma_inline const Cube & operator++()
prefix ++
static arma_hot void inplace_minus(eT *dest, const eT *src, const uword n_elem)
static arma_inline void postfix_mm(Cube< eT > &x)
postfix –
void arma_hot arma_check_bad_alloc(const bool state, const T1 &x)
arma_inline uword get_n_slices() const
subview_cube< eT > operator()(const span &row_span, const span &col_span, const span &slice_span)
void impl_print(const std::string &extra_text) const
static arma_hot void inplace_mul(eT *dest, const eT *src, const uword n_elem)
#define arma_debug_set_error
arma_inline arma_warn_unused bool is_finite() const
returns true if all of the elements are finite
arma_aligned const Mat< eT > **const mat_ptrs
pointer to an array containing pointers to Mat instances (one for each slice)
void set_size(const uword in_rows, const uword in_cols, const uword in_slices)
change the cube to have user specified dimensions (data is not preserved)
static eT direct_min(const eT *const X, const uword N)
#define arma_debug_assert_same_size
static arma_inline void postfix_pp(Cube< eT > &x)
postfix ++
static arma_inline void prefix_pp(Cube< eT > &x)
prefix ++
static void extract(Cube< eT > &out, const subview_cube &in)
cube X = Y.subcube(...)
arma_aligned const uword n_slices
arma_inline uword get_n_slices() const
arma_inline const Cube & operator-=(const eT val)
In-place subtraction of a scalar from all elements of the cube.
void arma_hot arma_assert_same_size(const uword A_n_rows, const uword A_n_cols, const uword B_n_rows, const uword B_n_cols, const char *x)
#define arma_extra_debug_print
arma_inline arma_warn_unused bool in_range(const uword i) const
returns true if the given index is currently in range
void resize(const uword in_rows, const uword in_cols, const uword in_slices)
change the cube to have user specified dimensions (data is preserved)
arma_aligned Mat< eT > * mat_ptrs_local[Cube_prealloc::mat_ptrs_size]
void reshape(const uword in_rows, const uword in_cols, const uword in_slices, const uword dim=0)
change the cube to have user specified dimensions (data is preserved)
static arma_hot void inplace_plus(eT *dest, const eT *src, const uword n_elem)
#define arma_type_check(condition)
bool save(const std::string name, const file_type type=arma_binary, const bool print_status=true) const
save the cube to a file
arma_inline arma_warn_unused eT * memptr()
returns a pointer to array of eTs used by the cube
const uword n_cols
number of columns in each slice (read-only)
void set_real(const BaseCube< pod_type, T1 > &X)
static bool save_ppm_binary(const Cube< T1 > &x, const std::string &final_name)
static void plus_inplace(Cube< eT > &out, const subview_cube &in)
cube X += Y.subcube(...)
const Op< T1, op_reshape > reshape(const Base< typename T1::elem_type, T1 > &X, const uword in_n_rows, const uword in_n_cols, const uword dim=0)
static bool load_ppm_binary(Cube< T1 > &x, const std::string &final_name, std::string &err_msg)
static void print(std::ostream &o, const Mat< eT > &m, const bool modify)
Print a matrix to the specified stream.
static arma_inline T1 & rw(const T1 &x)
internal function to allow modification of data declared as read-only
static arma_hot void inplace_div(eT *dest, const eT *src, const uword n_elem)
static bool load_raw_binary(Mat< eT > &x, const std::string &name, std::string &err_msg)
static void set_real(Cube< eT > &out, const BaseCube< eT, T1 > &X)
static const uword mat_ptrs_size
arma_inline arma_warn_unused eT & operator[](const uword i)
linear element accessor (treats the cube as a vector); no bounds check.
void insert_slices(const uword slice_num, const uword N, const bool set_to_zero=true)
static arma_hot void inplace_set(eT *dest, const eT val, const uword n_elem)
arma_inline Mat< eT > & slice(const uword in_slice)
provide the reference to the matrix representing a single slice
arma_inline uword get_n_rows() const
arma_inline uword get_n_cols() const
static const uword mem_n_elem
#define arma_extra_debug_sigprint_this
void init(const BaseCube< pod_type, T1 > &A, const BaseCube< pod_type, T2 > &B)
Armadillo binary format, with information about matrix type and size.
static bool load_auto_detect(Mat< eT > &x, const std::string &name, std::string &err_msg)
Try to load a matrix by automatically determining its type.
void impl_raw_print(const std::string &extra_text) const
arma_inline const Cube & operator+=(const eT val)
In-place addition of a scalar to all elements of the cube.
static bool save_raw_ascii(const Mat< eT > &x, const std::string &final_name)
arma_aligned const eT *const mem
pointer to the memory used by the cube (memory is read-only)
static bool load_raw_ascii(Mat< eT > &x, const std::string &name, std::string &err_msg)
const Cube & fill(const eT val)
fill the cube with the specified value
void init_warm(const uword in_rows, const uword in_cols, const uword in_slices)
arma_warn_unused eT max() const
arma_inline const Cube & operator*=(const eT val)
In-place multiplication of all elements of the cube with a scalar.
void apply_inplace_minus(Cube< eT > &out) const
static void schur_inplace(Cube< eT > &out, const subview_cube &in)
cube X %= Y.subcube(...)
arma_aligned const ProxyCube< T1 > P
#define arma_extra_debug_sigprint
arma_inline uword get_n_rows() const
void apply_inplace_plus(Cube< eT > &out) const
arma_inline const Cube & operator--()
prefix –
void shed_slice(const uword slice_num)
remove specified slice
arma_inline arma_warn_unused bool is_empty() const
returns true if the cube has no elements
Analog of the Op class, intended for cubes.
Analog of the Base class, intended for cubes.
arma_aligned const ProxyCube< T2 > P2
void copy_size(const Cube< eT2 > &m)
change the cube (without preserving data) to have the same dimensions as the given cube ...
void apply_inplace_schur(Cube< eT > &out) const
ASCII format (text), without any other information.
static eT direct_max(const eT *const X, const uword N)
raw binary format, without any other information.
bool quiet_load(const std::string name, const file_type type=auto_detect)
load a cube from a file, without printing any error messages
void arma_cold arma_warn(const bool state, const T1 &x)
print a message to the warn stream
static bool load_arma_ascii(Mat< eT > &x, const std::string &name, std::string &err_msg)
static bool save_arma_ascii(const Mat< eT > &x, const std::string &final_name)
const uword n_elem
number of elements in the cube (read-only)
bool load(const std::string name, const file_type type=auto_detect, const bool print_status=true)
load a cube from a file
static void set_imag(Cube< eT > &out, const BaseCube< eT, T1 > &X)
void apply(Cube< eT > &out) const
const eT * const_iterator
arma_inline const derived & get_ref() const
arma_aligned eT mem_local[Cube_prealloc::mem_n_elem]
const eT * const_slice_iterator
arma_inline const Cube & operator/=(const eT val)
In-place division of all elements of the cube with a scalar.
bool quiet_save(const std::string name, const file_type type=arma_binary) const
save the cube to a file, without printing any error messages
arma_hot static arma_pure bool is_finite(const eT *src, const uword n_elem)
arma_aligned const ProxyCube< T1 > P1
arma_aligned const uword n_rows
static void div_inplace(Cube< eT > &out, const subview_cube &in)
cube X /= Y.subcube(...)
const Cube & operator%=(const Cube &m)
in-place element-wise cube multiplication
Armadillo ASCII format (text), with information about matrix type and size.
void apply_inplace_div(Cube< eT > &out) const
arma_aligned const Cube< eT > & m
arma_inline const Cube & operator=(const eT val)
analog of the Glue class, intended for Cube objects
Automatically detect the file type (file must be one of the following types)
static bool save_arma_binary(const Mat< eT > &x, const std::string &final_name)
const uword n_slices
number of slices in the cube (read-only)
const uword n_elem_slice
DEPRECATED: do not use this member variable – it will be removed in version 3.0. ...
const uword n_rows
number of rows in each slice (read-only)
slice_iterator begin_slice(const uword slice_num)
get_pod_type< eT >::result pod_type
if eT is non-complex, pod_type is same as eT. otherwise, pod_type is the underlying type used by std:...
arma_inline arma_warn_unused eT & at(const uword i)
linear element accessor (treats the cube as a vector); no bounds check.
const Op< T1, op_resize > resize(const Base< typename T1::elem_type, T1 > &X, const uword in_n_rows, const uword in_n_cols)