Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CGoGN
CGoGN
Commits
83928b30
Commit
83928b30
authored
Jun 03, 2011
by
Basile Sauvage
Browse files
correction des produits matrice/vecteur et vecteur/matrice
parent
218a41b3
Changes
2
Show whitespace changes
Inline
Side-by-side
include/Geometry/matrix.h
View file @
83928b30
...
@@ -161,7 +161,11 @@ class Matrix
...
@@ -161,7 +161,11 @@ class Matrix
// Vector / Matrix multiplication
// Vector / Matrix multiplication
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
Vector
<
M
,
T
>
operator
*
(
const
Vector
<
N
,
T
>&
v
,
const
Matrix
<
M
,
N
,
T
>&
m
)
;
Vector
<
N
,
T
>
operator
*
(
const
Vector
<
M
,
T
>&
v
,
const
Matrix
<
M
,
N
,
T
>&
m
)
;
// Matrix / Vector multiplication
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
Vector
<
M
,
T
>
operator
*
(
const
Matrix
<
M
,
N
,
T
>&
m
,
const
Vector
<
N
,
T
>&
v
)
;
// Scalar / Matrix multiplication
// Scalar / Matrix multiplication
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
...
...
include/Geometry/matrix.hpp
View file @
83928b30
...
@@ -431,13 +431,25 @@ std::istream& operator>>(std::istream& in, Matrix<M,N,T>& m)
...
@@ -431,13 +431,25 @@ std::istream& operator>>(std::istream& in, Matrix<M,N,T>& m)
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
Vector
<
N
,
T
>
operator
*
(
const
Vector
<
M
,
T
>&
v
,
const
Matrix
<
M
,
N
,
T
>&
m
)
Vector
<
N
,
T
>
operator
*
(
const
Vector
<
M
,
T
>&
v
,
const
Matrix
<
M
,
N
,
T
>&
m
)
{
{
Vector
<
N
,
T
>
res
;
Vector
<
N
,
T
>
res
(
0
)
;
for
(
unsigned
int
i
=
0
;
i
<
M
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
M
;
++
i
)
for
(
unsigned
int
j
=
0
;
j
<
N
;
++
j
)
for
(
unsigned
int
j
=
0
;
j
<
N
;
++
j
)
res
[
j
]
+=
m
(
i
,
j
)
*
v
[
i
]
;
res
[
j
]
+=
m
(
i
,
j
)
*
v
[
i
]
;
return
res
;
return
res
;
}
}
// Matrix / Vector multiplication
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
Vector
<
M
,
T
>
operator
*
(
const
Matrix
<
M
,
N
,
T
>&
m
,
const
Vector
<
N
,
T
>&
v
)
{
Vector
<
M
,
T
>
res
(
0
);
for
(
unsigned
int
i
=
0
;
i
<
M
;
++
i
)
for
(
unsigned
int
j
=
0
;
j
<
N
;
++
j
)
res
[
i
]
+=
m
(
i
,
j
)
*
v
[
j
]
;
return
res
;
}
// Scalar / Matrix multiplication
// Scalar / Matrix multiplication
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
Matrix
<
M
,
N
,
T
>
operator
*
(
T
s
,
const
Matrix
<
M
,
N
,
T
>&
m
)
Matrix
<
M
,
N
,
T
>
operator
*
(
T
s
,
const
Matrix
<
M
,
N
,
T
>&
m
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment