RW
Rogier Wolff
Wed, Apr 3, 2019 10:35 AM
On Wed, Apr 03, 2019 at 11:22:54AM +0100, nop head wrote:
I don't think there is any distinction in
maths: one dimensional matrices are vectors. It is just computer science
where matrices are often lists of lists and vectors are just lists
No. In math there is a difference between column vectors and
row-vectors. If you multiply a column vector with a row vector one way
and you get a matrix, multiply them the other way around, you get a
scalar.
It is computer science that cannot simply distiguish between the two:
a vector is a vector. As you say: you can make an Nx1 and an 1xN
matrices to show the difference.
Roger.
--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.
On Wed, Apr 03, 2019 at 11:22:54AM +0100, nop head wrote:
> I don't think there is any distinction in
> maths: one dimensional matrices are vectors. It is just computer science
> where matrices are often lists of lists and vectors are just lists
No. In math there is a difference between column vectors and
row-vectors. If you multiply a column vector with a row vector one way
and you get a matrix, multiply them the other way around, you get a
scalar.
It is computer science that cannot simply distiguish between the two:
a vector is a vector. As you say: you can make an Nx1 and an 1xN
matrices to show the difference.
Roger.
--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.
NH
nop head
Wed, Apr 3, 2019 10:48 AM
I meant there are no 1xn or nx1 matrices in maths, they are just row or
column vectors.
On Wed, 3 Apr 2019 at 11:36, Rogier Wolff R.E.Wolff@bitwizard.nl wrote:
On Wed, Apr 03, 2019 at 11:22:54AM +0100, nop head wrote:
I don't think there is any distinction in
maths: one dimensional matrices are vectors. It is just computer science
where matrices are often lists of lists and vectors are just lists
No. In math there is a difference between column vectors and
row-vectors. If you multiply a column vector with a row vector one way
and you get a matrix, multiply them the other way around, you get a
scalar.
It is computer science that cannot simply distiguish between the two:
a vector is a vector. As you say: you can make an Nx1 and an 1xN
matrices to show the difference.
Roger.
--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
**
** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
I meant there are no 1xn or nx1 matrices in maths, they are just row or
column vectors.
On Wed, 3 Apr 2019 at 11:36, Rogier Wolff <R.E.Wolff@bitwizard.nl> wrote:
> On Wed, Apr 03, 2019 at 11:22:54AM +0100, nop head wrote:
> > I don't think there is any distinction in
> > maths: one dimensional matrices are vectors. It is just computer science
> > where matrices are often lists of lists and vectors are just lists
>
> No. In math there is a difference between column vectors and
> row-vectors. If you multiply a column vector with a row vector one way
> and you get a matrix, multiply them the other way around, you get a
> scalar.
>
> It is computer science that cannot simply distiguish between the two:
> a vector is a vector. As you say: you can make an Nx1 and an 1xN
> matrices to show the difference.
>
> Roger.
>
> --
> ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
> **
> ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **
> The plan was simple, like my brother-in-law Phil. But unlike
> Phil, this plan just might work.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
RW
Rogier Wolff
Wed, Apr 3, 2019 10:53 AM
On Wed, Apr 03, 2019 at 11:48:44AM +0100, nop head wrote:
I meant there are no 1xn or nx1 matrices in maths, they are just row or
column vectors.
Oh, ok. I think in maths a 1xN or Nx1 matrix is precisely equivalent
to the corresponding vector.
Everything is a matrix, what is commonly known as a vector is a matrix
with one dimension "1". What is commonly known as a "scalar" is a
matrix with both dimensions "1"....
Roger.
--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.
On Wed, Apr 03, 2019 at 11:48:44AM +0100, nop head wrote:
> I meant there are no 1xn or nx1 matrices in maths, they are just row or
> column vectors.
Oh, ok. I think in maths a 1xN or Nx1 matrix is precisely equivalent
to the corresponding vector.
Everything is a matrix, what is commonly known as a vector is a matrix
with one dimension "1". What is commonly known as a "scalar" is a
matrix with both dimensions "1"....
Roger.
--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 **
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.
TV
Tim V. Shaporev
Wed, Apr 3, 2019 10:58 AM
It is... er... matter of definitions.
If scalar was 1x1 matrix you could not multiply MxN matrix by scalar.
On 4/3/2019 1:53 PM, Rogier Wolff wrote:
On Wed, Apr 03, 2019 at 11:48:44AM +0100, nop head wrote:
I meant there are no 1xn or nx1 matrices in maths, they are just row or
column vectors.
Oh, ok. I think in maths a 1xN or Nx1 matrix is precisely equivalent
to the corresponding vector.
Everything is a matrix, what is commonly known as a vector is a matrix
with one dimension "1". What is commonly known as a "scalar" is a
matrix with both dimensions "1"....
Roger.
It is... er... matter of definitions.
If scalar was 1x1 matrix you could not multiply MxN matrix by scalar.
On 4/3/2019 1:53 PM, Rogier Wolff wrote:
> On Wed, Apr 03, 2019 at 11:48:44AM +0100, nop head wrote:
>> I meant there are no 1xn or nx1 matrices in maths, they are just row or
>> column vectors.
>
> Oh, ok. I think in maths a 1xN or Nx1 matrix is precisely equivalent
> to the corresponding vector.
>
> Everything is a matrix, what is commonly known as a vector is a matrix
> with one dimension "1". What is commonly known as a "scalar" is a
> matrix with both dimensions "1"....
>
> Roger.
>
RP
Ronaldo Persiano
Wed, Apr 3, 2019 3:24 PM
Let me try to summarize this discussion regarding OpenSCAD codes:
a) matrices in OpenSCAD are list of lists of scalars; simple vectors (list
of scalars) are not matrices;
b) as such, vectors can't be transposed like matrices;
c) in products vM, where v is a vector and M an appropriate matrix, v may
be regarded as a row matrix;
d) in products Mv, v may be regarded as a column matrix;
e) vM == T(M)v and vT(M) == Mv where T is the transpose operator;
f) vw is a scalar when v and w are vectors of same dimension.
g) the product of a matrix 1xn by a matrix nXm is a matrix 1xm which is not
a m-dimensional vector;
h) T(QR) = T(R)*T(Q) for any matrix Q nXm and matrix R mXk where T is the
transpose operator.
So, OpenSCAD matrix multiplications agree the mathematical equivalent. The
differences between math and OpenSCAD are just the a), b) and d) above.
Let me try to summarize this discussion regarding OpenSCAD codes:
a) matrices in OpenSCAD are list of lists of scalars; simple vectors (list
of scalars) are not matrices;
b) as such, vectors can't be transposed like matrices;
c) in products v*M, where v is a vector and M an appropriate matrix, v may
be regarded as a row matrix;
d) in products M*v, v may be regarded as a column matrix;
e) v*M == T(M)*v and v*T(M) == M*v where T is the transpose operator;
f) v*w is a scalar when v and w are vectors of same dimension.
g) the product of a matrix 1xn by a matrix nXm is a matrix 1xm which is not
a m-dimensional vector;
h) T(Q*R) = T(R)*T(Q) for any matrix Q nXm and matrix R mXk where T is the
transpose operator.
So, OpenSCAD matrix multiplications agree the mathematical equivalent. The
differences between math and OpenSCAD are just the a), b) and d) above.
NH
nop head
Wed, Apr 3, 2019 3:50 PM
True but in maths a "row vector" and a "row matrix" are alternative names
for the exactly same thing, similarly with column vector and column matrix.
In OpenSCAD they are different things. So you can pass an actual row matrix
as the first operand of a multiplication by a matrix and receive a row
matrix back, or you can pass a vector that will be treated as a row vector
and get a vector back. So using "row matrix" and column matrix" in c) and
d) could be a little confusing.
On Wed, 3 Apr 2019 at 16:25, Ronaldo Persiano rcmpersiano@gmail.com wrote:
Let me try to summarize this discussion regarding OpenSCAD codes:
a) matrices in OpenSCAD are list of lists of scalars; simple vectors (list
of scalars) are not matrices;
b) as such, vectors can't be transposed like matrices;
c) in products vM, where v is a vector and M an appropriate matrix, v may
be regarded as a row matrix;
d) in products Mv, v may be regarded as a column matrix;
e) vM == T(M)v and vT(M) == Mv where T is the transpose operator;
f) vw is a scalar when v and w are vectors of same dimension.
g) the product of a matrix 1xn by a matrix nXm is a matrix 1xm which is
not a m-dimensional vector;
h) T(QR) = T(R)*T(Q) for any matrix Q nXm and matrix R mXk where T is the
transpose operator.
So, OpenSCAD matrix multiplications agree the mathematical equivalent. The
differences between math and OpenSCAD are just the a), b) and d) above.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
True but in maths a "row vector" and a "row matrix" are alternative names
for the exactly same thing, similarly with column vector and column matrix.
In OpenSCAD they are different things. So you can pass an actual row matrix
as the first operand of a multiplication by a matrix and receive a row
matrix back, or you can pass a vector that will be treated as a row vector
and get a vector back. So using "row matrix" and column matrix" in c) and
d) could be a little confusing.
On Wed, 3 Apr 2019 at 16:25, Ronaldo Persiano <rcmpersiano@gmail.com> wrote:
> Let me try to summarize this discussion regarding OpenSCAD codes:
>
> a) matrices in OpenSCAD are list of lists of scalars; simple vectors (list
> of scalars) are not matrices;
> b) as such, vectors can't be transposed like matrices;
> c) in products v*M, where v is a vector and M an appropriate matrix, v may
> be regarded as a row matrix;
> d) in products M*v, v may be regarded as a column matrix;
> e) v*M == T(M)*v and v*T(M) == M*v where T is the transpose operator;
> f) v*w is a scalar when v and w are vectors of same dimension.
> g) the product of a matrix 1xn by a matrix nXm is a matrix 1xm which is
> not a m-dimensional vector;
> h) T(Q*R) = T(R)*T(Q) for any matrix Q nXm and matrix R mXk where T is the
> transpose operator.
>
> So, OpenSCAD matrix multiplications agree the mathematical equivalent. The
> differences between math and OpenSCAD are just the a), b) and d) above.
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
RP
Ronaldo Persiano
Wed, Apr 3, 2019 4:00 PM
I would be inclined to write this using a single matrix product rather
than a loop of matrix vector products like this:
function transform_path(path,m) = path*transpose(m);
Yes I think that might be quicker but it produces vec4s and polyhedron
only seems to accept vec3. Stripping the ones with a for loop after makes
it slower.
Striping the ones may be avoided if the matrices are 3x4. The operator
multmatrix() ignores the last row and accepts 3x4 matrices so if you drop
the last row of your matrices, multmatrix() will work as expected. However,
to apply a 3x4 matrix to a list of 4D points, we will need to transpose the
matrix:
[for(i=[0:len(p)-1]) p[i]] * transpose(M)
nop head <nop.head@gmail.com> wrote:
> I would be inclined to write this using a single matrix product rather
>> than a loop of matrix vector products like this:
>> function transform_path(path,m) = path*transpose(m);
>>
>
> Yes I think that might be quicker but it produces vec4s and polyhedron
> only seems to accept vec3. Stripping the ones with a for loop after makes
> it slower.
>
Striping the ones may be avoided if the matrices are 3x4. The operator
multmatrix() ignores the last row and accepts 3x4 matrices so if you drop
the last row of your matrices, multmatrix() will work as expected. However,
to apply a 3x4 matrix to a list of 4D points, we will need to transpose the
matrix:
[for(i=[0:len(p)-1]) p[i]] * transpose(M)
A
adrianv
Thu, Apr 4, 2019 2:59 AM
I would be inclined to write this using a single matrix product rather
than a loop of matrix vector products like this:
function transform_path(path,m) = path*transpose(m);
Yes I think that might be quicker but it produces vec4s and polyhedron
only seems to accept vec3. Stripping the ones with a for loop after makes
it slower.
Striping the ones may be avoided if the matrices are 3x4. The operator
multmatrix() ignores the last row and accepts 3x4 matrices so if you drop
the last row of your matrices, multmatrix() will work as expected.
However,
to apply a 3x4 matrix to a list of 4D points, we will need to transpose
the
matrix:
[for(i=[0:len(p)-1]) p[i]] * transpose(M)
Ronaldo wrote
> nop head <
> nop.head@
> > wrote:
>
>> I would be inclined to write this using a single matrix product rather
>>> than a loop of matrix vector products like this:
>>> function transform_path(path,m) = path*transpose(m);
>>>
>>
>> Yes I think that might be quicker but it produces vec4s and polyhedron
>> only seems to accept vec3. Stripping the ones with a for loop after makes
>> it slower.
>>
>
> Striping the ones may be avoided if the matrices are 3x4. The operator
> multmatrix() ignores the last row and accepts 3x4 matrices so if you drop
> the last row of your matrices, multmatrix() will work as expected.
> However,
> to apply a 3x4 matrix to a list of 4D points, we will need to transpose
> the
> matrix:
>
> [for(i=[0:len(p)-1]) p[i]] * transpose(M)
Wouldn't simply
p*transpose(M)
be better, where M is 3x4?
--
Sent from: http://forum.openscad.org/
RP
Ronaldo Persiano
Thu, Apr 4, 2019 2:26 PM
Wouldn't simply
p*transpose(M)
be better, where M is 3x4?
It is a pity that my emphasis that p is a list of vectors has been
misunderstood.
>
> Wouldn't simply
>
> p*transpose(M)
>
> be better, where M is 3x4?
>
It is a pity that my emphasis that p is a list of vectors has been
misunderstood.
NH
nop head
Thu, Apr 4, 2019 2:31 PM
A list of vec4s is also an 4 x n matrix. So you can post multiply by 3 x 4
matrix and get a 3 x n matrix which is a list of vec3s.
On Thu, 4 Apr 2019 at 15:28, Ronaldo Persiano rcmpersiano@gmail.com wrote:
p*transpose(M)
be better, where M is 3x4?
A list of vec4s is also an 4 x n matrix. So you can post multiply by 3 x 4
matrix and get a 3 x n matrix which is a list of vec3s.
On Thu, 4 Apr 2019 at 15:28, Ronaldo Persiano <rcmpersiano@gmail.com> wrote:
> Wouldn't simply
>>
>> p*transpose(M)
>>
>> be better, where M is 3x4?
>>
>
> It is a pity that my emphasis that p is a list of vectors has been
> misunderstood.
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>