34 const uword in_slice1,
35 const uword in_n_rows,
36 const uword in_n_cols,
37 const uword in_n_slices
43 , aux_slice1 (in_slice1)
62 const uword in_slice1,
63 const uword in_n_rows,
64 const uword in_n_cols,
65 const uword in_n_slices
71 , aux_slice1 (in_slice1)
96 for(
uword col = 0; col < local_n_cols; ++col)
105 template<
typename eT>
118 for(
uword col = 0; col < local_n_cols; ++col)
127 template<
typename eT>
140 for(
uword col = 0; col < local_n_cols; ++col)
149 template<
typename eT>
162 for(
uword col = 0; col < local_n_cols; ++col)
171 template<
typename eT>
172 template<
typename T1>
192 for(
uword col = 0; col < t_n_cols; ++col)
201 template<
typename eT>
202 template<
typename T1>
222 for(
uword col = 0; col < t_n_cols; ++col)
231 template<
typename eT>
232 template<
typename T1>
252 for(
uword col = 0; col < t_n_cols; ++col)
261 template<
typename eT>
262 template<
typename T1>
282 for(
uword col = 0; col < t_n_cols; ++col)
291 template<
typename eT>
292 template<
typename T1>
312 for(
uword col = 0; col < t_n_cols; ++col)
322 template<
typename eT>
329 const bool overlap = check_overlap(x_in);
345 for(
uword col = 0; col < t_n_cols; ++col)
353 delete tmp_subview_cube;
361 template<
typename eT>
368 const bool overlap = check_overlap(x_in);
384 for(
uword col = 0; col < t_n_cols; ++col)
392 delete tmp_subview_cube;
400 template<
typename eT>
407 const bool overlap = check_overlap(x_in);
423 for(
uword col = 0; col < t_n_cols; ++col)
431 delete tmp_subview_cube;
439 template<
typename eT>
446 const bool overlap = check_overlap(x_in);
462 for(
uword col = 0; col < t_n_cols; ++col)
470 delete tmp_subview_cube;
478 template<
typename eT>
485 const bool overlap = check_overlap(x_in);
501 for(
uword col = 0; col < t_n_cols; ++col)
509 delete tmp_subview_cube;
517 template<
typename eT>
518 template<
typename T1>
534 const uword x_n_rows = x.n_rows;
535 const uword x_n_cols = x.n_cols;
537 if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1) )
541 for(
uword col = 0; col < t_n_cols; ++col)
547 if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols) )
549 for(
uword i=0; i < t_n_slices; ++i)
555 if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols) )
567 const eT* x_colptr = x.colptr(slice);
570 for(i=0, j=1; j < t_n_cols; i+=2, j+=2)
572 const eT tmp_i = x_colptr[i];
573 const eT tmp_j = x_colptr[j];
575 Q.
at(t_aux_row1, t_aux_col1 + i, mod_slice) = tmp_i;
576 Q.
at(t_aux_row1, t_aux_col1 + j, mod_slice) = tmp_j;
581 Q.
at(t_aux_row1, t_aux_col1 + i, mod_slice) = x_colptr[i];
596 template<
typename eT>
597 template<
typename T1>
613 const uword x_n_rows = x.n_rows;
614 const uword x_n_cols = x.n_cols;
616 if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1) )
618 for(
uword col = 0; col < t_n_cols; ++col)
624 if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols) )
626 for(
uword i=0; i < t_n_slices; ++i)
632 if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols) )
644 const eT* x_colptr = x.colptr(slice);
647 for(i=0, j=1; j < t_n_cols; i+=2, j+=2)
649 const eT tmp_i = x_colptr[i];
650 const eT tmp_j = x_colptr[j];
652 Q.
at(t_aux_row1, t_aux_col1 + i, mod_slice) += tmp_i;
653 Q.
at(t_aux_row1, t_aux_col1 + j, mod_slice) += tmp_j;
658 Q.
at(t_aux_row1, t_aux_col1 + i, mod_slice) += x_colptr[i];
673 template<
typename eT>
674 template<
typename T1>
690 const uword x_n_rows = x.n_rows;
691 const uword x_n_cols = x.n_cols;
693 if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1) )
695 for(
uword col = 0; col < t_n_cols; ++col)
701 if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols) )
703 for(
uword i=0; i < t_n_slices; ++i)
709 if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols) )
721 const eT* x_colptr = x.colptr(slice);
724 for(i=0, j=1; j < t_n_cols; i+=2, j+=2)
726 const eT tmp_i = x_colptr[i];
727 const eT tmp_j = x_colptr[j];
729 Q.
at(t_aux_row1, t_aux_col1 + i, mod_slice) -= tmp_i;
730 Q.
at(t_aux_row1, t_aux_col1 + j, mod_slice) -= tmp_j;
735 Q.
at(t_aux_row1, t_aux_col1 + i, mod_slice) -= x_colptr[i];
750 template<
typename eT>
751 template<
typename T1>
767 const uword x_n_rows = x.n_rows;
768 const uword x_n_cols = x.n_cols;
770 if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1) )
772 for(
uword col = 0; col < t_n_cols; ++col)
778 if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols) )
780 for(
uword i=0; i < t_n_slices; ++i)
786 if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols) )
798 const eT* x_colptr = x.colptr(slice);
801 for(i=0, j=1; j < t_n_cols; i+=2, j+=2)
803 const eT tmp_i = x_colptr[i];
804 const eT tmp_j = x_colptr[j];
806 Q.
at(t_aux_row1, t_aux_col1 + i, mod_slice) *= tmp_i;
807 Q.
at(t_aux_row1, t_aux_col1 + j, mod_slice) *= tmp_j;
812 Q.
at(t_aux_row1, t_aux_col1 + i, mod_slice) *= x_colptr[i];
827 template<
typename eT>
828 template<
typename T1>
844 const uword x_n_rows = x.n_rows;
845 const uword x_n_cols = x.n_cols;
847 if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1) )
849 for(
uword col = 0; col < t_n_cols; ++col)
855 if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols) )
857 for(
uword i=0; i < t_n_slices; ++i)
863 if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols) )
875 const eT* x_colptr = x.colptr(slice);
878 for(i=0, j=1; j < t_n_cols; i+=2, j+=2)
880 const eT tmp_i = x_colptr[i];
881 const eT tmp_j = x_colptr[j];
883 Q.
at(t_aux_row1, t_aux_col1 + i, mod_slice) /= tmp_i;
884 Q.
at(t_aux_row1, t_aux_col1 + j, mod_slice) /= tmp_j;
889 Q.
at(t_aux_row1, t_aux_col1 + i, mod_slice) /= x_colptr[i];
904 template<
typename eT>
917 for(
uword col = 0; col < local_n_cols; ++col)
927 template<
typename eT>
939 template<
typename eT>
951 template<
typename eT>
958 const uword j = i - offset;
963 const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row;
969 template<
typename eT>
976 const uword j = i - offset;
981 const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row;
987 template<
typename eT>
996 const uword j = i - offset;
1001 const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row;
1007 template<
typename eT>
1016 const uword j = i - offset;
1021 const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row;
1022 return m.mem[index];
1027 template<
typename eT>
1034 const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row;
1040 template<
typename eT>
1047 const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row;
1048 return m.mem[index];
1053 template<
typename eT>
1058 const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row;
1064 template<
typename eT>
1069 const uword index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row;
1070 return m.mem[index];
1075 template<
typename eT>
1080 return &
access::rw((*m_ptr).mem[ (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 ]);
1085 template<
typename eT>
1090 return & m.mem[ (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 ];
1095 template<
typename eT>
1115 const uword t_row_end_p1 = t_row_start + t.
n_rows;
1118 const uword t_col_end_p1 = t_col_start + t.
n_cols;
1125 const uword x_row_end_p1 = x_row_start + x.
n_rows;
1128 const uword x_col_end_p1 = x_col_start + x.
n_cols;
1134 const bool outside_rows = ( (x_row_start >= t_row_end_p1 ) || (t_row_start >= x_row_end_p1 ) );
1135 const bool outside_cols = ( (x_col_start >= t_col_end_p1 ) || (t_col_start >= x_col_end_p1 ) );
1136 const bool outside_slices = ( (x_slice_start >= t_slice_end_p1) || (t_slice_start >= x_slice_end_p1) );
1138 return ( (outside_rows ==
false) && (outside_cols ==
false) && (outside_slices ==
false) );
1145 template<
typename eT>
1153 const uword t_aux_slice2_plus_1 = t_aux_slice1 + t.
n_slices;
1171 template<
typename eT>
1200 template<
typename eT>
1225 template<
typename eT>
1250 template<
typename eT>
1275 template<
typename eT>
1300 template<
typename eT>
1315 if(in_n_slices == 1)
1317 out.
set_size(in_n_rows, in_n_cols);
1319 for(
uword col=0; col < in_n_cols; ++col)
1326 if(out_vec_state == 0)
1330 out.
set_size(in_n_rows, in_n_slices);
1332 for(
uword i=0; i < in_n_slices; ++i)
1346 out.
set_size(in_n_cols, in_n_slices);
1350 const uword mod_slice = in_aux_slice1 +
slice;
1352 eT* out_colptr = out.
colptr(slice);
1355 for(i=0, j=1; j < in_n_cols; i+=2, j+=2)
1357 const eT tmp_i = Q.
at(in_aux_row1, in_aux_col1 + i, mod_slice);
1358 const eT tmp_j = Q.
at(in_aux_row1, in_aux_col1 + j, mod_slice);
1360 out_colptr[i] = tmp_i;
1361 out_colptr[j] = tmp_j;
1366 out_colptr[i] = Q.
at(in_aux_row1, in_aux_col1 + i, mod_slice);
1375 eT* out_mem = out.
memptr();
1383 for(
uword i=0; i<in_n_slices; ++i)
1385 out_mem[i] = Q.
at(in_aux_row1, in_aux_col1, in_aux_slice1 + i);
1394 template<
typename eT>
1411 if(in_n_slices == 1)
1413 for(
uword col=0; col < in_n_cols; ++col)
1420 if(out_vec_state == 0)
1422 if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices == out_n_cols) )
1424 for(
uword i=0; i < in_n_slices; ++i)
1430 if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices == out_n_cols) )
1440 const uword mod_slice = in_aux_slice1 +
slice;
1442 eT* out_colptr = out.
colptr(slice);
1445 for(i=0, j=1; j < in_n_cols; i+=2, j+=2)
1447 const eT tmp_i = Q.
at(in_aux_row1, in_aux_col1 + i, mod_slice);
1448 const eT tmp_j = Q.
at(in_aux_row1, in_aux_col1 + j, mod_slice);
1450 out_colptr[i] += tmp_i;
1451 out_colptr[j] += tmp_j;
1456 out_colptr[i] += Q.
at(in_aux_row1, in_aux_col1 + i, mod_slice);
1463 eT* out_mem = out.
memptr();
1471 for(
uword i=0; i<in_n_slices; ++i)
1473 out_mem[i] += Q.
at(in_aux_row1, in_aux_col1, in_aux_slice1 + i);
1482 template<
typename eT>
1499 if(in_n_slices == 1)
1501 for(
uword col=0; col < in_n_cols; ++col)
1508 if(out_vec_state == 0)
1510 if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices == out_n_cols) )
1512 for(
uword i=0; i < in_n_slices; ++i)
1518 if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices == out_n_cols) )
1528 const uword mod_slice = in_aux_slice1 +
slice;
1530 eT* out_colptr = out.
colptr(slice);
1533 for(i=0, j=1; j < in_n_cols; i+=2, j+=2)
1535 const eT tmp_i = Q.
at(in_aux_row1, in_aux_col1 + i, mod_slice);
1536 const eT tmp_j = Q.
at(in_aux_row1, in_aux_col1 + j, mod_slice);
1538 out_colptr[i] -= tmp_i;
1539 out_colptr[j] -= tmp_j;
1544 out_colptr[i] -= Q.
at(in_aux_row1, in_aux_col1 + i, mod_slice);
1551 eT* out_mem = out.
memptr();
1559 for(
uword i=0; i<in_n_slices; ++i)
1561 out_mem[i] -= Q.
at(in_aux_row1, in_aux_col1, in_aux_slice1 + i);
1570 template<
typename eT>
1587 if(in_n_slices == 1)
1589 for(
uword col=0; col < in_n_cols; ++col)
1596 if(out_vec_state == 0)
1598 if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices == out_n_cols) )
1600 for(
uword i=0; i < in_n_slices; ++i)
1606 if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices == out_n_cols) )
1616 const uword mod_slice = in_aux_slice1 +
slice;
1618 eT* out_colptr = out.
colptr(slice);
1621 for(i=0, j=1; j < in_n_cols; i+=2, j+=2)
1623 const eT tmp_i = Q.
at(in_aux_row1, in_aux_col1 + i, mod_slice);
1624 const eT tmp_j = Q.
at(in_aux_row1, in_aux_col1 + j, mod_slice);
1626 out_colptr[i] *= tmp_i;
1627 out_colptr[j] *= tmp_j;
1632 out_colptr[i] *= Q.
at(in_aux_row1, in_aux_col1 + i, mod_slice);
1639 eT* out_mem = out.
memptr();
1647 for(
uword i=0; i<in_n_slices; ++i)
1649 out_mem[i] *= Q.
at(in_aux_row1, in_aux_col1, in_aux_slice1 + i);
1658 template<
typename eT>
1675 if(in_n_slices == 1)
1677 for(
uword col=0; col < in_n_cols; ++col)
1684 if(out_vec_state == 0)
1686 if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices == out_n_cols) )
1688 for(
uword i=0; i < in_n_slices; ++i)
1694 if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices == out_n_cols) )
1704 const uword mod_slice = in_aux_slice1 +
slice;
1706 eT* out_colptr = out.
colptr(slice);
1709 for(i=0, j=1; j < in_n_cols; i+=2, j+=2)
1711 const eT tmp_i = Q.
at(in_aux_row1, in_aux_col1 + i, mod_slice);
1712 const eT tmp_j = Q.
at(in_aux_row1, in_aux_col1 + j, mod_slice);
1714 out_colptr[i] /= tmp_i;
1715 out_colptr[j] /= tmp_j;
1720 out_colptr[i] /= Q.
at(in_aux_row1, in_aux_col1 + i, mod_slice);
1727 eT* out_mem = out.
memptr();
1735 for(
uword i=0; i<in_n_slices; ++i)
1737 out_mem[i] /= Q.
at(in_aux_row1, in_aux_col1, in_aux_slice1 + i);
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 arma_warn_unused eT * memptr()
returns a pointer to array of eTs used by the matrix
#define arma_debug_assert_cube_as_mat
void operator%=(const BaseCube< eT, T1 > &x)
void operator+=(const eT val)
void set_size(const uword in_elem)
change the matrix to have user specified dimensions (data is not preserved)
static void minus_inplace(Cube< eT > &out, const subview_cube &in)
cube X -= Y.subcube(...)
arma_hot static arma_inline void copy(eT *dest, const eT *src, const uword n_elem)
arma_inline const derived & get_ref() const
static arma_hot void inplace_minus(eT *dest, const eT *src, const uword n_elem)
static arma_hot void inplace_mul(eT *dest, const eT *src, const uword n_elem)
void operator*=(const eT val)
const uword n_cols
number of columns in the matrix (read-only)
#define arma_debug_assert_same_size
void operator/=(const eT val)
const uword n_rows
number of rows in the matrix (read-only)
static void extract(Cube< eT > &out, const subview_cube &in)
cube X = Y.subcube(...)
bool check_overlap(const subview_cube &x) const
#define arma_extra_debug_print
arma_inline eT & at(const uword in_row, const uword in_col, const uword in_slice)
arma_inline arma_warn_unused eT * colptr(const uword in_col)
returns a pointer to array of eTs for a specified column; no bounds check
static arma_hot void inplace_plus(eT *dest, const eT *src, const uword n_elem)
void operator=(const BaseCube< eT, T1 > &x)
const uword n_cols
number of columns in each slice (read-only)
eT & operator()(const uword i)
static void plus_inplace(Cube< eT > &out, const subview_cube &in)
cube X += Y.subcube(...)
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 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
std::string arma_cold arma_incompat_size_string(const uword A_n_rows, const uword A_n_cols, const uword B_n_rows, const uword B_n_cols, const char *x)
void arma_cold arma_stop(const T1 &x)
print a message to get_stream_err1() and/or throw a logic_error exception
void operator-=(const eT val)
const Cube & fill(const eT val)
fill the cube with the specified value
static void schur_inplace(Cube< eT > &out, const subview_cube &in)
cube X %= Y.subcube(...)
#define arma_extra_debug_sigprint
Analog of the Base class, intended for cubes.
const uword n_elem
number of elements in the cube (read-only)
arma_aligned Cube< eT > * m_ptr
arma_inline const derived & get_ref() const
eT & operator[](const uword i)
static void div_inplace(Cube< eT > &out, const subview_cube &in)
cube X /= Y.subcube(...)
const uhword vec_state
0: matrix layout; 1: column vector layout; 2: row vector layout
arma_inline eT * slice_colptr(const uword in_slice, const uword in_col)
arma_aligned const Cube< eT > & m
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)
arma_inline arma_warn_unused eT & at(const uword i)
linear element accessor (treats the cube as a vector); no bounds check.