Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
KennethVanhoey
CGoGN
Commits
d8dda26d
Commit
d8dda26d
authored
Mar 30, 2011
by
Kenneth Vanhoey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vector by transposed vector multiplication
parent
7af03e77
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
include/Geometry/matrix.h
include/Geometry/matrix.h
+6
-2
include/Geometry/matrix.hpp
include/Geometry/matrix.hpp
+12
-1
No files found.
include/Geometry/matrix.h
View file @
d8dda26d
...
...
@@ -161,11 +161,15 @@ class Matrix
// Vector / Matrix multiplication
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
<
M
,
T
>
operator
*
(
const
Vector
<
N
,
T
>&
v
,
const
Matrix
<
M
,
N
,
T
>&
m
)
;
// Scalar / Matrix multiplication
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
)
;
// Vector / Transposed vector multiplication
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
Matrix
<
M
,
N
,
T
>
transposed_vectors_mult
(
const
Vector
<
M
,
T
>&
v1
,
const
Vector
<
N
,
T
>&
v2
)
;
/**********************************************/
...
...
include/Geometry/matrix.hpp
View file @
d8dda26d
...
...
@@ -405,9 +405,11 @@ bool Matrix<M,N,T>::operator==(const Matrix<M,N,T>& m) const {
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
Matrix
<
M
,
N
,
T
>&
m
)
{
for
(
unsigned
int
i
=
0
;
i
<
M
;
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
M
;
++
i
)
{
for
(
unsigned
int
j
=
0
;
j
<
N
;
++
j
)
out
<<
m
(
i
,
j
)
<<
" "
;
std
::
cout
<<
std
::
endl
;
}
return
out
;
}
...
...
@@ -446,6 +448,15 @@ Matrix<M,N,T> operator*(T s, const Matrix<M,N,T>& m)
return
res
;
}
template
<
unsigned
int
M
,
unsigned
int
N
,
typename
T
>
Matrix
<
M
,
N
,
T
>
transposed_vectors_mult
(
const
Vector
<
M
,
T
>&
v1
,
const
Vector
<
N
,
T
>&
v2
)
{
Matrix
<
M
,
N
,
T
>
res
;
for
(
unsigned
int
i
=
0
;
i
<
M
;
++
i
)
for
(
unsigned
int
j
=
0
;
j
<
N
;
++
j
)
res
(
i
,
j
)
=
v1
[
i
]
*
v2
[
j
]
;
return
res
;
}
}
// namespace Geom
}
// namespace CGoGN
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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