26 #if defined (HAVE_CONFIG_H)
60 : m_a_fact (u), m_L (l), m_ipvt (p.transpose ().col_perm_vec ())
62 if (l.columns () != u.rows ())
63 (*current_liboctave_error_handler) (
"lu: dimension mismatch");
104 T l (a_nr, mn,
ELT_T (0.0));
109 l.xelem (i, i) = 1.0;
112 l.xelem (i, j) = m_a_fact.xelem (i, j);
121 template <
typename T>
131 T u (mn, a_nc,
ELT_T (0.0));
136 u.xelem (i, j) = m_a_fact.xelem (i, j);
145 template <
typename T>
150 (*current_liboctave_error_handler)
151 (
"lu: Y () not implemented for unpacked form");
156 template <
typename T>
187 template <
typename T>
194 template <
typename T>
205 p.
xelem (i) =
static_cast<double> (pvt.
xelem (i) + 1);
210 template <
typename T>
220 if (m_a_fact(i, i) ==
ELT_T ())
230 #if ! defined (HAVE_QRUPDATE_LUU)
232 template <
typename T>
236 (*current_liboctave_error_handler)
237 (
"luupdate: support for qrupdate with LU updates "
238 "was unavailable or disabled when liboctave was built");
241 template <
typename T>
245 (*current_liboctave_error_handler)
246 (
"luupdate: support for qrupdate with LU updates "
247 "was unavailable or disabled when liboctave was built");
250 template <
typename T>
254 (*current_liboctave_error_handler)
255 (
"luupdate: support for qrupdate with LU updates "
256 "was unavailable or disabled when liboctave was built");
259 template <
typename T>
263 (*current_liboctave_error_handler)
264 (
"luupdate: support for qrupdate with LU updates "
265 "was unavailable or disabled when liboctave was built");
278 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
281 F77_INT *pipvt = m_ipvt.fortran_vec ();
288 F77_XFCN (dgetrf, DGETRF, (a_nr, a_nc, tmp_data, a_nr, pipvt, info));
290 for (
F77_INT i = 0; i < mn; i++)
294 #if defined (HAVE_QRUPDATE_LUU)
313 if (u_nel !=
m || v_nel !=
n)
314 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
342 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
343 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
345 for (
volatile F77_INT i = 0; i < u_nc; i++)
350 m,
r.fortran_vec (), k,
372 if (u_nel !=
m || v_nel !=
n)
373 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
378 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) += 1;
380 m,
r.fortran_vec (), k,
381 m_ipvt.fortran_vec (),
382 utmp.data (), vtmp.
data (),
w));
383 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) -= 1;
406 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
407 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
410 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) += 1;
411 for (
volatile F77_INT i = 0; i < u_nc; i++)
416 m,
r.fortran_vec (), k,
417 m_ipvt.fortran_vec (),
420 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) -= 1;
431 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
434 F77_INT *pipvt = m_ipvt.fortran_vec ();
441 F77_XFCN (sgetrf, SGETRF, (a_nr, a_nc, tmp_data, a_nr, pipvt, info));
443 for (
F77_INT i = 0; i < mn; i++)
447 #if defined (HAVE_QRUPDATE_LUU)
467 if (u_nel !=
m || v_nel !=
n)
468 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
473 m,
r.fortran_vec (), k,
497 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
498 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
500 for (
volatile F77_INT i = 0; i < u_nc; i++)
505 m,
r.fortran_vec (), k,
528 if (u_nel !=
m || v_nel !=
n)
529 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
534 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) += 1;
536 m,
r.fortran_vec (), k,
537 m_ipvt.fortran_vec (),
538 utmp.data (), vtmp.
data (),
w));
539 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) -= 1;
562 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
563 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
566 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) += 1;
567 for (
volatile F77_INT i = 0; i < u_nc; i++)
572 m,
r.fortran_vec (), k,
573 m_ipvt.fortran_vec (),
576 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) -= 1;
587 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
590 F77_INT *pipvt = m_ipvt.fortran_vec ();
600 for (
F77_INT i = 0; i < mn; i++)
604 #if defined (HAVE_QRUPDATE_LUU)
624 if (u_nel !=
m || v_nel !=
n)
625 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
655 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
656 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
658 for (
volatile F77_INT i = 0; i < u_nc; i++)
689 if (u_nel !=
m || v_nel !=
n)
690 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
695 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) += 1;
698 m_ipvt.fortran_vec (),
702 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) -= 1;
726 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
727 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
730 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) += 1;
731 for (
volatile F77_INT i = 0; i < u_nc; i++)
739 k, m_ipvt.fortran_vec (),
744 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) -= 1;
755 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
758 F77_INT *pipvt = m_ipvt.fortran_vec ();
768 for (
F77_INT i = 0; i < mn; i++)
772 #if defined (HAVE_QRUPDATE_LUU)
792 if (u_nel !=
m || v_nel !=
n)
793 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
824 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
825 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
827 for (
volatile F77_INT i = 0; i < u_nc; i++)
856 if (u_nel !=
m || v_nel !=
n)
857 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
862 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) += 1;
865 m_ipvt.fortran_vec (),
869 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) -= 1;
893 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
894 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
897 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) += 1;
898 for (
volatile F77_INT i = 0; i < u_nc; i++)
904 m_ipvt.fortran_vec (),
909 for (
F77_INT i = 0; i <
m; i++) m_ipvt(i) -= 1;
924 OCTAVE_END_NAMESPACE(math)
925 OCTAVE_END_NAMESPACE(
octave)
charNDArray min(char d, const charNDArray &m)
T * fortran_vec()
Size of the specified dimension.
octave_idx_type rows() const
const T * data() const
Size of the specified dimension.
octave_idx_type columns() const
T & xelem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type numel() const
Number of elements in the array.
ComplexColumnVector column(octave_idx_type i) const
FloatComplexColumnVector column(octave_idx_type i) const
FloatColumnVector column(octave_idx_type i) const
ColumnVector column(octave_idx_type i) const
Vector representing the dimensions (size) of an Array.
void update_piv(const VT &u, const VT &v)
ColumnVector P_vec() const
void update(const VT &u, const VT &v)
Array< octave_idx_type > getp() const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define F77_CONST_CMPLX_ARG(x)
#define F77_DBLE_CMPLX_ARG(x)
#define F77_XFCN(f, F, args)
octave_f77_int_type F77_INT
#define F77_CONST_DBLE_CMPLX_ARG(x)
std::complex< double > w(std::complex< double > z, double relerr=0)
std::complex< double > Complex
std::complex< float > FloatComplex
#define OCTAVE_LOCAL_BUFFER(T, buf, size)