FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
abacus-develop/source/source_hamilt/module_ewald/dnrm2.cpp at develop · pplab/abacus-develop · GitHub
pplab
/
abacus-develop
Public
forked from
deepmodeling/abacus-develop
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
abacus-develop
/
source
/
source_hamilt
/
module_ewald
/
dnrm2.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (22 loc) · 475 Bytes
Breadcrumbs
abacus-develop
/
source
/
source_hamilt
/
module_ewald
/
dnrm2.cpp
Copy path
File metadata and controls
26 lines (22 loc) · 475 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#
include
"
dnrm2.h
"
#
include
<
math.h
>
#
include
<
iostream
>
double
dnrm2
(
const
int
n,
const
double
*x,
const
int
incx)
{
//
compute Euclidean length (12 norm) of std::vector x,
if
(n <
0
|| incx <=
0
)
{
std::cerr <<
"
\n
error in dnrm2, n < 0 or incx <= 0,
"
;
return
0
;
}
if
(n ==
0
)
{
return
0
;
}
double
norm2=
0.0
;
for
(
int
ix=
0
; ix<n; ix+=incx)
{
norm2 += x[ix] * x[ix];
}
return
sqrt
(norm2);
}
Back
|
FazBrowse Home
|
New Git URL