26 #if defined (HAVE_CONFIG_H)
42 template <
typename MT>
53 template <
typename MT>
58 if (U.issquare () && fact.regular ())
145 int nargin = args.length ();
146 bool issparse = (nargin > 0 && args(0).issparse ());
148 if (nargin < 1 || (issparse && nargin > 3) || (! issparse && nargin > 2))
157 if (args(
n).is_string ())
159 std::string tmp = args(
n++).string_value ();
164 error (
"lu: unrecognized string argument");
169 error (
"lu: can not define pivoting threshold THRESH for full matrices");
171 Matrix tmp = args(
n++).matrix_value ();
172 if (tmp.
numel () == 1)
178 else if (tmp.
numel () == 2)
181 error (
"lu: THRESH must be a 1- or 2-element vector");
186 bool scale = (nargout == 5);
205 "lu: function may fail when called with less than 4 output arguments and a sparse input");
214 retval(0) = fact.Y ();
217 retval.
resize (nargout == 3 ? 3 : 2);
219 =
octave_value (fact.U () * fact.Pc_mat ().transpose (),
221 nc, fact.col_perm ()));
230 nr, fact.row_perm ()));
235 retval(2) = fact.Pr_vec();
253 retval(2) = fact.Pr_vec ();
254 retval(3) = fact.Pc_vec ();
258 retval(2) = fact.Pr_mat ();
259 retval(3) = fact.Pc_mat ();
263 retval(4) = fact.R ();
273 "lu: function may fail when called with less than 4 output arguments and a sparse input");
282 retval(0) = fact.Y ();
285 retval.
resize (nargout == 3 ? 3 : 2);
287 =
octave_value (fact.U () * fact.Pc_mat ().transpose (),
289 nc, fact.col_perm ()));
297 nr, fact.row_perm ()));
302 retval(2) = fact.Pr_vec();
320 retval(2) = fact.Pr_vec ();
321 retval(3) = fact.Pc_vec ();
325 retval(2) = fact.Pr_mat ();
326 retval(3) = fact.Pc_mat ();
330 retval(4) = fact.R ();
348 math::lu<FloatMatrix> fact (
m);
354 retval =
ovl (fact.Y ());
382 math::lu<Matrix> fact (
m);
388 retval =
ovl (fact.Y ());
419 math::lu<FloatComplexMatrix> fact (
m);
425 retval =
ovl (fact.Y ());
453 math::lu<ComplexMatrix> fact (
m);
459 retval =
ovl (fact.Y ());
575 DEFUN (luupdate, args, ,
620 int nargin = args.length ();
622 if (nargin != 4 && nargin != 5)
625 bool pivoted = (nargin == 5);
636 error (
"luupdate: L, U, X, and Y must be numeric");
639 error (
"luupdate: dimension mismatch");
657 math::lu<FloatMatrix> fact (L, U, P);
659 fact.update_piv (
x, y);
675 math::lu<Matrix> fact (L, U, P);
677 fact.update_piv (
x, y);
698 math::lu<FloatComplexMatrix> fact (L, U, P);
700 fact.update_piv (
x, y);
716 math::lu<ComplexMatrix> fact (L, U, P);
718 fact.update_piv (
x, y);
charNDArray min(char d, const charNDArray &m)
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
static OCTAVE_API PermMatrix eye(octave_idx_type n)
OCTAVE_API PermMatrix transpose(void) const
void resize(octave_idx_type n, const octave_value &rfv=octave_value())
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
octave_idx_type rows(void) const
bool isnumeric(void) const
octave_idx_type columns(void) const
FloatMatrix float_matrix_value(bool frc_str_conv=false) const
PermMatrix perm_matrix_value(void) const
bool is_single_type(void) const
bool is_undefined(void) const
Matrix matrix_value(bool frc_str_conv=false) const
bool is_perm_matrix(void) const
FloatComplexMatrix float_complex_matrix_value(bool frc_str_conv=false) const
bool iscomplex(void) const
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void warning_with_id(const char *id, const char *fmt,...)
void error(const char *fmt,...)
void err_wrong_type_arg(const char *name, const char *s)
void scale(Matrix &m, double x, double y, double z)
static bool check_lu_dims(const octave_value &l, const octave_value &u, const octave_value &p)
static octave_value get_lu_u(const math::lu< MT > &fact)
static octave_value get_lu_l(const math::lu< MT > &fact)
F77_RET_T const F77_DBLE * x
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
template class OCTAVE_API sparse_lu< SparseMatrix >
template class OCTAVE_API sparse_lu< SparseComplexMatrix >