26 #if defined (HAVE_CONFIG_H)
60 : a_fact (u), l_fact (l), 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) = a_fact.xelem (i, j);
121 template <
typename T>
131 T u (mn, a_nc,
ELT_T (0.0));
136 u.xelem (i, j) = 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 (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");
277 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
280 F77_INT *pipvt = ipvt.fortran_vec ();
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");
341 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
342 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
344 for (
volatile F77_INT i = 0; i < u_nc; i++)
349 m,
r.fortran_vec (), k,
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++) ipvt(i) += 1;
379 m,
r.fortran_vec (), k,
381 utmp.data (), vtmp.
data (),
w));
382 for (
F77_INT i = 0; i <
m; i++) 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++) ipvt(i) += 1;
410 for (
volatile F77_INT i = 0; i < u_nc; i++)
415 m,
r.fortran_vec (), k,
419 for (
F77_INT i = 0; i <
m; i++) ipvt(i) -= 1;
429 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
432 F77_INT *pipvt = ipvt.fortran_vec ();
439 F77_XFCN (sgetrf, SGETRF, (a_nr, a_nc, tmp_data, a_nr, pipvt, info));
441 for (
F77_INT i = 0; i < mn; i++)
445 #if defined (HAVE_QRUPDATE_LUU)
465 if (u_nel !=
m || v_nel !=
n)
466 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
471 m,
r.fortran_vec (), k,
495 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
496 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
498 for (
volatile F77_INT i = 0; i < u_nc; i++)
503 m,
r.fortran_vec (), k,
526 if (u_nel !=
m || v_nel !=
n)
527 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
532 for (
F77_INT i = 0; i <
m; i++) ipvt(i) += 1;
534 m,
r.fortran_vec (), k,
536 utmp.data (), vtmp.
data (),
w));
537 for (
F77_INT i = 0; i <
m; i++) ipvt(i) -= 1;
560 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
561 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
564 for (
F77_INT i = 0; i <
m; i++) ipvt(i) += 1;
565 for (
volatile F77_INT i = 0; i < u_nc; i++)
570 m,
r.fortran_vec (), k,
574 for (
F77_INT i = 0; i <
m; i++) ipvt(i) -= 1;
584 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
587 F77_INT *pipvt = ipvt.fortran_vec ();
597 for (
F77_INT i = 0; i < mn; i++)
601 #if defined (HAVE_QRUPDATE_LUU)
621 if (u_nel !=
m || v_nel !=
n)
622 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
652 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
653 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
655 for (
volatile F77_INT i = 0; i < u_nc; i++)
686 if (u_nel !=
m || v_nel !=
n)
687 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
692 for (
F77_INT i = 0; i <
m; i++) ipvt(i) += 1;
699 for (
F77_INT i = 0; i <
m; i++) ipvt(i) -= 1;
723 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
724 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
727 for (
F77_INT i = 0; i <
m; i++) ipvt(i) += 1;
728 for (
volatile F77_INT i = 0; i < u_nc; i++)
736 k, ipvt.fortran_vec (),
741 for (
F77_INT i = 0; i <
m; i++) ipvt(i) -= 1;
751 F77_INT mn = (a_nr < a_nc ? a_nr : a_nc);
754 F77_INT *pipvt = ipvt.fortran_vec ();
764 for (
F77_INT i = 0; i < mn; i++)
768 #if defined (HAVE_QRUPDATE_LUU)
788 if (u_nel !=
m || v_nel !=
n)
789 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
820 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
821 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
823 for (
volatile F77_INT i = 0; i < u_nc; i++)
852 if (u_nel !=
m || v_nel !=
n)
853 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
858 for (
F77_INT i = 0; i <
m; i++) ipvt(i) += 1;
865 for (
F77_INT i = 0; i <
m; i++) ipvt(i) -= 1;
889 if (u_nr !=
m || v_nr !=
n || u_nc != v_nc)
890 (*current_liboctave_error_handler) (
"luupdate: dimensions mismatch");
893 for (
F77_INT i = 0; i <
m; i++) ipvt(i) += 1;
894 for (
volatile F77_INT i = 0; i < u_nc; i++)
905 for (
F77_INT i = 0; i <
m; i++) ipvt(i) -= 1;
charNDArray min(char d, const charNDArray &m)
octave_idx_type columns(void) const
T & xelem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type numel(void) const
Number of elements in the array.
const T * data(void) const
Size of the specified dimension.
octave_idx_type rows(void) const
const T * fortran_vec(void) const
Size of the specified dimension.
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(const VT &u, const VT &v)
void update_piv(const VT &u, const VT &v)
ColumnVector P_vec(void) const
Array< octave_idx_type > getp(void) const
#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)
octave_value::octave_value(const Array< char > &chm, char type) return retval
static void transpose(octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *ridx2, octave_idx_type *cidx2)