26#if defined (HAVE_CONFIG_H)
59 : m_a_fact (u), m_L (l), m_ipvt (p.transpose ().col_perm_vec ())
61 if (l.columns () != u.rows ())
62 (*current_liboctave_error_handler) (
"lu: dimension mismatch");
103 T l (a_nr, mn,
ELT_T (0.0));
108 l.xelem (i, i) = 1.0;
111 l.xelem (i, j) = m_a_fact.xelem (i, j);
130 T u (mn, a_nc,
ELT_T (0.0));
135 u.xelem (i, j) = m_a_fact.xelem (i, j);
149 (*current_liboctave_error_handler)
150 (
"lu: Y () not implemented for unpacked form");
204 p.
xelem (i) =
static_cast<double> (pvt.
xelem (i) + 1);
219 if (m_a_fact(i, i) ==
ELT_T ())
229#if ! defined (HAVE_QRUPDATE_LUU)
235 (*current_liboctave_error_handler)
236 (
"luupdate: support for qrupdate with LU updates "
237 "was unavailable or disabled when liboctave was built");
244 (*current_liboctave_error_handler)
245 (
"luupdate: support for qrupdate with LU updates "
246 "was unavailable or disabled when liboctave was built");
253 (*current_liboctave_error_handler)
254 (
"luupdate: support for qrupdate with LU updates "
255 "was unavailable or disabled when liboctave was built");
262 (*current_liboctave_error_handler)
263 (
"luupdate: support for qrupdate with LU updates "
264 "was unavailable or disabled when liboctave was built");
277 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
280 F77_INT *pipvt = m_ipvt.rwdata ();
283 double *tmp_data = m_a_fact.
rwdata ();
287 F77_XFCN (dgetrf, DGETRF, (a_nr, a_nc, tmp_data, a_nr, pipvt, info));
289 for (
F77_INT i = 0; i < mn; i++)
293#if defined (HAVE_QRUPDATE_LUU)
312 if (u_nel != m || v_nel != n)
313 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
318 k, utmp.rwdata (), vtmp.
rwdata ()));
341 if (u_nr != m || v_nr != n || u_nc != v_nc)
342 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
344 for (
F77_INT i = 0; i < u_nc; i++)
371 if (u_nel != m || v_nel != n)
372 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
377 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) += 1;
381 utmp.data (), vtmp.
data (), w));
382 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1;
405 if (u_nr != m || v_nr != n || u_nc != v_nc)
406 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
409 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) += 1;
410 for (
F77_INT i = 0; i < u_nc; i++)
419 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1;
430 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
433 F77_INT *pipvt = m_ipvt.rwdata ();
436 float *tmp_data = m_a_fact.
rwdata ();
440 F77_XFCN (sgetrf, SGETRF, (a_nr, a_nc, tmp_data, a_nr, pipvt, info));
442 for (
F77_INT i = 0; i < mn; i++)
446#if defined (HAVE_QRUPDATE_LUU)
466 if (u_nel != m || v_nel != n)
467 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
473 utmp.rwdata (), vtmp.
rwdata ()));
496 if (u_nr != m || v_nr != n || u_nc != v_nc)
497 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
499 for (
F77_INT i = 0; i < u_nc; i++)
527 if (u_nel != m || v_nel != n)
528 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
533 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) += 1;
537 utmp.data (), vtmp.
data (), w));
538 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1;
561 if (u_nr != m || v_nr != n || u_nc != v_nc)
562 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
565 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) += 1;
566 for (
F77_INT i = 0; i < u_nc; i++)
575 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1;
586 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
589 F77_INT *pipvt = m_ipvt.rwdata ();
599 for (
F77_INT i = 0; i < mn; i++)
603#if defined (HAVE_QRUPDATE_LUU)
623 if (u_nel != m || v_nel != n)
624 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
654 if (u_nr != m || v_nr != n || u_nc != v_nc)
655 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
657 for (
F77_INT i = 0; i < u_nc; i++)
688 if (u_nel != m || v_nel != n)
689 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
694 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) += 1;
701 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1;
725 if (u_nr != m || v_nr != n || u_nc != v_nc)
726 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
729 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) += 1;
730 for (
F77_INT i = 0; i < u_nc; i++)
743 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1;
754 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
757 F77_INT *pipvt = m_ipvt.rwdata ();
767 for (
F77_INT i = 0; i < mn; i++)
771#if defined (HAVE_QRUPDATE_LUU)
791 if (u_nel != m || v_nel != n)
792 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
823 if (u_nr != m || v_nr != n || u_nc != v_nc)
824 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
826 for (
F77_INT i = 0; i < u_nc; i++)
855 if (u_nel != m || v_nel != n)
856 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
861 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) += 1;
868 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1;
892 if (u_nr != m || v_nr != n || u_nc != v_nc)
893 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
896 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) += 1;
897 for (
F77_INT i = 0; i < u_nc; i++)
908 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1;
923OCTAVE_END_NAMESPACE(math)
924OCTAVE_END_NAMESPACE(octave)
N Dimensional Array with copy-on-write semantics.
T & xelem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type rows() const
octave_idx_type columns() const
const T * data() const
Size of the specified dimension.
T * rwdata()
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 > Complex
std::complex< float > FloatComplex
#define OCTAVE_LOCAL_BUFFER(T, buf, size)