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);
131 T u (mn, a_nc,
ELT_T (0.0));
136 u.xelem (i, j) = m_a_fact.xelem (i, j);
150 (*current_liboctave_error_handler)
151 (
"lu: Y () not implemented for unpacked form");
205 p.
xelem (i) =
static_cast<double> (pvt.
xelem (i) + 1);
220 if (m_a_fact(i, i) ==
ELT_T ())
230#if ! defined (HAVE_QRUPDATE_LUU)
236 (*current_liboctave_error_handler)
237 (
"luupdate: support for qrupdate with LU updates "
238 "was unavailable or disabled when liboctave was built");
245 (*current_liboctave_error_handler)
246 (
"luupdate: support for qrupdate with LU updates "
247 "was unavailable or disabled when liboctave was built");
254 (*current_liboctave_error_handler)
255 (
"luupdate: support for qrupdate with LU updates "
256 "was unavailable or disabled when liboctave was built");
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.rwdata ();
284 double *tmp_data = m_a_fact.
rwdata ();
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");
319 k, utmp.rwdata (), vtmp.
rwdata ()));
342 if (u_nr != m || v_nr != n || u_nc != v_nc)
343 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
345 for (
F77_INT i = 0; i < u_nc; i++)
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;
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 (
F77_INT i = 0; i < u_nc; i++)
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.rwdata ();
437 float *tmp_data = m_a_fact.
rwdata ();
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");
474 utmp.rwdata (), vtmp.
rwdata ()));
497 if (u_nr != m || v_nr != n || u_nc != v_nc)
498 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
500 for (
F77_INT i = 0; i < u_nc; i++)
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;
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 (
F77_INT i = 0; i < u_nc; i++)
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.rwdata ();
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 (
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;
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 (
F77_INT i = 0; i < u_nc; i++)
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.rwdata ();
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 (
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;
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 (
F77_INT i = 0; i < u_nc; i++)
909 for (
F77_INT i = 0; i < m; i++) m_ipvt(i) -= 1;
924OCTAVE_END_NAMESPACE(math)
925OCTAVE_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)