24 #if defined (HAVE_CONFIG_H) 44 #include "mx-cm-cdm.h" 45 #include "mx-fcm-fcdm.h" 61 error (
"Failed to diagonalize matrix while calculating matrix exponential");
67 error (
"for x^y, only square matrix arguments are permitted and one " \
68 "argument must be scalar. Use .^ for elementwise power.");
120 if (nr == 0 || nc == 0 || nr != nc)
146 catch (
const octave::execution_exception&)
171 if (nr == 0 || nc == 0 || nr != nc)
193 catch (
const octave::execution_exception&)
210 if (nr == 0 || nc == 0 || nr != nc)
215 int bint =
static_cast<int> (
b);
234 atmp =
a.inverse (mattype, info, rcond, 1);
237 warning (
"inverse: matrix singular to machine precision, rcond = %g", rcond);
278 catch (
const octave::execution_exception&)
296 if (nr == 0 || nc == 0 || nr != nc)
322 return a.power (static_cast<int> (
b));
336 if (nr == 0 || nc == 0 || nr != nc)
353 catch (
const octave::execution_exception&)
384 if (nr == 0 || nc == 0 || nr != nc)
406 catch (
const octave::execution_exception&)
432 if (nr == 0 || nc == 0 || nr != nc)
454 catch (
const octave::execution_exception&)
471 if (nr == 0 || nc == 0 || nr != nc)
476 int bint =
static_cast<int> (
b);
495 atmp =
a.inverse (mattype, info, rcond, 1);
498 warning (
"inverse: matrix singular to machine precision, rcond = %g", rcond);
539 catch (
const octave::execution_exception&)
557 if (nr == 0 || nc == 0 || nr != nc)
574 catch (
const octave::execution_exception&)
591 if (nr == 0 || nc == 0 || nr != nc)
606 return xpow (
a, static_cast<Complex> (
b));
654 if (
a < 0.0 && !
b.all_integers (d1, d2))
708 return (
a >= 0 &&
b >= 0) || (
a <= 0 &&
b <= 0);
758 if (!
xisint (
b) &&
a.any_element_is_negative ())
806 bool convert_to_complex =
false;
811 double atmp =
a(
i, j);
812 double btmp =
b(
i, j);
813 if (atmp < 0.0 && !
xisint (btmp))
815 convert_to_complex =
true;
822 if (convert_to_complex)
832 complex_result(
i, j) =
std::pow (atmp, btmp);
911 double btmp =
b(
i, j);
990 int bint =
static_cast<int> (
b);
1030 double btmp =
b(
i, j);
1118 if (
a < 0.0 && !
b.all_integers ())
1168 if (
a.any_element_is_negative ())
1197 int ib =
static_cast<int> (
b);
1237 if (a_dims != b_dims)
1251 int len =
a.numel ();
1253 bool convert_to_complex =
false;
1260 if (atmp < 0.0 && !
xisint (btmp))
1262 convert_to_complex =
true;
1269 if (convert_to_complex)
1320 if (a_dims != b_dims)
1381 int bint =
static_cast<int> (
b);
1415 if (a_dims != b_dims)
1460 if (a_dims != b_dims)
1519 if (nr == 0 || nc == 0 || nr != nc)
1546 catch (
const octave::execution_exception&)
1571 if (nr == 0 || nc == 0 || nr != nc)
1593 catch (
const octave::execution_exception&)
1610 if (nr == 0 || nc == 0 || nr != nc)
1615 int bint =
static_cast<int> (
b);
1634 atmp =
a.inverse (mattype, info, rcond, 1);
1637 warning (
"inverse: matrix singular to machine precision, rcond = %g", rcond);
1678 catch (
const octave::execution_exception&)
1696 if (nr == 0 || nc == 0 || nr != nc)
1726 if (nr == 0 || nc == 0 || nr != nc)
1743 catch (
const octave::execution_exception&)
1774 if (nr == 0 || nc == 0 || nr != nc)
1796 catch (
const octave::execution_exception&)
1822 if (nr == 0 || nc == 0 || nr != nc)
1844 catch (
const octave::execution_exception&)
1861 if (nr == 0 || nc == 0 || nr != nc)
1866 int bint =
static_cast<int> (
b);
1885 atmp =
a.inverse (mattype, info, rcond, 1);
1888 warning (
"inverse: matrix singular to machine precision, rcond = %g", rcond);
1929 catch (
const octave::execution_exception&)
1947 if (nr == 0 || nc == 0 || nr != nc)
1964 catch (
const octave::execution_exception&)
1981 if (nr == 0 || nc == 0 || nr != nc)
1996 return xpow (
a, static_cast<FloatComplex> (
b));
2044 if (
a < 0.0 && !
b.all_integers (d1, d2))
2104 if (!
xisint (
b) &&
a.any_element_is_negative ())
2152 bool convert_to_complex =
false;
2157 float atmp =
a(
i, j);
2158 float btmp =
b(
i, j);
2159 if (atmp < 0.0 && !
xisint (btmp))
2161 convert_to_complex =
true;
2168 if (convert_to_complex)
2178 complex_result(
i, j) =
std::pow (atmp, btmp);
2257 float btmp =
b(
i, j);
2297 int bint =
static_cast<int> (
b);
2337 float btmp =
b(
i, j);
2425 if (
a < 0.0 && !
b.all_integers ())
2475 if (
a.any_element_is_negative ())
2506 int ib =
static_cast<int> (
b);
2546 if (a_dims != b_dims)
2560 int len =
a.numel ();
2562 bool convert_to_complex =
false;
2569 if (atmp < 0.0 && !
xisint (btmp))
2571 convert_to_complex =
true;
2578 if (convert_to_complex)
2629 if (a_dims != b_dims)
2690 int bint =
static_cast<int> (
b);
2724 if (a_dims != b_dims)
2769 if (a_dims != b_dims)
static void err_nonsquare_matrix(void)
FloatNDArray octave_value_extract< FloatNDArray >(const octave_value &v)
octave_value elem_xpow(double a, const Matrix &b)
T dgelem(octave_idx_type i) const
bool any_element_is_negative(bool=false) const
bool is_valid_bsxfun(const std::string &name, const dim_vector &xdv, const dim_vector &ydv)
FloatComplexMatrix right_eigenvectors(void) const
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 const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
bool all_elements_are_ints(void) const
void error(const char *fmt,...)
ComplexMatrix right_eigenvectors(void) const
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
NDArray octave_value_extract< NDArray >(const octave_value &v)
octave_value xpow(double a, double b)
Matrix matrix_value(void) const
octave_idx_type numel(void) const
octave_int< T > pow(const octave_int< T > &a, const octave_int< T > &b)
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
ComplexNDArray bsxfun_pow(const ComplexNDArray &x, const ComplexNDArray &y)
With real return the complex result
FloatComplexColumnVector eigenvalues(void) const
void warning(const char *fmt,...)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
charNDArray max(char d, const charNDArray &m)
F77_RET_T const F77_INT const F77_INT const F77_INT F77_DBLE const F77_INT F77_DBLE const F77_INT F77_DBLE * Q
This is a simple wrapper template that will subclass an Array<T> type or any later type derived from ...
static bool same_sign(double a, double b)
static void err_failed_diagonalization(void)
ComplexColumnVector eigenvalues(void) const
ColumnVector imag(const ComplexColumnVector &a)
bool any_element_is_negative(bool=false) const
std::complex< float > FloatComplex
std::complex< double > Complex
ColumnVector real(const ComplexColumnVector &a)
Vector representing the dimensions (size) of an Array.
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 const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
charNDArray min(char d, const charNDArray &m)