23 #if defined (HAVE_CONFIG_H) 38 assert (nd ==
y.ndims ());
43 for (
int i = 0;
i < nd;
i++)
62 m = octave::to_f77_int (tmp_m);
63 n = octave::to_f77_int (tmp_n);
64 k = octave::to_f77_int (tmp_k);
86 int nargin = args.length ();
96 error (
"dot: X and Y must be numeric");
100 bool match = dimx == dimy;
104 dimx = dimx.
redim (1);
106 dimy = dimy.
redim (1);
108 match = dimx == dimy;
112 error (
"dot: sizes of X and Y must match");
118 dim = args(2).int_value (
true) - 1;
121 error (
"dot: DIM must be a valid dimension");
230 template <
typename T>
265 x.data (),
y.data (),
275 x.data (),
y.data (),
284 int nd = dimx.
ndims ();
286 m = octave::to_f77_int (dimx(0));
287 k = octave::to_f77_int (dimx(1));
288 n = octave::to_f77_int (dimy(1));
292 bool match = dimy(0) ==
k && nd == dimy.
ndims ();
298 for (
int i = 2; match &&
i < nd;
i++)
300 match = match && dimx(
i) == dimy(
i);
305 np = octave::to_f77_int (tmp_np);
308 error (
"blkmm: A and B dimensions don't match: (%s) and (%s)",
309 dimx.
str ().c_str (), dimy.
str ().c_str ());
312 template <
typename T>
316 const T
x = octave_value_extract<T> (xov);
317 const T
y = octave_value_extract<T> (yov);
325 if (n != 0 && m != 0)
326 blkmm_internal<T> (
x,
y, z, m, n,
k, np);
331 DEFUN (blkmm, args, ,
350 if (args.length () != 2)
359 error (
"blkmm: A and B must be numeric");
364 retval = do_blkmm<FloatComplexNDArray> (argx, argy);
366 retval = do_blkmm<ComplexNDArray> (argx, argy);
371 retval = do_blkmm<FloatNDArray> (argx, argy);
373 retval = do_blkmm<NDArray> (argx, argy);
OCTINTERP_API octave_value_list feval(const std::string &name, const octave_value_list &args=octave_value_list(), int nargout=0)
std::string str(char sep='x') const
static void get_red_dims(const dim_vector &x, const dim_vector &y, int dim, dim_vector &z, F77_INT &m, F77_INT &n, F77_INT &k)
subroutine cmatm3(m, n, k, np, a, b, c)
subroutine cdotc3(m, n, k, a, b, c)
OCTINTERP_API void print_usage(void)
#define F77_DBLE_CMPLX_ARG(x)
const T * fortran_vec(void) const
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
subroutine smatm3(m, n, k, np, a, b, c)
FloatNDArray float_array_value(bool frc_str_conv=false) const
#define F77_XFCN(f, F, args)
static void get_blkmm_dims(const dim_vector &dimx, const dim_vector &dimy, F77_INT &m, F77_INT &n, F77_INT &k, F77_INT &np, dim_vector &dimz)
subroutine dmatm3(m, n, k, np, a, b, c)
OCTINTERP_API octave_value do_binary_op(octave::type_info &ti, octave_value::binary_op op, const octave_value &a, const octave_value &b)
bool is_single_type(void) const
int first_non_singleton(int def=0) const
dim_vector dims(void) const
subroutine zmatm3(m, n, k, np, a, b, c)
static dim_vector alloc(int n)
subroutine sdot3(m, n, k, a, b, c)
dim_vector redim(int n) const
Force certain dimensionality, preserving numel ().
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
octave_value reshape(const dim_vector &dv) const
#define F77_CONST_DBLE_CMPLX_ARG(x)
T do_blkmm(const octave_value &xov, const octave_value &yov)
double dot(const ColumnVector &v1, const ColumnVector &v2)
octave_f77_int_type F77_INT
void blkmm_internal(const FloatComplexNDArray &x, const FloatComplexNDArray &y, FloatComplexNDArray &z, F77_INT m, F77_INT n, F77_INT k, F77_INT np)
bool isvector(void) const
the element is set to zero In other the statement xample y
#define F77_CONST_CMPLX_ARG(x)
bool iscomplex(void) const
octave_idx_type ndims(void) const
Number of dimensions.
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
Vector representing the dimensions (size) of an Array.
subroutine ddot3(m, n, k, a, b, c)
NDArray array_value(bool frc_str_conv=false) const
bool isnumeric(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 * x
subroutine zdotc3(m, n, k, a, b, c)