24 #if defined (HAVE_CONFIG_H)
39 template <
typename Matrix>
45 const element_type
zero = element_type ();
47 bool singular =
false;
68 element_type *colj = Tp + n*j;
70 colj[j] =
sqrt (colj[j]);
76 const element_type *coli = Tp + n*
i;
77 const element_type colji = colj[
i] /= (coli[
i] + colj[j]);
79 colj[
k] -= coli[
k] * colji;
85 "sqrtm: matrix is singular, may not have a square root");
88 template <
typename Matrix,
typename ComplexMatrix,
typename ComplexSCHUR>
101 real_type cutoff = 0;
103 real_type
eps = std::numeric_limits<real_type>::epsilon ();
145 cutoff = 10 * x.
rows () * eps *
xnorm (x, one);
177 ComplexSCHUR schur_fact (x,
"",
true);
178 x = schur_fact.schur_matrix ();
179 u = schur_fact.unitary_matrix ();
188 if (cutoff > 0 &&
xnorm (
imag (res), one) <= cutoff)
212 if (
args.length () != 1)
220 if (n != nc || arg.
ndims () > 2)
Matrix diag(octave_idx_type k=0) const
void warning_with_id(const char *id, const char *fmt,...)
bool any_element_is_negative(bool=false) const
octave_idx_type rows(void) const
static octave_value do_sqrtm(const octave_value &arg)
bool is_unknown(void) const
OCTINTERP_API void print_usage(void)
bool is_numeric_type(void) const
#define DEFUN(name, args_name, nargout_name, doc)
void err_square_matrix_required(const char *fcn, const char *name)
octave_idx_type rows(void) const
octave_idx_type columns(void) const
int type(bool quiet=true)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
bool is_complex_type(void) const
Matrix transpose(void) const
OCTAVE_API double xnorm(const ColumnVector &x, double p)
ComplexMatrix transpose(void) const
MatrixType matrix_type(void) const
ComplexMatrix xgemm(const ComplexMatrix &a, const ComplexMatrix &b, blas_trans_type transa, blas_trans_type transb)
OCTAVE_API double xfrobnorm(const Matrix &x)
=val(i)}if ode{val(i)}occurs in table i
ColumnVector imag(const ComplexColumnVector &a)
static void sqrtm_utri_inplace(Matrix &T)
ComplexMatrix octave_value_extract< ComplexMatrix >(const octave_value &v)
const T * fortran_vec(void) const
bool is_single_type(void) const
ColumnVector real(const ComplexColumnVector &a)
Matrix octave_value_extract< Matrix >(const octave_value &v)
octave_value sqrt(void) const
bool is_diag_matrix(void) const
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x