Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdrt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Klemm, Carl Philipp
libdrt
Commits
6cf3485c
Commit
6cf3485c
authored
2 years ago
by
Carl Philipp Klemm
Browse files
Options
Downloads
Patches
Plain Diff
add pkgconfig support
parent
ad95f25c
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+7
-0
7 additions, 0 deletions
CMakeLists.txt
drt.cpp
+15
-10
15 additions, 10 deletions
drt.cpp
eisdrt/types.h
+18
-0
18 additions, 0 deletions
eisdrt/types.h
with
40 additions
and
10 deletions
CMakeLists.txt
+
7
−
0
View file @
6cf3485c
...
...
@@ -85,6 +85,13 @@ if(DEFINED EIS_FOUND)
endif
(
DEFINED TORCH_LIBRARIES
)
endif
(
DEFINED EIS_FOUND
)
if
(
DEFINED PKGCONFIG_FOUND
)
configure_file
(
pkgconfig/libeisdrt_torch.pc.in pkgconfig/libeisdrt_torch.pc @ONLY
)
configure_file
(
pkgconfig/libeisdrt.pc.in pkgconfig/libeisdrt.pc @ONLY
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/pkgconfig/libeisdrt_torch.pc DESTINATION lib/pkgconfig
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/pkgconfig/libeisdrt.pc DESTINATION lib/pkgconfig
)
endif
(
DEFINED PKGCONFIG_FOUND
)
set
(
API_HEADERS_DIR eisdrt/
)
set
(
API_HEADERS
${
API_HEADERS_DIR
}
/eigendrt.h
...
...
This diff is collapsed.
Click to expand it.
drt.cpp
+
15
−
10
View file @
6cf3485c
...
...
@@ -19,6 +19,8 @@
//
#include
"eisdrt/eigendrt.h"
#include
"eisdrt/types.h"
#include
<stdexcept>
#ifdef USE_EISGEN
#include
"eisdrt/eisdrt.h"
...
...
@@ -117,17 +119,11 @@ public:
int64_t
size
=
x
.
size
();
Eigen
::
Vector
<
fv
,
Eigen
::
Dynamic
>
xLeft
=
x
.
head
(
x
.
size
()
-
1
);
std
::
cout
<<
"aMatrixReal:
\n
"
<<
aMatrixReal
<<
"
\n
xLeft:
\n
"
<<
xLeft
<<
"
\n
x:
\n
"
<<
x
<<
std
::
endl
;
Eigen
::
Vector
<
fv
,
Eigen
::
Dynamic
>
t
=
aMatrixReal
*
xLeft
;
std
::
cout
<<
"T1:
\n
"
<<
t
<<
std
::
endl
;
t
=
t
-
impedanceSpectra
.
real
();
std
::
cout
<<
"T2:
\n
"
<<
t
<<
std
::
endl
;
t
=
t
.
array
()
+
x
[
size
-
1
];
std
::
cout
<<
"T3:
\n
"
<<
t
<<
std
::
endl
;
t
=
t
.
array
().
pow
(
2
);
std
::
cout
<<
"T4:
\n
"
<<
t
<<
std
::
endl
;
fv
MSE_re
=
t
.
sum
();
std
::
cout
<<
"T5:
\n
"
<<
MSE_re
<<
std
::
endl
;
t
=
(
aMatrixImag
*
xLeft
-
impedanceSpectra
.
imag
()).
array
().
pow
(
2
);
fv
MSE_im
=
t
.
sum
();
...
...
@@ -155,7 +151,6 @@ public:
fv
operator
()(
Eigen
::
VectorX
<
fv
>&
x
,
Eigen
::
VectorX
<
fv
>&
grad
)
{
grad
=
getGrad
(
std
::
bind
(
&
RtFunct
::
function
,
this
,
std
::
placeholders
::
_1
),
x
,
epsilon
);
std
::
cout
<<
"grad:
\n
"
<<
grad
<<
std
::
endl
;
return
function
(
x
);
}
};
...
...
@@ -187,14 +182,24 @@ Eigen::VectorX<fv> calcDrt(Eigen::VectorX<std::complex<fv>>& impedanceSpectra, E
RtFunct
<
fv
>
funct
(
impedanceSpectra
,
aMatrixImag
,
aMatrixReal
,
0.01
,
fp
.
step
);
Eigen
::
VectorX
<
fv
>
x
=
guesStartingPoint
(
omegaTensor
,
impedanceSpectra
);
std
::
cout
<<
"StartingPoint
\n
"
<<
x
<<
std
::
endl
;
Eigen
::
Matrix
<
fv
,
Eigen
::
Dynamic
,
2
>
bounds
=
calcBounds
(
impedanceSpectra
,
x
);
Eigen
::
VectorX
<
fv
>
lowerBounds
=
bounds
.
col
(
0
);
Eigen
::
VectorX
<
fv
>
upperBounds
=
bounds
.
col
(
1
);
fv
fx
;
try
{
fm
.
iterations
=
solver
.
minimize
(
funct
,
x
,
fx
,
lowerBounds
,
upperBounds
);
fm
.
fx
=
fx
;
}
catch
(
const
std
::
invalid_argument
&
ex
)
{
throw
drt_errror
(
std
::
string
(
ex
.
what
()));
}
catch
(
const
std
::
runtime_error
&
ex
)
{
throw
drt_errror
(
std
::
string
(
ex
.
what
()));
}
return
x
;
}
...
...
This diff is collapsed.
Click to expand it.
eisdrt/types.h
+
18
−
0
View file @
6cf3485c
...
...
@@ -18,6 +18,8 @@
*/
#pragma once
#include
<exception>
#include
<string>
/**
Types for use with all eisdrt apis
...
...
@@ -26,6 +28,22 @@ Types for use with all eisdrt apis
* @{
*/
/**
* @brief Exception thrown if drt could not be calcualted
*/
class
drt_errror
:
public
std
::
exception
{
std
::
string
whatStr
;
public:
drt_errror
(
const
std
::
string
&
whatIn
)
:
whatStr
(
whatIn
)
{}
virtual
const
char
*
what
()
const
noexcept
override
{
return
whatStr
.
c_str
();
}
};
/**
* @brief Returned information on a fit
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment