84 if (a < 0.0 && !
xisint (b))
105 if (nr == 0 || nc == 0 || nr != nc)
106 error (
"for x^A, A must be a square matrix. Use .^ for elementwise power.");
133 error (
"xpow: matrix diagonalization failed");
156 if (nr == 0 || nc == 0 || nr != nc)
157 error (
"for x^A, A must be a square matrix. Use .^ for elementwise power.");
180 error (
"xpow: matrix diagonalization failed");
195 if (nr == 0 || nc == 0 || nr != nc)
196 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
199 if (static_cast<int> (b) == b)
201 int btmp =
static_cast<int> (b);
220 atmp = a.
inverse (mattype, info, rcond, 1);
223 warning (
"inverse: matrix singular to machine\
224 precision, rcond = %g", rcond);
236 result = result * atmp;
257 lambda(i) =
std::pow (lambda(i), b);
264 error (
"xpow: matrix diagonalization failed");
280 if (nr == 0 || nc == 0 || nr != nc)
281 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
284 if (static_cast<int> (b) == b)
308 int btmp =
static_cast<int> (b);
310 return a.
power (btmp);
324 if (nr == 0 || nc == 0 || nr != nc)
325 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
336 lambda(i) =
std::pow (lambda(i), b);
343 error (
"xpow: matrix diagonalization failed");
356 result =
std::pow (a, static_cast<int> (b));
372 if (nr == 0 || nc == 0 || nr != nc)
373 error (
"for x^A, A must be a square matrix. Use .^ for elementwise power.");
396 error (
"xpow: matrix diagonalization failed");
420 if (nr == 0 || nc == 0 || nr != nc)
421 error (
"for x^A, A must be a square matrix. Use .^ for elementwise power.");
444 error (
"xpow: matrix diagonalization failed");
459 if (nr == 0 || nc == 0 || nr != nc)
460 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
463 if (static_cast<int> (b) == b)
465 int btmp =
static_cast<int> (b);
484 atmp = a.
inverse (mattype, info, rcond, 1);
487 warning (
"inverse: matrix singular to machine\
488 precision, rcond = %g", rcond);
500 result = result * atmp;
521 lambda(i) =
std::pow (lambda(i), b);
528 error (
"xpow: matrix diagonalization failed");
544 if (nr == 0 || nc == 0 || nr != nc)
545 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
556 lambda(i) =
std::pow (lambda(i), b);
563 error (
"xpow: matrix diagonalization failed");
578 if (nr == 0 || nc == 0 || nr != nc)
579 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
595 return xpow (a, static_cast<Complex> (b));
653 result (i, j) =
std::pow (atmp, b (i, j));
666 result (i, j) =
std::pow (a, b (i, j));
689 result (i, j) =
std::pow (atmp, b (i, j));
698 return (a >= 0 && b >= 0) || (a <= 0 && b <= 0);
719 result(i) = (base *= inc);
728 result(i) = (limit *= inc);
772 result (i, j) =
std::pow (a (i, j), b);
793 if (nr != b_nr || nc != b_nc)
799 int convert_to_complex = 0;
804 double atmp = a (i, j);
805 double btmp = b (i, j);
806 if (atmp < 0.0 && static_cast<int> (btmp) != btmp)
808 convert_to_complex = 1;
815 if (convert_to_complex)
825 complex_result (i, j) =
std::pow (atmp, btmp);
828 retval = complex_result;
838 result (i, j) =
std::pow (a (i, j), b (i, j));
876 if (nr != b_nr || nc != b_nc)
907 double btmp = b (i, j);
909 result (i, j) =
std::pow (a, static_cast<int> (btmp));
930 result (i, j) =
std::pow (a, b (i, j));
955 result(i) = (base *= inc);
964 result(i) = (limit *= inc);
991 result (i, j) =
std::pow (a (i, j), static_cast<int> (b));
1000 result (i, j) =
std::pow (a (i, j), b);
1017 if (nr != b_nr || nc != b_nc)
1029 double btmp = b (i, j);
1031 result (i, j) =
std::pow (a (i, j), static_cast<int> (btmp));
1033 result (i, j) =
std::pow (a (i, j), btmp);
1052 result (i, j) =
std::pow (a (i, j), b);
1068 if (nr != b_nr || nc != b_nc)
1080 result (i, j) =
std::pow (a (i, j), b (i, j));
1201 int ib =
static_cast<int> (b);
1205 result(i) = a(i) * a(i);
1210 result(i) = a(i) * a(i) * a(i);
1215 result(i) = 1.0 / a(i);
1241 if (a_dims != b_dims)
1262 bool convert_to_complex =
false;
1269 if (atmp < 0.0 && static_cast<int> (btmp) != btmp)
1271 convert_to_complex =
true;
1278 if (convert_to_complex)
1286 complex_result(i) =
std::pow (atmp, b(i));
1289 retval = complex_result;
1329 if (a_dims != b_dims)
1364 result(i) =
std::pow (a, static_cast<int> (btmp));
1398 result.
xelem (i) = 1.0 / a(i);
1405 result(i) =
std::pow (a(i), static_cast<int> (b));
1428 if (a_dims != b_dims)
1448 result(i) =
std::pow (a(i), static_cast<int> (btmp));
1478 if (a_dims != b_dims)
1529 if (a < 0.0 && !
xisint (b))
1550 if (nr == 0 || nc == 0 || nr != nc)
1551 error (
"for x^A, A must be a square matrix. Use .^ for elementwise power.");
1579 error (
"xpow: matrix diagonalization failed");
1602 if (nr == 0 || nc == 0 || nr != nc)
1603 error (
"for x^A, A must be a square matrix. Use .^ for elementwise power.");
1626 error (
"xpow: matrix diagonalization failed");
1641 if (nr == 0 || nc == 0 || nr != nc)
1642 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
1645 if (static_cast<int> (b) == b)
1647 int btmp =
static_cast<int> (b);
1666 atmp = a.
inverse (mattype, info, rcond, 1);
1669 warning (
"inverse: matrix singular to machine\
1670 precision, rcond = %g", rcond);
1682 result = result * atmp;
1703 lambda(i) =
std::pow (lambda(i), b);
1710 error (
"xpow: matrix diagonalization failed");
1726 if (nr == 0 || nc == 0 || nr != nc)
1727 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
1730 if (static_cast<int> (b) == b)
1759 if (nr == 0 || nc == 0 || nr != nc)
1760 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
1771 lambda(i) =
std::pow (lambda(i), b);
1778 error (
"xpow: matrix diagonalization failed");
1791 result =
std::pow (a, static_cast<int> (b));
1807 if (nr == 0 || nc == 0 || nr != nc)
1808 error (
"for x^A, A must be a square matrix. Use .^ for elementwise power.");
1831 error (
"xpow: matrix diagonalization failed");
1855 if (nr == 0 || nc == 0 || nr != nc)
1856 error (
"for x^A, A must be a square matrix. Use .^ for elementwise power.");
1879 error (
"xpow: matrix diagonalization failed");
1894 if (nr == 0 || nc == 0 || nr != nc)
1895 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
1898 if (static_cast<int> (b) == b)
1900 int btmp =
static_cast<int> (b);
1919 atmp = a.
inverse (mattype, info, rcond, 1);
1922 warning (
"inverse: matrix singular to machine\
1923 precision, rcond = %g", rcond);
1935 result = result * atmp;
1956 lambda(i) =
std::pow (lambda(i), b);
1963 error (
"xpow: matrix diagonalization failed");
1979 if (nr == 0 || nc == 0 || nr != nc)
1980 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
1991 lambda(i) =
std::pow (lambda(i), b);
1998 error (
"xpow: matrix diagonalization failed");
2013 if (nr == 0 || nc == 0 || nr != nc)
2014 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
2030 return xpow (a, static_cast<FloatComplex> (b));
2087 result (i, j) =
std::pow (atmp, b (i, j));
2100 result (i, j) =
std::pow (a, b (i, j));
2123 result (i, j) =
std::pow (atmp, b (i, j));
2149 result (i, j) =
std::pow (atmp, b);
2162 result (i, j) =
std::pow (a (i, j), b);
2183 if (nr != b_nr || nc != b_nc)
2189 int convert_to_complex = 0;
2194 float atmp = a (i, j);
2195 float btmp = b (i, j);
2196 if (atmp < 0.0 && static_cast<int> (btmp) != btmp)
2198 convert_to_complex = 1;
2205 if (convert_to_complex)
2215 complex_result (i, j) =
std::pow (atmp, btmp);
2218 retval = complex_result;
2228 result (i, j) =
std::pow (a (i, j), b (i, j));
2266 if (nr != b_nr || nc != b_nc)
2297 float btmp = b (i, j);
2299 result (i, j) =
std::pow (a, static_cast<int> (btmp));
2301 result (i, j) =
std::pow (a, btmp);
2320 result (i, j) =
std::pow (a, b (i, j));
2341 result (i, j) =
std::pow (a (i, j), static_cast<int> (b));
2350 result (i, j) =
std::pow (a (i, j), b);
2367 if (nr != b_nr || nc != b_nc)
2379 float btmp = b (i, j);
2381 result (i, j) =
std::pow (a (i, j), static_cast<int> (btmp));
2383 result (i, j) =
std::pow (a (i, j), btmp);
2402 result (i, j) =
std::pow (a (i, j), b);
2418 if (nr != b_nr || nc != b_nc)
2430 result (i, j) =
std::pow (a (i, j), b (i, j));
2551 int ib =
static_cast<int> (b);
2555 result(i) = a(i) * a(i);
2560 result(i) = a(i) * a(i) * a(i);
2565 result(i) = 1.0f / a(i);
2591 if (a_dims != b_dims)
2612 bool convert_to_complex =
false;
2619 if (atmp < 0.0 && static_cast<int> (btmp) != btmp)
2621 convert_to_complex =
true;
2628 if (convert_to_complex)
2636 complex_result(i) =
std::pow (atmp, b(i));
2639 retval = complex_result;
2679 if (a_dims != b_dims)
2714 result(i) =
std::pow (a, static_cast<int> (btmp));
2748 result.
xelem (i) = 1.0f / a(i);
2755 result(i) =
std::pow (a(i), static_cast<int> (b));
2778 if (a_dims != b_dims)
2798 result(i) =
std::pow (a(i), static_cast<int> (btmp));
2828 if (a_dims != b_dims)
bool any_element_is_negative(bool=false) const
FloatNDArray octave_value_extract< FloatNDArray >(const octave_value &v)
void gripe_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
octave_value elem_xpow(double a, const Matrix &b)
ComplexMatrix inverse(void) const
octave_idx_type nelem(void) const
ComplexMatrix eigenvectors(void) const
void error(const char *fmt,...)
FloatComplexMatrix eigenvectors(void) const
octave_idx_type rows(void) const
FloatComplexMatrix inverse(void) const
FloatComplexColumnVector eigenvalues(void) const
octave_idx_type rows(void) const
ComplexColumnVector eigenvalues(void) const
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
T dgelem(octave_idx_type i) const
NDArray octave_value_extract< NDArray >(const octave_value &v)
bool all_integers(double &max_val, double &min_val) const
octave_value xpow(double a, double b)
octave_int< T > pow(const octave_int< T > &a, const octave_int< T > &b)
Matrix matrix_value(void) const
bool any_element_is_negative(bool=false) const
OCTAVE_API double D_NINT(double x)
ComplexNDArray bsxfun_pow(const ComplexNDArray &x, const ComplexNDArray &y)
T & xelem(octave_idx_type n)
void warning(const char *fmt,...)
octave_idx_type cols(void) const
charNDArray max(char d, const charNDArray &m)
octave_idx_type length(void) const
Number of elements in the array.
FloatMatrix inverse(void) const
This is a simple wrapper template that will subclass an Array type or any later type derived from ...
static int xisint(double x)
static bool same_sign(double a, double b)
bool all_integers(float &max_val, float &min_val) const
bool all_elements_are_ints(void) const
F77_RET_T const octave_idx_type const octave_idx_type const octave_idx_type double const octave_idx_type double const octave_idx_type double * Q
ColumnVector imag(const ComplexColumnVector &a)
std::complex< float > FloatComplex
std::complex< double > Complex
bool is_valid_bsxfun(const std::string &name, const dim_vector &dx, const dim_vector &dy)
ColumnVector real(const ComplexColumnVector &a)
octave_idx_type cols(void) const
PermMatrix power(octave_idx_type n) const
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
Matrix inverse(void) const
F77_RET_T const double * x
charNDArray min(char d, const charNDArray &m)