> I tend to agree with not using the complex conjugate for vecmat, but would
> prefer having
> separate functions for that that make it explicit in the name. I also note
> that mathematicians
> use sesquilinear forms, which have the vector conjugate on the other side, so
> there are
> different
Hi Alan,
The problem with .dot is not that it is not possible, but more that it
is not obvious exactly what will happen given the overloading of
multiple use cases; indeed, this is why `np.matmul` was created. For
the stacks of vectors case in particular, it is surprising that the
vector
On Wed, Jan 24, 2024 at 11:02 PM Marten van Kerkwijk
wrote:
> Stack of matrices in this context is a an ndarray in which the last two
> dimensions are interpreted as columns and rows of matrices (in that
> order), stack of vectors as an ndarray in which the last dimension is
> interpreted as
On Tue, Jan 23, 2024 at 3:18 PM Marten van Kerkwijk
wrote:
> Hi All,
>
> I have a PR [1] that adds `np.matvec` and `np.vecmat` gufuncs for
> matrix-vector and vector-matrix calculations, to add to plain
> matrix-matrix multiplication with `np.matmul` and the inner vector
> product with
> Could you please offer some code or math notation to help communicate this?
> I am forced to guess at the need.
>
> The words "matrix" and "vector" are ambiguous.
> After all, matrices (of given shape) are a type of vector (i.e., can be added
> and scaled.)
> So if by "matrix" you mean "2d
> FWIW, +1 for matvec & vecmat to complement matmat (erm, matmul). Having a
> binop where one argument is a matrix and the other is a
> stack/batch of vectors is indeed awkward otherwise, and a dedicated function
> to clearly distinguish "two matrices" from "a matrix and a
> batch of vectors"
On Wed, Jan 24, 2024 at 2:27 PM Marten van Kerkwijk
wrote:
> > Why do these belong in NumPy? What is the broad field of application of
> these functions? And,
> > does a more general concept underpin them?
>
> Multiplication of a matrix with a vector is about as common as matrix
> with matrix or
On Wed, 24 Jan 2024 at 19:29, Marten van Kerkwijk
wrote:
>
> > Why do these belong in NumPy? What is the broad field of application of
> > these functions? And,
> > does a more general concept underpin them?
>
> Multiplication of a matrix with a vector is about as common as matrix
> with matrix
FWIW, +1 for matvec & vecmat to complement matmat (erm, matmul). Having a
binop where one argument is a matrix and the other is a stack/batch of
vectors is indeed awkward otherwise, and a dedicated function to clearly
distinguish "two matrices" from "a matrix and a batch of vectors" sounds
great
> Why do these belong in NumPy? What is the broad field of application of these
> functions? And,
> does a more general concept underpin them?
Multiplication of a matrix with a vector is about as common as matrix
with matrix or vector with vector, and not currently easy to do for
stacks of
Why do these belong in NumPy? What is the broad field of application of
these functions? And, does a more general concept underpin them?
Thanks, Alan Isaac
On Tue, Jan 23, 2024 at 5:17 PM Marten van Kerkwijk
wrote:
> Hi All,
>
> I have a PR [1] that adds `np.matvec` and `np.vecmat` gufuncs for
> I can understand the desire to generalise the idea of matrix
> multiplication for when the arrays are not both 2-D but taking the
> complex conjugate makes absolutely no sense in the context of matrix
> multiplication.
>
> You note above that "vecmat is defined as x†A" but my interpretation
>
On Tue, 23 Jan 2024 at 23:13, Marten van Kerkwijk
wrote:
>
> >> I also note that for complex numbers, `vecmat` is defined as `x†A`,
> >> i.e., the complex conjugate of the vector is taken. This seems to be the
> >> standard and is what we used for `vecdot` too (`x†x`). However, it is
> >> *not*
>> I also note that for complex numbers, `vecmat` is defined as `x†A`,
>> i.e., the complex conjugate of the vector is taken. This seems to be the
>> standard and is what we used for `vecdot` too (`x†x`). However, it is
>> *not* what `matmul` does for vector-matrix or indeed vector-vector
>>
> For dot product I can convince myself this is a math definition thing and
> accept the
> conjugation. But for "vecmat" why the complex conjugate of the vector? Are we
> assuming that
> 1D things are always columns. I am also a bit lost on the difference of dot,
> vdot and vecdot.
>
> Also if
On Tue, 23 Jan 2024 at 22:18, Marten van Kerkwijk
wrote:
>
> I also note that for complex numbers, `vecmat` is defined as `x†A`,
> i.e., the complex conjugate of the vector is taken. This seems to be the
> standard and is what we used for `vecdot` too (`x†x`). However, it is
> *not* what `matmul`
For dot product I can convince myself this is a math definition thing and
accept the conjugation. But for "vecmat" why the complex conjugate of the
vector? Are we assuming that 1D things are always columns. I am also a bit
lost on the difference of dot, vdot and vecdot.
Also if __matmul__ and
17 matches
Mail list logo