37 const octave_idx_type&,
const double*,
38 const double*,
double*);
41 F77_FUNC (
sdot3, SDOT3) (
const octave_idx_type&,
const octave_idx_type&,
42 const octave_idx_type&,
const float*,
43 const float*,
float*);
46 F77_FUNC (
zdotc3, ZDOTC3) (
const octave_idx_type&,
const octave_idx_type&,
47 const octave_idx_type&,
const Complex*,
48 const Complex*, Complex*);
51 F77_FUNC (
cdotc3, CDOTC3) (
const octave_idx_type&,
const octave_idx_type&,
53 const FloatComplex*, FloatComplex*);
56 F77_FUNC (
dmatm3, DMATM3) (
const octave_idx_type&,
const octave_idx_type&,
57 const octave_idx_type&,
const octave_idx_type&,
58 const double*,
const double*,
double*);
61 F77_FUNC (
smatm3, SMATM3) (
const octave_idx_type&,
const octave_idx_type&,
62 const octave_idx_type&,
const octave_idx_type&,
63 const float*,
const float*,
float*);
66 F77_FUNC (
zmatm3, ZMATM3) (
const octave_idx_type&,
const octave_idx_type&,
67 const octave_idx_type&,
const octave_idx_type&,
68 const Complex*,
const Complex*, Complex*);
71 F77_FUNC (
cmatm3, CMATM3) (
const octave_idx_type&,
const octave_idx_type&,
72 const octave_idx_type&,
const octave_idx_type&,
73 const FloatComplex*,
const FloatComplex*,
83 assert (nd == y.
length ());
86 for (
int i = 0; i < nd; i++)
108 @deftypefn {Built-in Function} {} dot (@var{x}, @var{y}, @var{dim})\n\
109 Compute the dot product of two vectors.\n\
111 If @var{x} and @var{y} are matrices, calculate the dot products along the\n\
112 first non-singleton dimension.\n\
114 If the optional argument @var{dim} is given, calculate the dot products\n\
115 along this dimension.\n\
117 This is equivalent to\n\
118 @code{sum (conj (@var{X}) .* @var{Y}, @var{dim})},\n\
119 but avoids forming a temporary array and is faster. When @var{X} and\n\
120 @var{Y} are column vectors, the result is equivalent to\n\
121 @code{@var{X}' * @var{Y}}.\n\
122 @seealso{cross, divergence}\n\
126 int nargin = args.
length ();
128 if (nargin < 2 || nargin > 3)
141 bool match = dimx == dimy;
142 if (! match && nargin == 2
146 dimx = dimx.
redim (1);
148 dimy = dimy.
redim (1);
159 dim = args(2).int_value (
true) - 1;
164 error (
"dot: DIM must be a valid dimension");
229 tmp =
feval (
"sum", tmp, 1);
237 error (
"dot: sizes of X and Y must match");
241 error (
"dot: X and Y must be numeric");
284 DEFUN (blkmm, args, ,
286 @deftypefn {Built-in Function} {} blkmm (@var{A}, @var{B})\n\
287 Compute products of matrix blocks.\n\
289 The blocks are given as 2-dimensional subarrays of the arrays @var{A},\n\
290 @var{B}. The size of @var{A} must have the form @code{[m,k,@dots{}]} and\n\
291 size of @var{B} must be @code{[k,n,@dots{}]}. The result is then of size\n\
292 @code{[m,n,@dots{}]} and is computed as follows:\n\
296 for i = 1:prod (size (@var{A})(3:end))\n\
297 @var{C}(:,:,i) = @var{A}(:,:,i) * @var{B}(:,:,i)\n\
304 int nargin = args.
length ();
328 for (
int i = 2; match && i < nd; i++)
330 match = match && dimx(i) == dimy(i);
389 error (
"blkmm: A and B dimensions don't match: (%s) and (%s)",
390 dimx.
str ().c_str (), dimy.
str ().c_str ());
394 error (
"blkmm: A and B must be numeric");
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
std::string str(char sep= 'x') const
subroutine cmatm3(m, n, k, np, a, b, c)
octave_value reshape(const dim_vector &dv) const
bool is_vector(void) const
subroutine cdotc3(m, n, k, a, b, c)
OCTINTERP_API void print_usage(void)
bool is_numeric_type(void) const
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
subroutine smatm3(m, n, k, np, a, b, c)
octave_value_list feval(const std::string &name, const octave_value_list &args, int nargout)
F77_RET_T const octave_idx_type const octave_idx_type const double const double double *F77_RET_T const octave_idx_type const octave_idx_type const float const float float *F77_RET_T const octave_idx_type const octave_idx_type const Complex const Complex Complex *F77_RET_T const octave_idx_type const octave_idx_type const FloatComplex const FloatComplex FloatComplex *F77_RET_T const octave_idx_type const octave_idx_type const octave_idx_type const double const double double *F77_RET_T const octave_idx_type const octave_idx_type const octave_idx_type const float const float float *F77_RET_T const octave_idx_type const octave_idx_type const octave_idx_type const Complex const Complex Complex *F77_RET_T const octave_idx_type const octave_idx_type const octave_idx_type const FloatComplex const FloatComplex FloatComplex *static void get_red_dims(const dim_vector &x, const dim_vector &y, int dim, dim_vector &z, octave_idx_type &m, octave_idx_type &n, octave_idx_type &k)
F77_RET_T F77_FUNC(ddot3, DDOT3)(const octave_idx_type &
#define F77_XFCN(f, F, args)
int first_non_singleton(int def=0) const
bool is_float_type(void) const
FloatNDArray float_array_value(bool frc_str_conv=false) const
subroutine dmatm3(m, n, k, np, a, b, c)
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
const T * data(void) const
bool is_complex_type(void) const
dim_vector redim(int n) const
octave_idx_type length(void) const
subroutine zmatm3(m, n, k, np, a, b, c)
static dim_vector alloc(int n)
dim_vector dims(void) const
subroutine sdot3(m, n, k, a, b, c)
NDArray array_value(bool frc_str_conv=false) const
double dot(const ColumnVector &v1, const ColumnVector &v2)
std::complex< float > FloatComplex
static bool match(const std::string &filename_arg, const std::string &path_elt_arg)
std::complex< double > Complex
const T * fortran_vec(void) const
bool is_single_type(void) const
subroutine ddot3(m, n, k, a, b, c)
F77_RET_T const double * x
subroutine zdotc3(m, n, k, a, b, c)
octave_value do_binary_op(octave_value::binary_op op, const octave_value &v1, const octave_value &v2)