Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alvarez, Gonzalo
PsimagLite
Commits
9dff561b
Commit
9dff561b
authored
Sep 14, 2021
by
Alvarez, Gonzalo
Browse files
scalarProduct: we now check sizes
parent
94525844
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Vector.h
View file @
9dff561b
...
...
@@ -381,7 +381,10 @@ template<typename T,typename A>
T
scalarProduct
(
const
vector
<
T
,
A
>&
v1
,
const
vector
<
T
,
A
>&
v2
)
{
T
result
=
0.0
;
for
(
SizeType
i
=
0
;
i
<
v2
.
size
();
i
++
)
const
SizeType
n
=
v1
.
size
();
if
(
n
!=
v2
.
size
())
throw
PsimagLite
::
RuntimeError
(
"scalarProduct of vectors of different size
\n
"
);
for
(
SizeType
i
=
0
;
i
<
n
;
i
++
)
result
+=
PsimagLite
::
conj
(
v1
[
i
])
*
v2
[
i
];
return
result
;
}
...
...
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