Skip to content

Commit

Permalink
fix dot product of two vectors
Browse files Browse the repository at this point in the history
fixes #14 : just a single loop over two vectors
  • Loading branch information
adtzlr committed Jun 21, 2020
1 parent d68a27d commit aebc0cd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ttb/libdot.f
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,11 @@ function dot_11(T1, T2)
type(Tensor1), intent(in) :: T1
type(Tensor1), intent(in) :: T2
real(kind=8) :: dot_11
integer :: i,j
integer :: i

dot_11 = 0.d0
do i = 1,3
do j = 1,3
dot_11 = dot_11 + T1%a(i)*T2%a(j)
enddo
dot_11 = dot_11 + T1%a(i)*T2%a(i)
enddo
end function dot_11

Expand Down Expand Up @@ -334,4 +332,4 @@ function dot_2s2s(T1, T2)
* +T1%a6(5)*T2%a6(3)
dot_2s2s%a6(6) = T1%a6(6)*T2%a6(1)+T1%a6(5)*T2%a6(4)
* +T1%a6(3)*T2%a6(6)
end function dot_2s2s
end function dot_2s2s

0 comments on commit aebc0cd

Please sign in to comment.