23 template<
typename eT,
typename T1>
38 if( (N <= 4) && (slow ==
false) )
43 if( (N > 4) || (status ==
false) )
66 if( (N <= 4) && (slow ==
false) )
71 if( (N > 4) || (status ==
false) )
97 out[0] = eT(1) / X[0];
103 const eT* Xm = X.
memptr();
110 const eT tmp_det = (a*d - b*c);
130 const eT* X_col0 = X.
colptr(0);
131 const eT a11 = X_col0[0];
132 const eT a21 = X_col0[1];
133 const eT a31 = X_col0[2];
135 const eT* X_col1 = X.
colptr(1);
136 const eT a12 = X_col1[0];
137 const eT a22 = X_col1[1];
138 const eT a32 = X_col1[2];
140 const eT* X_col2 = X.
colptr(2);
141 const eT a13 = X_col2[0];
142 const eT a23 = X_col2[1];
143 const eT a33 = X_col2[2];
145 const eT tmp_det = a11*(a33*a22 - a32*a23) - a21*(a33*a12-a32*a13) + a31*(a23*a12 - a22*a13);
149 eT* out_col0 = out.
colptr(0);
150 out_col0[0] = (a33*a22 - a32*a23) / tmp_det;
151 out_col0[1] = -(a33*a21 - a31*a23) / tmp_det;
152 out_col0[2] = (a32*a21 - a31*a22) / tmp_det;
154 eT* out_col1 = out.
colptr(1);
155 out_col1[0] = -(a33*a12 - a32*a13) / tmp_det;
156 out_col1[1] = (a33*a11 - a31*a13) / tmp_det;
157 out_col1[2] = -(a32*a11 - a31*a12) / tmp_det;
159 eT* out_col2 = out.
colptr(2);
160 out_col2[0] = (a23*a12 - a22*a13) / tmp_det;
161 out_col2[1] = -(a23*a11 - a21*a13) / tmp_det;
162 out_col2[2] = (a22*a11 - a21*a12) / tmp_det;
173 const eT tmp_det =
det(X);
177 const eT* Xm = X.
memptr();
180 outm[
pos<0,0>::n4] = ( Xm[
pos<1,2>::n4]*Xm[
pos<2,3>::n4]*Xm[
pos<3,1>::n4] - Xm[
pos<1,3>::n4]*Xm[
pos<2,2>::n4]*Xm[
pos<3,1>::n4] + Xm[
pos<1,3>::n4]*Xm[
pos<2,1>::n4]*Xm[
pos<3,2>::n4] - Xm[
pos<1,1>::n4]*Xm[
pos<2,3>::n4]*Xm[
pos<3,2>::n4] - Xm[
pos<1,2>::n4]*Xm[
pos<2,1>::n4]*Xm[
pos<3,3>::n4] + Xm[
pos<1,1>::n4]*Xm[
pos<2,2>::n4]*Xm[
pos<3,3>::n4] ) / tmp_det;
181 outm[
pos<1,0>::n4] = ( Xm[
pos<1,3>::n4]*Xm[
pos<2,2>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<1,2>::n4]*Xm[
pos<2,3>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<1,3>::n4]*Xm[
pos<2,0>::n4]*Xm[
pos<3,2>::n4] + Xm[
pos<1,0>::n4]*Xm[
pos<2,3>::n4]*Xm[
pos<3,2>::n4] + Xm[
pos<1,2>::n4]*Xm[
pos<2,0>::n4]*Xm[
pos<3,3>::n4] - Xm[
pos<1,0>::n4]*Xm[
pos<2,2>::n4]*Xm[
pos<3,3>::n4] ) / tmp_det;
182 outm[
pos<2,0>::n4] = ( Xm[
pos<1,1>::n4]*Xm[
pos<2,3>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<1,3>::n4]*Xm[
pos<2,1>::n4]*Xm[
pos<3,0>::n4] + Xm[
pos<1,3>::n4]*Xm[
pos<2,0>::n4]*Xm[
pos<3,1>::n4] - Xm[
pos<1,0>::n4]*Xm[
pos<2,3>::n4]*Xm[
pos<3,1>::n4] - Xm[
pos<1,1>::n4]*Xm[
pos<2,0>::n4]*Xm[
pos<3,3>::n4] + Xm[
pos<1,0>::n4]*Xm[
pos<2,1>::n4]*Xm[
pos<3,3>::n4] ) / tmp_det;
183 outm[
pos<3,0>::n4] = ( Xm[
pos<1,2>::n4]*Xm[
pos<2,1>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<1,1>::n4]*Xm[
pos<2,2>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<1,2>::n4]*Xm[
pos<2,0>::n4]*Xm[
pos<3,1>::n4] + Xm[
pos<1,0>::n4]*Xm[
pos<2,2>::n4]*Xm[
pos<3,1>::n4] + Xm[
pos<1,1>::n4]*Xm[
pos<2,0>::n4]*Xm[
pos<3,2>::n4] - Xm[
pos<1,0>::n4]*Xm[
pos<2,1>::n4]*Xm[
pos<3,2>::n4] ) / tmp_det;
185 outm[
pos<0,1>::n4] = ( Xm[
pos<0,3>::n4]*Xm[
pos<2,2>::n4]*Xm[
pos<3,1>::n4] - Xm[
pos<0,2>::n4]*Xm[
pos<2,3>::n4]*Xm[
pos<3,1>::n4] - Xm[
pos<0,3>::n4]*Xm[
pos<2,1>::n4]*Xm[
pos<3,2>::n4] + Xm[
pos<0,1>::n4]*Xm[
pos<2,3>::n4]*Xm[
pos<3,2>::n4] + Xm[
pos<0,2>::n4]*Xm[
pos<2,1>::n4]*Xm[
pos<3,3>::n4] - Xm[
pos<0,1>::n4]*Xm[
pos<2,2>::n4]*Xm[
pos<3,3>::n4] ) / tmp_det;
186 outm[
pos<1,1>::n4] = ( Xm[
pos<0,2>::n4]*Xm[
pos<2,3>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<0,3>::n4]*Xm[
pos<2,2>::n4]*Xm[
pos<3,0>::n4] + Xm[
pos<0,3>::n4]*Xm[
pos<2,0>::n4]*Xm[
pos<3,2>::n4] - Xm[
pos<0,0>::n4]*Xm[
pos<2,3>::n4]*Xm[
pos<3,2>::n4] - Xm[
pos<0,2>::n4]*Xm[
pos<2,0>::n4]*Xm[
pos<3,3>::n4] + Xm[
pos<0,0>::n4]*Xm[
pos<2,2>::n4]*Xm[
pos<3,3>::n4] ) / tmp_det;
187 outm[
pos<2,1>::n4] = ( Xm[
pos<0,3>::n4]*Xm[
pos<2,1>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<0,1>::n4]*Xm[
pos<2,3>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<0,3>::n4]*Xm[
pos<2,0>::n4]*Xm[
pos<3,1>::n4] + Xm[
pos<0,0>::n4]*Xm[
pos<2,3>::n4]*Xm[
pos<3,1>::n4] + Xm[
pos<0,1>::n4]*Xm[
pos<2,0>::n4]*Xm[
pos<3,3>::n4] - Xm[
pos<0,0>::n4]*Xm[
pos<2,1>::n4]*Xm[
pos<3,3>::n4] ) / tmp_det;
188 outm[
pos<3,1>::n4] = ( Xm[
pos<0,1>::n4]*Xm[
pos<2,2>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<0,2>::n4]*Xm[
pos<2,1>::n4]*Xm[
pos<3,0>::n4] + Xm[
pos<0,2>::n4]*Xm[
pos<2,0>::n4]*Xm[
pos<3,1>::n4] - Xm[
pos<0,0>::n4]*Xm[
pos<2,2>::n4]*Xm[
pos<3,1>::n4] - Xm[
pos<0,1>::n4]*Xm[
pos<2,0>::n4]*Xm[
pos<3,2>::n4] + Xm[
pos<0,0>::n4]*Xm[
pos<2,1>::n4]*Xm[
pos<3,2>::n4] ) / tmp_det;
190 outm[
pos<0,2>::n4] = ( Xm[
pos<0,2>::n4]*Xm[
pos<1,3>::n4]*Xm[
pos<3,1>::n4] - Xm[
pos<0,3>::n4]*Xm[
pos<1,2>::n4]*Xm[
pos<3,1>::n4] + Xm[
pos<0,3>::n4]*Xm[
pos<1,1>::n4]*Xm[
pos<3,2>::n4] - Xm[
pos<0,1>::n4]*Xm[
pos<1,3>::n4]*Xm[
pos<3,2>::n4] - Xm[
pos<0,2>::n4]*Xm[
pos<1,1>::n4]*Xm[
pos<3,3>::n4] + Xm[
pos<0,1>::n4]*Xm[
pos<1,2>::n4]*Xm[
pos<3,3>::n4] ) / tmp_det;
191 outm[
pos<1,2>::n4] = ( Xm[
pos<0,3>::n4]*Xm[
pos<1,2>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<0,2>::n4]*Xm[
pos<1,3>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<0,3>::n4]*Xm[
pos<1,0>::n4]*Xm[
pos<3,2>::n4] + Xm[
pos<0,0>::n4]*Xm[
pos<1,3>::n4]*Xm[
pos<3,2>::n4] + Xm[
pos<0,2>::n4]*Xm[
pos<1,0>::n4]*Xm[
pos<3,3>::n4] - Xm[
pos<0,0>::n4]*Xm[
pos<1,2>::n4]*Xm[
pos<3,3>::n4] ) / tmp_det;
192 outm[
pos<2,2>::n4] = ( Xm[
pos<0,1>::n4]*Xm[
pos<1,3>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<0,3>::n4]*Xm[
pos<1,1>::n4]*Xm[
pos<3,0>::n4] + Xm[
pos<0,3>::n4]*Xm[
pos<1,0>::n4]*Xm[
pos<3,1>::n4] - Xm[
pos<0,0>::n4]*Xm[
pos<1,3>::n4]*Xm[
pos<3,1>::n4] - Xm[
pos<0,1>::n4]*Xm[
pos<1,0>::n4]*Xm[
pos<3,3>::n4] + Xm[
pos<0,0>::n4]*Xm[
pos<1,1>::n4]*Xm[
pos<3,3>::n4] ) / tmp_det;
193 outm[
pos<3,2>::n4] = ( Xm[
pos<0,2>::n4]*Xm[
pos<1,1>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<0,1>::n4]*Xm[
pos<1,2>::n4]*Xm[
pos<3,0>::n4] - Xm[
pos<0,2>::n4]*Xm[
pos<1,0>::n4]*Xm[
pos<3,1>::n4] + Xm[
pos<0,0>::n4]*Xm[
pos<1,2>::n4]*Xm[
pos<3,1>::n4] + Xm[
pos<0,1>::n4]*Xm[
pos<1,0>::n4]*Xm[
pos<3,2>::n4] - Xm[
pos<0,0>::n4]*Xm[
pos<1,1>::n4]*Xm[
pos<3,2>::n4] ) / tmp_det;
195 outm[
pos<0,3>::n4] = ( Xm[
pos<0,3>::n4]*Xm[
pos<1,2>::n4]*Xm[
pos<2,1>::n4] - Xm[
pos<0,2>::n4]*Xm[
pos<1,3>::n4]*Xm[
pos<2,1>::n4] - Xm[
pos<0,3>::n4]*Xm[
pos<1,1>::n4]*Xm[
pos<2,2>::n4] + Xm[
pos<0,1>::n4]*Xm[
pos<1,3>::n4]*Xm[
pos<2,2>::n4] + Xm[
pos<0,2>::n4]*Xm[
pos<1,1>::n4]*Xm[
pos<2,3>::n4] - Xm[
pos<0,1>::n4]*Xm[
pos<1,2>::n4]*Xm[
pos<2,3>::n4] ) / tmp_det;
196 outm[
pos<1,3>::n4] = ( Xm[
pos<0,2>::n4]*Xm[
pos<1,3>::n4]*Xm[
pos<2,0>::n4] - Xm[
pos<0,3>::n4]*Xm[
pos<1,2>::n4]*Xm[
pos<2,0>::n4] + Xm[
pos<0,3>::n4]*Xm[
pos<1,0>::n4]*Xm[
pos<2,2>::n4] - Xm[
pos<0,0>::n4]*Xm[
pos<1,3>::n4]*Xm[
pos<2,2>::n4] - Xm[
pos<0,2>::n4]*Xm[
pos<1,0>::n4]*Xm[
pos<2,3>::n4] + Xm[
pos<0,0>::n4]*Xm[
pos<1,2>::n4]*Xm[
pos<2,3>::n4] ) / tmp_det;
197 outm[
pos<2,3>::n4] = ( Xm[
pos<0,3>::n4]*Xm[
pos<1,1>::n4]*Xm[
pos<2,0>::n4] - Xm[
pos<0,1>::n4]*Xm[
pos<1,3>::n4]*Xm[
pos<2,0>::n4] - Xm[
pos<0,3>::n4]*Xm[
pos<1,0>::n4]*Xm[
pos<2,1>::n4] + Xm[
pos<0,0>::n4]*Xm[
pos<1,3>::n4]*Xm[
pos<2,1>::n4] + Xm[
pos<0,1>::n4]*Xm[
pos<1,0>::n4]*Xm[
pos<2,3>::n4] - Xm[
pos<0,0>::n4]*Xm[
pos<1,1>::n4]*Xm[
pos<2,3>::n4] ) / tmp_det;
198 outm[
pos<3,3>::n4] = ( Xm[
pos<0,1>::n4]*Xm[
pos<1,2>::n4]*Xm[
pos<2,0>::n4] - Xm[
pos<0,2>::n4]*Xm[
pos<1,1>::n4]*Xm[
pos<2,0>::n4] + Xm[
pos<0,2>::n4]*Xm[
pos<1,0>::n4]*Xm[
pos<2,1>::n4] - Xm[
pos<0,0>::n4]*Xm[
pos<1,2>::n4]*Xm[
pos<2,1>::n4] - Xm[
pos<0,1>::n4]*Xm[
pos<1,0>::n4]*Xm[
pos<2,2>::n4] + Xm[
pos<0,0>::n4]*Xm[
pos<1,1>::n4]*Xm[
pos<2,2>::n4] ) / tmp_det;
216 template<
typename eT>
246 const eT tmp_det = (a*d - b*c);
268 const eT a11 = X_col0[0];
269 const eT a21 = X_col0[1];
270 const eT a31 = X_col0[2];
272 const eT a12 = X_col1[0];
273 const eT a22 = X_col1[1];
274 const eT a32 = X_col1[2];
276 const eT a13 = X_col2[0];
277 const eT a23 = X_col2[1];
278 const eT a33 = X_col2[2];
280 const eT tmp_det = a11*(a33*a22 - a32*a23) - a21*(a33*a12-a32*a13) + a31*(a23*a12 - a22*a13);
284 X_col0[0] = (a33*a22 - a32*a23) / tmp_det;
285 X_col0[1] = -(a33*a21 - a31*a23) / tmp_det;
286 X_col0[2] = (a32*a21 - a31*a22) / tmp_det;
288 X_col1[0] = -(a33*a12 - a32*a13) / tmp_det;
289 X_col1[1] = (a33*a11 - a31*a13) / tmp_det;
290 X_col1[2] = -(a32*a11 - a31*a12) / tmp_det;
292 X_col2[0] = (a23*a12 - a22*a13) / tmp_det;
293 X_col2[1] = -(a23*a11 - a21*a13) / tmp_det;
294 X_col2[2] = (a22*a11 - a21*a12) / tmp_det;
305 const eT tmp_det =
det(X);
311 const eT* Am = A.
memptr();
314 Xm[
pos<0,0>::n4] = ( Am[
pos<1,2>::n4]*Am[
pos<2,3>::n4]*Am[
pos<3,1>::n4] - Am[
pos<1,3>::n4]*Am[
pos<2,2>::n4]*Am[
pos<3,1>::n4] + Am[
pos<1,3>::n4]*Am[
pos<2,1>::n4]*Am[
pos<3,2>::n4] - Am[
pos<1,1>::n4]*Am[
pos<2,3>::n4]*Am[
pos<3,2>::n4] - Am[
pos<1,2>::n4]*Am[
pos<2,1>::n4]*Am[
pos<3,3>::n4] + Am[
pos<1,1>::n4]*Am[
pos<2,2>::n4]*Am[
pos<3,3>::n4] ) / tmp_det;
315 Xm[
pos<1,0>::n4] = ( Am[
pos<1,3>::n4]*Am[
pos<2,2>::n4]*Am[
pos<3,0>::n4] - Am[
pos<1,2>::n4]*Am[
pos<2,3>::n4]*Am[
pos<3,0>::n4] - Am[
pos<1,3>::n4]*Am[
pos<2,0>::n4]*Am[
pos<3,2>::n4] + Am[
pos<1,0>::n4]*Am[
pos<2,3>::n4]*Am[
pos<3,2>::n4] + Am[
pos<1,2>::n4]*Am[
pos<2,0>::n4]*Am[
pos<3,3>::n4] - Am[
pos<1,0>::n4]*Am[
pos<2,2>::n4]*Am[
pos<3,3>::n4] ) / tmp_det;
316 Xm[
pos<2,0>::n4] = ( Am[
pos<1,1>::n4]*Am[
pos<2,3>::n4]*Am[
pos<3,0>::n4] - Am[
pos<1,3>::n4]*Am[
pos<2,1>::n4]*Am[
pos<3,0>::n4] + Am[
pos<1,3>::n4]*Am[
pos<2,0>::n4]*Am[
pos<3,1>::n4] - Am[
pos<1,0>::n4]*Am[
pos<2,3>::n4]*Am[
pos<3,1>::n4] - Am[
pos<1,1>::n4]*Am[
pos<2,0>::n4]*Am[
pos<3,3>::n4] + Am[
pos<1,0>::n4]*Am[
pos<2,1>::n4]*Am[
pos<3,3>::n4] ) / tmp_det;
317 Xm[
pos<3,0>::n4] = ( Am[
pos<1,2>::n4]*Am[
pos<2,1>::n4]*Am[
pos<3,0>::n4] - Am[
pos<1,1>::n4]*Am[
pos<2,2>::n4]*Am[
pos<3,0>::n4] - Am[
pos<1,2>::n4]*Am[
pos<2,0>::n4]*Am[
pos<3,1>::n4] + Am[
pos<1,0>::n4]*Am[
pos<2,2>::n4]*Am[
pos<3,1>::n4] + Am[
pos<1,1>::n4]*Am[
pos<2,0>::n4]*Am[
pos<3,2>::n4] - Am[
pos<1,0>::n4]*Am[
pos<2,1>::n4]*Am[
pos<3,2>::n4] ) / tmp_det;
319 Xm[
pos<0,1>::n4] = ( Am[
pos<0,3>::n4]*Am[
pos<2,2>::n4]*Am[
pos<3,1>::n4] - Am[
pos<0,2>::n4]*Am[
pos<2,3>::n4]*Am[
pos<3,1>::n4] - Am[
pos<0,3>::n4]*Am[
pos<2,1>::n4]*Am[
pos<3,2>::n4] + Am[
pos<0,1>::n4]*Am[
pos<2,3>::n4]*Am[
pos<3,2>::n4] + Am[
pos<0,2>::n4]*Am[
pos<2,1>::n4]*Am[
pos<3,3>::n4] - Am[
pos<0,1>::n4]*Am[
pos<2,2>::n4]*Am[
pos<3,3>::n4] ) / tmp_det;
320 Xm[
pos<1,1>::n4] = ( Am[
pos<0,2>::n4]*Am[
pos<2,3>::n4]*Am[
pos<3,0>::n4] - Am[
pos<0,3>::n4]*Am[
pos<2,2>::n4]*Am[
pos<3,0>::n4] + Am[
pos<0,3>::n4]*Am[
pos<2,0>::n4]*Am[
pos<3,2>::n4] - Am[
pos<0,0>::n4]*Am[
pos<2,3>::n4]*Am[
pos<3,2>::n4] - Am[
pos<0,2>::n4]*Am[
pos<2,0>::n4]*Am[
pos<3,3>::n4] + Am[
pos<0,0>::n4]*Am[
pos<2,2>::n4]*Am[
pos<3,3>::n4] ) / tmp_det;
321 Xm[
pos<2,1>::n4] = ( Am[
pos<0,3>::n4]*Am[
pos<2,1>::n4]*Am[
pos<3,0>::n4] - Am[
pos<0,1>::n4]*Am[
pos<2,3>::n4]*Am[
pos<3,0>::n4] - Am[
pos<0,3>::n4]*Am[
pos<2,0>::n4]*Am[
pos<3,1>::n4] + Am[
pos<0,0>::n4]*Am[
pos<2,3>::n4]*Am[
pos<3,1>::n4] + Am[
pos<0,1>::n4]*Am[
pos<2,0>::n4]*Am[
pos<3,3>::n4] - Am[
pos<0,0>::n4]*Am[
pos<2,1>::n4]*Am[
pos<3,3>::n4] ) / tmp_det;
322 Xm[
pos<3,1>::n4] = ( Am[
pos<0,1>::n4]*Am[
pos<2,2>::n4]*Am[
pos<3,0>::n4] - Am[
pos<0,2>::n4]*Am[
pos<2,1>::n4]*Am[
pos<3,0>::n4] + Am[
pos<0,2>::n4]*Am[
pos<2,0>::n4]*Am[
pos<3,1>::n4] - Am[
pos<0,0>::n4]*Am[
pos<2,2>::n4]*Am[
pos<3,1>::n4] - Am[
pos<0,1>::n4]*Am[
pos<2,0>::n4]*Am[
pos<3,2>::n4] + Am[
pos<0,0>::n4]*Am[
pos<2,1>::n4]*Am[
pos<3,2>::n4] ) / tmp_det;
324 Xm[
pos<0,2>::n4] = ( Am[
pos<0,2>::n4]*Am[
pos<1,3>::n4]*Am[
pos<3,1>::n4] - Am[
pos<0,3>::n4]*Am[
pos<1,2>::n4]*Am[
pos<3,1>::n4] + Am[
pos<0,3>::n4]*Am[
pos<1,1>::n4]*Am[
pos<3,2>::n4] - Am[
pos<0,1>::n4]*Am[
pos<1,3>::n4]*Am[
pos<3,2>::n4] - Am[
pos<0,2>::n4]*Am[
pos<1,1>::n4]*Am[
pos<3,3>::n4] + Am[
pos<0,1>::n4]*Am[
pos<1,2>::n4]*Am[
pos<3,3>::n4] ) / tmp_det;
325 Xm[
pos<1,2>::n4] = ( Am[
pos<0,3>::n4]*Am[
pos<1,2>::n4]*Am[
pos<3,0>::n4] - Am[
pos<0,2>::n4]*Am[
pos<1,3>::n4]*Am[
pos<3,0>::n4] - Am[
pos<0,3>::n4]*Am[
pos<1,0>::n4]*Am[
pos<3,2>::n4] + Am[
pos<0,0>::n4]*Am[
pos<1,3>::n4]*Am[
pos<3,2>::n4] + Am[
pos<0,2>::n4]*Am[
pos<1,0>::n4]*Am[
pos<3,3>::n4] - Am[
pos<0,0>::n4]*Am[
pos<1,2>::n4]*Am[
pos<3,3>::n4] ) / tmp_det;
326 Xm[
pos<2,2>::n4] = ( Am[
pos<0,1>::n4]*Am[
pos<1,3>::n4]*Am[
pos<3,0>::n4] - Am[
pos<0,3>::n4]*Am[
pos<1,1>::n4]*Am[
pos<3,0>::n4] + Am[
pos<0,3>::n4]*Am[
pos<1,0>::n4]*Am[
pos<3,1>::n4] - Am[
pos<0,0>::n4]*Am[
pos<1,3>::n4]*Am[
pos<3,1>::n4] - Am[
pos<0,1>::n4]*Am[
pos<1,0>::n4]*Am[
pos<3,3>::n4] + Am[
pos<0,0>::n4]*Am[
pos<1,1>::n4]*Am[
pos<3,3>::n4] ) / tmp_det;
327 Xm[
pos<3,2>::n4] = ( Am[
pos<0,2>::n4]*Am[
pos<1,1>::n4]*Am[
pos<3,0>::n4] - Am[
pos<0,1>::n4]*Am[
pos<1,2>::n4]*Am[
pos<3,0>::n4] - Am[
pos<0,2>::n4]*Am[
pos<1,0>::n4]*Am[
pos<3,1>::n4] + Am[
pos<0,0>::n4]*Am[
pos<1,2>::n4]*Am[
pos<3,1>::n4] + Am[
pos<0,1>::n4]*Am[
pos<1,0>::n4]*Am[
pos<3,2>::n4] - Am[
pos<0,0>::n4]*Am[
pos<1,1>::n4]*Am[
pos<3,2>::n4] ) / tmp_det;
329 Xm[
pos<0,3>::n4] = ( Am[
pos<0,3>::n4]*Am[
pos<1,2>::n4]*Am[
pos<2,1>::n4] - Am[
pos<0,2>::n4]*Am[
pos<1,3>::n4]*Am[
pos<2,1>::n4] - Am[
pos<0,3>::n4]*Am[
pos<1,1>::n4]*Am[
pos<2,2>::n4] + Am[
pos<0,1>::n4]*Am[
pos<1,3>::n4]*Am[
pos<2,2>::n4] + Am[
pos<0,2>::n4]*Am[
pos<1,1>::n4]*Am[
pos<2,3>::n4] - Am[
pos<0,1>::n4]*Am[
pos<1,2>::n4]*Am[
pos<2,3>::n4] ) / tmp_det;
330 Xm[
pos<1,3>::n4] = ( Am[
pos<0,2>::n4]*Am[
pos<1,3>::n4]*Am[
pos<2,0>::n4] - Am[
pos<0,3>::n4]*Am[
pos<1,2>::n4]*Am[
pos<2,0>::n4] + Am[
pos<0,3>::n4]*Am[
pos<1,0>::n4]*Am[
pos<2,2>::n4] - Am[
pos<0,0>::n4]*Am[
pos<1,3>::n4]*Am[
pos<2,2>::n4] - Am[
pos<0,2>::n4]*Am[
pos<1,0>::n4]*Am[
pos<2,3>::n4] + Am[
pos<0,0>::n4]*Am[
pos<1,2>::n4]*Am[
pos<2,3>::n4] ) / tmp_det;
331 Xm[
pos<2,3>::n4] = ( Am[
pos<0,3>::n4]*Am[
pos<1,1>::n4]*Am[
pos<2,0>::n4] - Am[
pos<0,1>::n4]*Am[
pos<1,3>::n4]*Am[
pos<2,0>::n4] - Am[
pos<0,3>::n4]*Am[
pos<1,0>::n4]*Am[
pos<2,1>::n4] + Am[
pos<0,0>::n4]*Am[
pos<1,3>::n4]*Am[
pos<2,1>::n4] + Am[
pos<0,1>::n4]*Am[
pos<1,0>::n4]*Am[
pos<2,3>::n4] - Am[
pos<0,0>::n4]*Am[
pos<1,1>::n4]*Am[
pos<2,3>::n4] ) / tmp_det;
332 Xm[
pos<3,3>::n4] = ( Am[
pos<0,1>::n4]*Am[
pos<1,2>::n4]*Am[
pos<2,0>::n4] - Am[
pos<0,2>::n4]*Am[
pos<1,1>::n4]*Am[
pos<2,0>::n4] + Am[
pos<0,2>::n4]*Am[
pos<1,0>::n4]*Am[
pos<2,1>::n4] - Am[
pos<0,0>::n4]*Am[
pos<1,2>::n4]*Am[
pos<2,1>::n4] - Am[
pos<0,1>::n4]*Am[
pos<1,0>::n4]*Am[
pos<2,2>::n4] + Am[
pos<0,0>::n4]*Am[
pos<1,1>::n4]*Am[
pos<2,2>::n4] ) / tmp_det;
350 template<
typename eT>
362 #if defined(ARMA_USE_ATLAS) 375 #elif defined(ARMA_USE_LAPACK) 392 lapack::getrf(&n_rows, &n_cols, out.
memptr(), &n_rows, ipiv.
memptr(), &info);
399 lapack::getri(&n_rows, out.
memptr(), &n_rows, ipiv.
memptr(), work.
memptr(), &work_len_tmp, &info);
406 if(work_len < proposed_work_len)
408 work_len = proposed_work_len;
409 work.
set_size( static_cast<uword>(work_len) );
413 lapack::getri(&n_rows, out.
memptr(), &n_rows, ipiv.
memptr(), work.
memptr(), &work_len, &info);
421 arma_stop(
"inv(): use of ATLAS or LAPACK needs to be enabled");
429 template<
typename eT,
typename T1>
447 #if defined(ARMA_USE_LAPACK) 449 char uplo = (layout == 0) ?
'U' :
'L';
454 lapack::trtri(&uplo, &diag, &n, out.
memptr(), &n, &info);
456 status = (info == 0);
461 arma_stop(
"inv(): use of LAPACK needs to be enabled");
486 template<
typename eT,
typename T1>
504 #if defined(ARMA_USE_LAPACK) 506 char uplo = (layout == 0) ?
'U' :
'L';
517 lapack::sytrf(&uplo, &n, out.
memptr(), &n, ipiv.
memptr(), work.
memptr(), &lwork, &info);
519 status = (info == 0);
527 status = (info == 0);
533 arma_stop(
"inv(): use of LAPACK needs to be enabled");
543 template<
typename eT,
typename T1>
561 #if defined(ARMA_USE_LAPACK) 563 char uplo = (layout == 0) ?
'U' :
'L';
567 lapack::potrf(&uplo, &n, out.
memptr(), &n, &info);
569 status = (info == 0);
573 lapack::potri(&uplo, &n, out.
memptr(), &n, &info);
577 status = (info == 0);
583 arma_stop(
"inv(): use of LAPACK needs to be enabled");
593 template<
typename eT,
typename T1>
601 arma_debug_check( (A.is_square() ==
false),
"det(): matrix is not square" );
607 const uword N = A.n_rows;
637 template<
typename eT>
656 const eT* Xm = X.
memptr();
672 const eT* a_col0 = X.
colptr(0);
673 const eT a11 = a_col0[0];
674 const eT a21 = a_col0[1];
675 const eT a31 = a_col0[2];
677 const eT* a_col1 = X.
colptr(1);
678 const eT a12 = a_col1[0];
679 const eT a22 = a_col1[1];
680 const eT a32 = a_col1[2];
682 const eT* a_col2 = X.
colptr(2);
683 const eT a13 = a_col2[0];
684 const eT a23 = a_col2[1];
685 const eT a33 = a_col2[2];
687 return ( a11*(a33*a22 - a32*a23) - a21*(a33*a12-a32*a13) + a31*(a23*a12 - a22*a13) );
693 const eT* Xm = X.
memptr();
735 template<
typename eT>
744 if(make_copy ==
true)
749 Mat<eT>& tmp = (make_copy ==
true) ? X_copy :
const_cast< Mat<eT>&
>(X);
757 #if defined(ARMA_USE_ATLAS) 765 eT val = tmp.
at(0,0);
774 if(
int(i) != ipiv.
mem[i] )
780 return ( (sign < 0) ? -val : val );
782 #elif defined(ARMA_USE_LAPACK) 790 lapack::getrf(&n_rows, &n_cols, tmp.
memptr(), &n_rows, ipiv.
memptr(), &info);
793 eT val = tmp.
at(0,0);
808 return ( (sign < 0) ? -val : val );
815 arma_stop(
"det(): use of ATLAS or LAPACK needs to be enabled");
824 template<
typename eT,
typename T1>
833 #if defined(ARMA_USE_ATLAS) 836 arma_debug_check( (tmp.is_square() ==
false),
"log_det(): given matrix is not square" );
847 const int info = atlas::clapack_getrf(atlas::CblasColMajor, tmp.n_rows, tmp.n_cols, tmp.memptr(), tmp.n_rows, ipiv.
memptr());
854 for(
uword i=1; i < tmp.n_rows; ++i)
856 const eT x = tmp.at(i,i);
862 for(
uword i=0; i < tmp.n_rows; ++i)
864 if(
int(i) != ipiv.
mem[i] )
875 #elif defined(ARMA_USE_LAPACK) 878 arma_debug_check( (tmp.is_square() ==
false),
"log_det(): given matrix is not square" );
893 lapack::getrf(&n_rows, &n_cols, tmp.memptr(), &n_rows, ipiv.
memptr(), &info);
900 for(
uword i=1; i < tmp.n_rows; ++i)
902 const eT x = tmp.at(i,i);
908 for(
uword i=0; i < tmp.n_rows; ++i)
926 arma_stop(
"log_det(): use of ATLAS or LAPACK needs to be enabled");
936 template<
typename eT,
typename T1>
956 #if defined(ARMA_USE_ATLAS) || defined(ARMA_USE_LAPACK) 960 #if defined(ARMA_USE_ATLAS) 964 int info = atlas::clapack_getrf(atlas::CblasColMajor, U_n_rows, U_n_cols, U.
memptr(), U_n_rows, ipiv.
memptr());
966 status = (info == 0);
968 #elif defined(ARMA_USE_LAPACK) 978 lapack::getrf(&n_rows, &n_cols, U.
memptr(), &n_rows, ipiv.
memptr(), &info);
983 status = (info == 0);
989 for(
uword col=0; col < U_n_cols; ++col)
991 for(
uword row=0; (row < col) && (row < U_n_rows); ++row)
993 L.
at(row,col) = eT(0);
998 L.
at(col,col) = eT(1);
1001 for(
uword row = (col+1); row < U_n_rows; ++row)
1003 L.
at(row,col) = U.
at(row,col);
1004 U.
at(row,col) = eT(0);
1012 arma_stop(
"lu(): use of ATLAS or LAPACK needs to be enabled");
1021 template<
typename eT,
typename T1>
1029 const bool status =
auxlib::lu(L, U, ipiv1, X);
1048 for(
uword i=0; i<P_rows; ++i)
1053 for(
uword i=0; i<n; ++i)
1055 const uword k =
static_cast<uword>(ipiv1_mem[i]);
1057 if( ipiv2_mem[i] != ipiv2_mem[k] )
1059 std::swap( ipiv2_mem[i], ipiv2_mem[k] );
1063 P.
zeros(P_rows, P_rows);
1065 for(
uword row=0; row<P_rows; ++row)
1067 P.
at(row, static_cast<uword>(ipiv2_mem[row])) = eT(1);
1086 template<
typename eT,
typename T1>
1094 const bool status =
auxlib::lu(L, U, ipiv1, X);
1112 for(
uword i=0; i<P_rows; ++i)
1117 for(
uword i=0; i<n; ++i)
1119 const uword k =
static_cast<uword>(ipiv1_mem[i]);
1121 if( ipiv2_mem[i] != ipiv2_mem[k] )
1123 std::swap( ipiv2_mem[i], ipiv2_mem[k] );
1124 L.
swap_rows( static_cast<uword>(ipiv2_mem[i]), static_cast<uword>(ipiv2_mem[k]) );
1145 template<
typename eT,
typename T1>
1152 #if defined(ARMA_USE_LAPACK) 1156 arma_debug_check( (A.is_square() ==
false),
"eig_sym(): given matrix is not square");
1173 eigval.
set_size( static_cast<uword>(n_rows) );
1179 lapack::syev(&jobz, &uplo, &n_rows, A.memptr(), &n_rows, eigval.
memptr(), work.
memptr(), &lwork, &info);
1187 arma_stop(
"eig_sym(): use of LAPACK needs to be enabled");
1196 template<
typename T,
typename T1>
1203 typedef typename std::complex<T> eT;
1205 #if defined(ARMA_USE_LAPACK) 1208 arma_debug_check( (A.is_square() ==
false),
"eig_sym(): given matrix is not hermitian");
1223 eigval.
set_size( static_cast<uword>(n_rows) );
1231 lapack::heev(&jobz, &uplo, &n_rows, A.memptr(), &lda, eigval.
memptr(), work.
memptr(), &lwork, rwork.
memptr(), &info);
1239 arma_stop(
"eig_sym(): use of LAPACK needs to be enabled");
1248 template<
typename eT,
typename T1>
1255 #if defined(ARMA_USE_LAPACK) 1277 eigval.
set_size( static_cast<uword>(n_rows) );
1283 lapack::syev(&jobz, &uplo, &n_rows, eigvec.
memptr(), &n_rows, eigval.
memptr(), work.
memptr(), &lwork, &info);
1291 arma_stop(
"eig_sym(): use of LAPACK needs to be enabled");
1301 template<
typename T,
typename T1>
1308 typedef typename std::complex<T> eT;
1310 #if defined(ARMA_USE_LAPACK) 1312 eigvec = X.get_ref();
1314 arma_debug_check( (eigvec.is_square() ==
false),
"eig_sym(): given matrix is not hermitian" );
1316 if(eigvec.is_empty())
1330 eigval.
set_size( static_cast<uword>(n_rows) );
1338 lapack::heev(&jobz, &uplo, &n_rows, eigvec.memptr(), &lda, eigval.
memptr(), work.
memptr(), &lwork, rwork.
memptr(), &info);
1347 arma_stop(
"eig_sym(): use of LAPACK needs to be enabled");
1358 template<
typename T,
typename T1>
1363 Col< std::complex<T> >& eigval,
1372 #if defined(ARMA_USE_LAPACK) 1400 arma_stop(
"eig_gen(): parameter 'side' is invalid");
1405 arma_debug_check( (A.is_square() ==
false),
"eig_gen(): given matrix is not square" );
1415 uword A_n_rows = A.n_rows;
1421 eigval.set_size(A_n_rows);
1422 l_eigvec.
set_size(A_n_rows, A_n_rows);
1423 r_eigvec.
set_size(A_n_rows, A_n_rows);
1435 lapack::geev(&jobvl, &jobvr, &n_rows, A_copy.
memptr(), &lda, wr.
memptr(), wi.
memptr(), l_eigvec.
memptr(), &n_rows, r_eigvec.
memptr(), &n_rows, work.
memptr(), &lwork, &info);
1438 eigval.set_size(A_n_rows);
1439 for(
uword i=0; i<A_n_rows; ++i)
1441 eigval[i] = std::complex<T>(wr[i], wi[i]);
1453 arma_stop(
"eig_gen(): use of LAPACK needs to be enabled");
1466 template<
typename T,
typename T1>
1471 Col< std::complex<T> >& eigval,
1472 Mat< std::complex<T> >& l_eigvec,
1473 Mat< std::complex<T> >& r_eigvec,
1474 const Base< std::complex<T>, T1 >& X,
1480 typedef typename std::complex<T> eT;
1482 #if defined(ARMA_USE_LAPACK) 1510 arma_stop(
"eig_gen(): parameter 'side' is invalid");
1515 arma_debug_check( (A.is_square() ==
false),
"eig_gen(): given matrix is not square" );
1525 uword A_n_rows = A.n_rows;
1531 eigval.set_size(A_n_rows);
1532 l_eigvec.
set_size(A_n_rows, A_n_rows);
1533 r_eigvec.
set_size(A_n_rows, A_n_rows);
1541 lapack::cx_geev(&jobvl, &jobvr, &n_rows, A.memptr(), &lda, eigval.memptr(), l_eigvec.
memptr(), &n_rows, r_eigvec.
memptr(), &n_rows, work.
memptr(), &lwork, rwork.
memptr(), &info);
1552 arma_stop(
"eig_gen(): use of LAPACK needs to be enabled");
1560 template<
typename eT,
typename T1>
1567 #if defined(ARMA_USE_LAPACK) 1584 lapack::potrf(&uplo, &n, out.
memptr(), &n, &info);
1586 for(
uword col=0; col<out_n_rows; ++col)
1588 eT* colptr = out.
colptr(col);
1590 for(
uword row=(col+1); row < out_n_rows; ++row)
1592 colptr[row] = eT(0);
1601 arma_stop(
"chol(): use of LAPACK needs to be enabled");
1609 template<
typename eT,
typename T1>
1616 #if defined(ARMA_USE_LAPACK) 1625 Q.
eye(R_n_rows, R_n_rows);
1641 lapack::geqrf(&m, &n, R.
memptr(), &m, tau.
memptr(), work.
memptr(), &work_len_tmp, &info);
1646 work.
set_size( static_cast<uword>(work_len) );
1649 lapack::geqrf(&m, &n, R.
memptr(), &m, tau.
memptr(), work.
memptr(), &work_len, &info);
1658 for(
uword col=0; col < R_n_cols; ++col)
1660 for(
uword row=(col+1); row < R_n_rows; ++row)
1662 R.
at(row,col) = eT(0);
1671 lapack::orgqr(&m, &m, &k, Q.
memptr(), &m, tau.
memptr(), work.
memptr(), &work_len_tmp, &info);
1676 work.
set_size( static_cast<uword>(work_len) );
1679 lapack::orgqr(&m, &m, &k, Q.
memptr(), &m, tau.
memptr(), work.
memptr(), &work_len, &info);
1686 lapack::ungqr(&m, &m, &k, Q.
memptr(), &m, tau.
memptr(), work.
memptr(), &work_len_tmp, &info);
1691 work.
set_size( static_cast<uword>(work_len) );
1694 lapack::ungqr(&m, &m, &k, Q.
memptr(), &m, tau.
memptr(), work.
memptr(), &work_len, &info);
1704 arma_stop(
"qr(): use of LAPACK needs to be enabled");
1712 template<
typename eT,
typename T1>
1719 #if defined(ARMA_USE_LAPACK) 1724 X_n_cols = A.n_cols;
1762 work.
memptr(), &lwork_tmp,
1770 if(proposed_lwork > lwork)
1772 lwork = proposed_lwork;
1773 work.
set_size( static_cast<uword>(lwork) );
1797 arma_stop(
"svd(): use of LAPACK needs to be enabled");
1805 template<
typename T,
typename T1>
1812 typedef std::complex<T> eT;
1814 #if defined(ARMA_USE_LAPACK) 1819 X_n_cols = A.n_cols;
1857 work.
memptr(), &lwork_tmp,
1865 if(proposed_lwork > lwork)
1867 lwork = proposed_lwork;
1868 work.
set_size( static_cast<uword>(lwork) );
1894 arma_stop(
"svd(): use of LAPACK needs to be enabled");
1902 template<
typename eT,
typename T1>
1915 template<
typename T,
typename T1>
1928 template<
typename eT,
typename T1>
1935 #if defined(ARMA_USE_LAPACK) 1941 U.
eye(A.n_rows, A.n_rows);
1943 V.
eye(A.n_cols, A.n_cols);
1976 work.
memptr(), &lwork_tmp,
1983 if(proposed_lwork > lwork)
1985 lwork = proposed_lwork;
1986 work.
set_size( static_cast<uword>(lwork) );
2012 arma_stop(
"svd(): use of LAPACK needs to be enabled");
2020 template<
typename T,
typename T1>
2027 typedef std::complex<T> eT;
2029 #if defined(ARMA_USE_LAPACK) 2035 U.
eye(A.n_rows, A.n_rows);
2037 V.eye(A.n_cols, A.n_cols);
2041 U.set_size(A.n_rows, A.n_rows);
2042 V.set_size(A.n_cols, A.n_cols);
2070 work.
memptr(), &lwork_tmp,
2078 if(proposed_lwork > lwork)
2080 lwork = proposed_lwork;
2081 work.
set_size( static_cast<uword>(lwork) );
2108 arma_stop(
"svd(): use of LAPACK needs to be enabled");
2117 template<
typename eT,
typename T1>
2124 #if defined(ARMA_USE_LAPACK) 2149 U.
set_size( static_cast<uword>(ldu), static_cast<uword>((
std::min)(m,n)) );
2163 V.
set_size( static_cast<uword>(ldvt), static_cast<uword>(n) );
2175 U.
set_size( static_cast<uword>(ldu), static_cast<uword>((
std::min)(m,n)) );
2176 V.
set_size( static_cast<uword>(ldvt), static_cast<uword>(n) );
2215 work.
memptr(), &lwork_tmp,
2222 if(proposed_lwork > lwork)
2224 lwork = proposed_lwork;
2225 work.
set_size( static_cast<uword>(lwork) );
2252 arma_stop(
"svd(): use of LAPACK needs to be enabled");
2260 template<
typename T,
typename T1>
2267 typedef std::complex<T> eT;
2269 #if defined(ARMA_USE_LAPACK) 2294 U.
set_size( static_cast<uword>(ldu), static_cast<uword>((
std::min)(m,n)) );
2308 V.set_size( static_cast<uword>(ldvt), static_cast<uword>(n) );
2320 U.
set_size( static_cast<uword>(ldu), static_cast<uword>((
std::min)(m,n)) );
2321 V.set_size( static_cast<uword>(ldvt), static_cast<uword>(n) );
2361 work.
memptr(), &lwork_tmp,
2369 if(proposed_lwork > lwork)
2371 lwork = proposed_lwork;
2372 work.
set_size( static_cast<uword>(lwork) );
2400 arma_stop(
"svd(): use of LAPACK needs to be enabled");
2410 template<
typename eT>
2426 bool status =
false;
2428 if( (A_n_rows <= 4) && (slow ==
false) )
2444 if( (A_n_rows > 4) || (status ==
false) )
2446 #if defined(ARMA_USE_ATLAS) 2452 int info = atlas::clapack_gesv<eT>(atlas::CblasColMajor, A_n_rows, B.
n_cols, A.
memptr(), A_n_rows, ipiv.
memptr(), out.
memptr(), A_n_rows);
2456 #elif defined(ARMA_USE_LAPACK) 2468 lapack::gesv<eT>(&n, &nrhs, A.
memptr(), &lda, ipiv.
memptr(), out.
memptr(), &ldb, &info);
2474 arma_stop(
"solve(): use of ATLAS or LAPACK needs to be enabled");
2488 template<
typename eT>
2495 #if defined(ARMA_USE_LAPACK) 2523 &
trans, &m, &n, &nrhs,
2546 arma_stop(
"solve(): use of LAPACK needs to be enabled");
2556 template<
typename eT>
2563 #if defined(ARMA_USE_LAPACK) 2587 eT* tmp_colmem = tmp.
colptr(col);
2593 tmp_colmem[row] = eT(0);
2605 &
trans, &m, &n, &nrhs,
2628 arma_stop(
"solve(): use of LAPACK needs to be enabled");
2639 template<
typename eT>
2646 #if defined(ARMA_USE_LAPACK) 2656 char uplo = (layout == 0) ?
'U' :
'L';
2663 lapack::trtrs<eT>(&uplo, &
trans, &diag, &n, &nrhs, A.
memptr(), &n, out.
memptr(), &n, &info);
2673 arma_stop(
"solve(): use of LAPACK needs to be enabled");
2684 template<
typename eT>
2691 #if defined(ARMA_USE_LAPACK) 2723 lapack::gees(&jobvs, &sort, select, &n, T.
memptr(), &n, &sdim, wr.
memptr(), wi.
memptr(), Z.
memptr(), &n, work.
memptr(), &lwork, bwork.
memptr(), &info);
2731 arma_stop(
"schur_dec(): use of LAPACK needs to be enabled");
2739 template<
typename cT>
2746 #if defined(ARMA_USE_LAPACK) 2748 arma_debug_check( (A.is_square() ==
false),
"schur_dec(): matrix A is not square" );
2757 typedef std::complex<cT> eT;
2759 const uword A_n_rows = A.n_rows;
2774 Z.set_size(A_n_rows, A_n_rows);
2780 lapack::cx_gees(&jobvs, &sort, select, &n, T.memptr(), &n, &sdim, w.
memptr(), Z.memptr(), &n, work.
memptr(), &lwork, rwork.
memptr(), bwork.
memptr(), &info);
2788 arma_stop(
"schur_dec(): use of LAPACK needs to be enabled");
2799 template<
typename eT>
2819 #if defined(ARMA_USE_LAPACK) 2846 lapack::trsyl<eT>(&trana, &tranb, &isgn, &m, &n, T1.
memptr(), &m, T2.
memptr(), &n, Y.
memptr(), &m, &scale, &info);
2851 X = Z1 * Y *
trans(Z2);
2853 status = (info == 0);
2857 arma_stop(
"syl(): use of LAPACK needs to be enabled");
2871 template<
typename eT>
2895 template<
typename eT>
2912 const bool status =
solve(vecX, M, vecQ);
arma_aligned const uword n_elem
number of elements held
static arma_inline const eT & tmp_real(const eT &X)
internal function to obtain the real part of either a plain number or a complex number ...
arma_inline const Glue< T1, T2, glue_kron > kron(const Base< typename T1::elem_type, T1 > &A, const Base< typename T1::elem_type, T2 > &B)
kronecker product of two matrices, with the matrices having the same element type ...
arma_inline arma_warn_unused eT * memptr()
returns a pointer to array of eTs used by the matrix
A lightweight array for POD types. If the amount of memory requested is small, the stack is used...
static bool solve_tr(Mat< eT > &out, const Mat< eT > &A, const Mat< eT > &B, const uword layout)
void set_size(const uword in_elem)
change the matrix to have user specified dimensions (data is not preserved)
arma_inline const Op< T1, op_symmat > symmatl(const Base< typename T1::elem_type, T1 > &X)
arma_hot static arma_inline void copy(eT *dest, const eT *src, const uword n_elem)
static eT det_tinymat(const Mat< eT > &X, const uword N)
arma_inline const derived & get_ref() const
static arma_hot void inplace_minus(eT *dest, const eT *src, const uword n_elem)
void shed_rows(const uword in_row1, const uword in_row2)
remove specified rows
static bool lu(Mat< eT > &L, Mat< eT > &U, podarray< blas_int > &ipiv, const Base< eT, T1 > &X)
immediate LU decomposition of a matrix using ATLAS or LAPACK
static arma_inline void apply(Mat< eT > &out, const Mat< eT > &A, const typename arma_not_cx< eT >::result *junk=0)
static void apply(Mat< eT > &out, const Mat< eT > &A)
static bool eig_gen(Col< std::complex< T > > &eigval, Mat< T > &l_eigvec, Mat< T > &r_eigvec, const Base< T, T1 > &X, const char side)
static bool lyap(Mat< eT > &X, const Mat< eT > &A, const Mat< eT > &Q)
const uword n_cols
number of columns in the matrix (read-only)
static arma_hot void apply(Mat< eT > &C, const Mat< eT > &A, const Mat< eT > &B, const eT alpha=eT(1), const eT beta=eT(0), const typename arma_not_cx< eT >::result *junk=0)
arma_inline const T1 & conj(const Base< typename T1::pod_type, T1 > &A)
const uword n_elem
number of elements in the matrix (read-only)
arma_inline const Op< T1, op_max > max(const Base< typename T1::elem_type, T1 > &X, const uword dim=0)
Delayed 'maximum values' operation. The dimension, along which the maxima are found, is set via 'dim'. For dim = 0, the maximum value of each column is found (i.e. searches by traversing across rows). For dim = 1, the maximum value of each row is found (i.e. searches by traversing across columns). The default is dim = 0.
const uword n_rows
number of rows in the matrix (read-only)
static bool eig_sym(Col< eT > &eigval, const Base< eT, T1 > &X)
immediate eigenvalues of a symmetric real matrix using LAPACK
#define arma_extra_debug_print
static bool solve(Mat< eT > &out, Mat< eT > &A, const Mat< eT > &B, const bool slow=false)
static eT det_lapack(const Mat< eT > &X, const bool make_copy)
immediate determinant of a matrix using ATLAS or LAPACK
arma_inline const Op< T1, op_min > min(const Base< typename T1::elem_type, T1 > &X, const uword dim=0)
Delayed 'minimum values' operation. The dimension, along which the minima are found, is set via 'dim'. For dim = 0, the minimum value of each column is found (i.e. searches by traversing across rows). For dim = 1, the minimum value of each row is found (i.e. searches by traversing across columns). The default is dim = 0.
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 bool inv_inplace_lapack(Mat< eT > &out)
arma_inline const Op< T1, op_trimat > trimatu(const Base< typename T1::elem_type, T1 > &X)
Class for column vectors (matrices with only one column)
arma_inline const Op< T1, op_htrans > trans(const Base< typename T1::elem_type, T1 > &X)
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 schur_dec(Mat< eT > &Z, Mat< eT > &T, const Mat< eT > &A)
static bool inv_inplace_tinymat(Mat< eT > &out, const uword N)
static bool inv_sym(Mat< eT > &out, const Base< eT, T1 > &X, const uword layout)
arma_inline const Op< T1, op_symmat > symmatu(const Base< typename T1::elem_type, T1 > &X)
arma_inline arma_warn_unused eT & at(const uword i)
linear element accessor (treats the matrix as a vector); no bounds check.
arma_inline arma_warn_unused bool is_square() const
returns true if the object has the same number of non-zero rows and columnns
#define arma_ignore(variable)
arma_inline const T1 & real(const Base< typename T1::pod_type, T1 > &X)
static bool chol(Mat< eT > &out, const Base< eT, T1 > &X)
static bool inv(Mat< eT > &out, const Base< eT, T1 > &X, const bool slow=false)
immediate matrix inverse
static bool inv_noalias_tinymat(Mat< eT > &out, const Mat< eT > &X, const uword N)
static arma_inline void apply_noalias(Mat< eT > &out, const Mat< eT > &A, const typename arma_not_cx< eT >::result *junk=0)
arma_inline arma_warn_unused bool in_range(const uword i) const
returns true if the given index is currently in range
void arma_cold arma_stop(const T1 &x)
print a message to get_stream_err1() and/or throw a logic_error exception
void copy_size(const Mat< eT2 > &m)
change the matrix (without preserving data) to have the same dimensions as the given matrix ...
arma_inline const Op< T1, op_trimat > trimatl(const Base< typename T1::elem_type, T1 > &X)
static bool dlyap(Mat< eT > &X, const Mat< eT > &A, const Mat< eT > &Q)
#define arma_extra_debug_sigprint
static bool log_det(eT &out_val, typename get_pod_type< eT >::result &out_sign, const Base< eT, T1 > &X)
immediate log determinant of a matrix using ATLAS or LAPACK
static bool solve_ud(Mat< eT > &out, Mat< eT > &A, const Mat< eT > &B)
arma_inline const Op< T1, op_sort > sort(const Base< typename T1::elem_type, T1 > &X, const uword sort_type=0, const uword dim=0)
arma_inline eT * memptr()
void shed_cols(const uword in_col1, const uword in_col2)
remove specified columns
arma_inline const eOp< T1, eop_log > log(const Base< typename T1::elem_type, T1 > &A)
void set_size(const uword new_n_elem)
static eT det(const Base< eT, T1 > &X, const bool slow=false)
static bool inv_sympd(Mat< eT > &out, const Base< eT, T1 > &X, const uword layout)
arma_aligned const eT *const mem
pointer to memory used by the object
static bool solve_od(Mat< eT > &out, Mat< eT > &A, const Mat< eT > &B)
static bool syl(Mat< eT > &X, const Mat< eT > &A, const Mat< eT > &B, const Mat< eT > &C)
static bool inv_tr(Mat< eT > &out, const Base< eT, T1 > &X, const uword layout)
static bool svd(Col< eT > &S, const Base< eT, T1 > &X, uword &n_rows, uword &n_cols)
static bool svd_econ(Mat< eT > &U, Col< eT > &S, Mat< eT > &V, const Base< eT, T1 > &X, const char mode)
static bool qr(Mat< eT > &Q, Mat< eT > &R, const Base< eT, T1 > &X)
void swap_rows(const uword in_row1, const uword in_row2)
arma_inline arma_warn_unused bool is_empty() const
returns true if the matrix has no elements