26 #if defined (HAVE_CONFIG_H)
33 #include "builtin-defun-decls.h"
43 assert (nd == y.
ndims ());
48 for (
int i = 0; i < nd; i++)
67 m = octave::to_f77_int (tmp_m);
68 n = octave::to_f77_int (tmp_n);
69 k = octave::to_f77_int (tmp_k);
92 int nargin = args.length ();
94 if (nargin < 2 || nargin > 3)
102 error (
"dot: X and Y must be numeric");
106 bool match = dimx == dimy;
110 dimx = dimx.
redim (1);
112 dimy = dimy.
redim (1);
114 match = dimx == dimy;
118 error (
"dot: sizes of X and Y must match");
124 dim = args(2).int_value (
true) - 1;
127 error (
"dot: DIM must be a valid dimension");
247 template <
typename T>
282 x.data (), y.
data (),
292 x.data (), y.
data (),
301 int nd = dimx.
ndims ();
303 m = octave::to_f77_int (dimx(0));
304 k = octave::to_f77_int (dimx(1));
305 n = octave::to_f77_int (dimy(1));
309 bool match = ((dimy(0) == k) && (nd == dimy.
ndims ()));
315 for (
int i = 2; match && i < nd; i++)
317 match = (dimx(i) == dimy(i));
322 np = octave::to_f77_int (tmp_np);
325 error (
"blkmm: A and B dimensions don't match: (%s) and (%s)",
326 dimx.
str ().c_str (), dimy.
str ().c_str ());
329 template <
typename T>
333 const T
x = octave_value_extract<T> (xov);
334 const T y = octave_value_extract<T> (yov);
342 if (
n != 0 &&
m != 0)
343 blkmm_internal<T> (
x, y, z,
m,
n, k, np);
348 DEFUN (blkmm, args, ,
367 if (args.length () != 2)
376 error (
"blkmm: A and B must be numeric");
381 retval = do_blkmm<FloatComplexNDArray> (argx, argy);
383 retval = do_blkmm<ComplexNDArray> (argx, argy);
388 retval = do_blkmm<FloatNDArray> (argx, argy);
390 retval = do_blkmm<NDArray> (argx, argy);
subroutine cdotc3(m, n, k, a, b, c)
const T * data(void) const
Size of the specified dimension.
const T * fortran_vec(void) const
Size of the specified dimension.
Vector representing the dimensions (size) of an Array.
std::string str(char sep='x') const
static dim_vector alloc(int n)
bool isvector(void) const
int first_non_singleton(int def=0) const
octave_idx_type ndims(void) const
Number of dimensions.
dim_vector redim(int n) const
Force certain dimensionality, preserving numel ().
bool isnumeric(void) const
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
octave_value reshape(const dim_vector &dv) const
NDArray array_value(bool frc_str_conv=false) const
bool is_single_type(void) const
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
FloatNDArray float_array_value(bool frc_str_conv=false) const
bool iscomplex(void) const
dim_vector dims(void) const
subroutine cmatm3(m, n, k, np, a, b, c)
OCTAVE_EXPORT octave_value_list Fsum(const octave_value_list &args, int)
subroutine ddot3(m, n, k, a, b, c)
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
subroutine dmatm3(m, n, k, np, a, b, c)
T do_blkmm(const octave_value &xov, const octave_value &yov)
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)
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)
void blkmm_internal(const T &x, const T &y, T &z, F77_INT m, F77_INT n, F77_INT k, F77_INT np)
void error(const char *fmt,...)
#define F77_CONST_CMPLX_ARG(x)
#define F77_DBLE_CMPLX_ARG(x)
#define F77_XFCN(f, F, args)
octave_f77_int_type F77_INT
#define F77_CONST_DBLE_CMPLX_ARG(x)
double dot(const ColumnVector &v1, const ColumnVector &v2)
F77_RET_T const F77_DBLE * x
octave_value::octave_value(const Array< char > &chm, char type) return retval
OCTINTERP_API octave_value do_binary_op(octave::type_info &ti, octave_value::binary_op op, const octave_value &a, const octave_value &b)
subroutine sdot3(m, n, k, a, b, c)
subroutine smatm3(m, n, k, np, a, b, c)
subroutine zdotc3(m, n, k, a, b, c)
subroutine zmatm3(m, n, k, np, a, b, c)