26 #if defined (HAVE_CONFIG_H)
69 if (nr == 0 || nc == 0)
74 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
77 error (
"use full(a) ^ full(b)");
79 int btmp =
static_cast<int> (b);
107 atmp = a.
inverse (mattyp, info, rcond, 1);
110 warning (
"inverse: matrix singular to machine precision, rcond = %g", rcond);
115 if (atmp.
nnz () == 0)
145 uint64_t sparsity = atmp.
numel () / atmp.
nnz ();
146 int threshold = (sparsity >= 1000) ? 40
147 : (sparsity >= 100) ? 20
150 if (btmp > threshold)
155 result = result * atmp;
165 for (
int i = 0; i < btmp; i++)
166 result = result * atmp;
183 if (nr == 0 || nc == 0)
188 error (
"for A^b, A must be a square matrix. Use .^ for elementwise power.");
191 error (
"use full(a) ^ full(b)");
193 int btmp =
static_cast<int> (b);
218 atmp = a.
inverse (mattyp, info, rcond, 1);
221 warning (
"inverse: matrix singular to machine precision, rcond = %g", rcond);
226 if (atmp.
nnz () == 0)
239 uint64_t sparsity = atmp.
numel () / atmp.
nnz ();
240 int threshold = (sparsity >= 1000) ? 40
241 : (sparsity >= 100) ? 20
244 if (btmp > threshold)
249 result = result * atmp;
259 for (
int i = 0; i < btmp; i++)
260 result = result * atmp;
304 template <
typename S,
typename SM>
366 result(i, j) =
std::pow (atmp, b(i, j));
381 result(i, j) =
std::pow (a, b(i, j));
406 result(i, j) =
std::pow (atmp, b(i, j));
518 if (nr != b_nr || nc != b_nc)
521 int convert_to_complex = 0;
527 double btmp = b (a.
ridx (i), j);
530 convert_to_complex = 1;
543 if (convert_to_complex)
557 retval = complex_result;
620 if (nr != b_nr || nc != b_nc)
652 double btmp = b (i, j);
654 result (i, j) =
std::pow (a,
static_cast<int> (btmp));
675 result (i, j) =
std::pow (a, b (i, j));
700 result (a.
ridx (i), j)
760 if (nr != b_nr || nc != b_nc)
769 double btmp = b(a.
ridx (i), j);
773 static_cast<int> (btmp));
827 if (nr != b_nr || nc != b_nc)
charNDArray max(char d, const charNDArray &m)
charNDArray min(char d, const charNDArray &m)
OCTAVE_API SparseComplexMatrix inverse(void) const
OCTAVE_API bool all_integers(double &max_val, double &min_val) const
OCTAVE_API SparseMatrix inverse(void) const
OCTAVE_API bool any_element_is_negative(bool=false) const
octave_idx_type rows(void) const
octave_idx_type * cidx(void)
octave_idx_type * ridx(void)
octave_idx_type nnz(void) const
Actual number of nonzero terms.
dim_vector dims(void) const
Sparse< T, Alloc > maybe_compress(bool remove_zeros=false)
T & xelem(octave_idx_type n)
octave_idx_type cols(void) const
octave_idx_type numel(void) const
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
Matrix matrix_value(bool frc_str_conv=false) const
bool iscomplex(void) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void warning(const char *fmt,...)
void error(const char *fmt,...)
void err_nonconformant(const char *op, octave_idx_type op1_len, octave_idx_type op2_len)
F77_RET_T const F77_DBLE * x
class OCTAVE_API SparseMatrix
class OCTAVE_API SparseComplexMatrix
std::complex< double > Complex
octave_int< T > pow(const octave_int< T > &a, const octave_int< T > &b)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value xpow(const SparseMatrix &a, double b)
octave_value elem_xpow(double a, const SparseMatrix &b)
octave_value scalar_xpow(const S &a, const SM &b)
static bool xisint(double x)