Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
9e26c3ec
Commit
9e26c3ec
authored
9 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
implemented vector products for mixed arguments (complex/double)
parent
5ba64b5c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Core/Algorithms/RectangularDetector.cpp
+2
-2
2 additions, 2 deletions
Core/Algorithms/RectangularDetector.cpp
Core/Geometry/BasicVector3D.cpp
+30
-7
30 additions, 7 deletions
Core/Geometry/BasicVector3D.cpp
Core/Geometry/BasicVector3D.h
+15
-11
15 additions, 11 deletions
Core/Geometry/BasicVector3D.h
with
47 additions
and
20 deletions
Core/Algorithms/RectangularDetector.cpp
+
2
−
2
View file @
9e26c3ec
...
@@ -125,8 +125,8 @@ IPixelMap *RectangularDetector::createPixelMap(size_t index) const
...
@@ -125,8 +125,8 @@ IPixelMap *RectangularDetector::createPixelMap(size_t index) const
Bin1D
u_bin
=
u_axis
.
getBin
(
u_index
);
Bin1D
u_bin
=
u_axis
.
getBin
(
u_index
);
Bin1D
v_bin
=
v_axis
.
getBin
(
v_index
);
Bin1D
v_bin
=
v_axis
.
getBin
(
v_index
);
kvector_t
corner_position
=
m_normal_to_detector
kvector_t
corner_position
(
m_normal_to_detector
+
(
u_bin
.
m_lower
-
m_u0
)
*
m_u_unit
+
(
v_bin
.
m_lower
-
m_v0
)
*
m_v_unit
;
+
(
u_bin
.
m_lower
-
m_u0
)
*
m_u_unit
+
(
v_bin
.
m_lower
-
m_v0
)
*
m_v_unit
)
;
kvector_t
width
=
u_bin
.
getBinSize
()
*
m_u_unit
;
kvector_t
width
=
u_bin
.
getBinSize
()
*
m_u_unit
;
kvector_t
height
=
v_bin
.
getBinSize
()
*
m_v_unit
;
kvector_t
height
=
v_bin
.
getBinSize
()
*
m_v_unit
;
return
new
RectPixelMap
(
corner_position
,
width
,
height
);
return
new
RectPixelMap
(
corner_position
,
width
,
height
);
...
...
This diff is collapsed.
Click to expand it.
Core/Geometry/BasicVector3D.cpp
+
30
−
7
View file @
9e26c3ec
...
@@ -79,29 +79,52 @@ BasicVector3D<std::complex<double>> BasicVector3D<double>::complex() const
...
@@ -79,29 +79,52 @@ BasicVector3D<std::complex<double>> BasicVector3D<double>::complex() const
// Combine two vectors
// Combine two vectors
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//! Returns dot product of vectors (antilinear in the first [=self] argument).
//! Returns dot product of
complex
vectors (antilinear in the first [=self] argument).
template
<
>
template
<
>
template
<
>
complex_t
BasicVector3D
<
complex_t
>::
dot
(
const
BasicVector3D
<
complex_t
>&
v
)
const
complex_t
BasicVector3D
<
complex_t
>::
dot
(
const
BasicVector3D
<
complex_t
>&
v
)
const
{
{
return
std
::
conj
(
x
())
*
v
.
x
()
+
std
::
conj
(
y
())
*
v
.
y
()
+
std
::
conj
(
z
())
*
v
.
z
();
return
std
::
conj
(
x
())
*
v
.
x
()
+
std
::
conj
(
y
())
*
v
.
y
()
+
std
::
conj
(
z
())
*
v
.
z
();
}
}
template
<
>
//! Returns mixed dot product of complex and double vectors (antilinear in the complex argument).
template
<
>
template
<
>
complex_t
BasicVector3D
<
complex_t
>::
dot
(
const
BasicVector3D
<
double
>&
v
)
const
{
return
std
::
conj
(
x
()
*
v
.
x
()
+
y
()
*
v
.
y
()
+
z
()
*
v
.
z
()
);
}
//! Returns mixed dot product of double and complex vectors (linear in the complex argument).
template
<
>
template
<
>
complex_t
BasicVector3D
<
double
>::
dot
(
const
BasicVector3D
<
complex_t
>&
v
)
const
{
return
x
()
*
v
.
x
()
+
y
()
*
v
.
y
()
+
z
()
*
v
.
z
();
}
//! Returns dot product of double-typed vectors.
template
<
>
template
<
>
double
BasicVector3D
<
double
>::
dot
(
const
BasicVector3D
<
double
>&
v
)
const
double
BasicVector3D
<
double
>::
dot
(
const
BasicVector3D
<
double
>&
v
)
const
{
{
return
x
()
*
v
.
x
()
+
y
()
*
v
.
y
()
+
z
()
*
v
.
z
();
return
x
()
*
v
.
x
()
+
y
()
*
v
.
y
()
+
z
()
*
v
.
z
();
}
}
//! Returns cross product of vectors.
//! Returns cross product of double-typed vectors.
template
<
>
template
<
>
template
<
>
BasicVector3D
<
double
>
BasicVector3D
<
double
>::
cross
(
BasicVector3D
<
double
>
BasicVector3D
<
double
>::
cross
(
const
BasicVector3D
<
double
>&
v
)
const
const
BasicVector3D
<
double
>&
v
)
const
{
{
return
BasicVector3D
<
double
>
(
y
()
*
v
.
z
()
-
v
.
y
()
*
z
(),
return
BasicVector3D
<
double
>
(
y
()
*
v
.
z
()
-
v
.
y
()
*
z
(),
z
()
*
v
.
x
()
-
v
.
z
()
*
x
(),
z
()
*
v
.
x
()
-
v
.
z
()
*
x
(),
x
()
*
v
.
y
()
-
v
.
x
()
*
y
());
x
()
*
v
.
y
()
-
v
.
x
()
*
y
());
}
}
//! Returns mixed cross product of double and complex vectors.
template
<
>
template
<
>
BasicVector3D
<
complex_t
>
BasicVector3D
<
double
>::
cross
(
const
BasicVector3D
<
complex_t
>&
v
)
const
{
return
BasicVector3D
<
complex_t
>
(
y
()
*
v
.
z
()
-
v
.
y
()
*
z
(),
z
()
*
v
.
x
()
-
v
.
z
()
*
x
(),
x
()
*
v
.
y
()
-
v
.
x
()
*
y
());
}
//! Returns angle with respect to another vector.
//! Returns angle with respect to another vector.
template
<
>
template
<
>
double
BasicVector3D
<
double
>::
angle
(
const
BasicVector3D
<
double
>&
v
)
const
double
BasicVector3D
<
double
>::
angle
(
const
BasicVector3D
<
double
>&
v
)
const
...
...
This diff is collapsed.
Click to expand it.
Core/Geometry/BasicVector3D.h
+
15
−
11
View file @
9e26c3ec
...
@@ -90,11 +90,13 @@ public:
...
@@ -90,11 +90,13 @@ public:
{
v_
[
0
]
-=
v
.
v_
[
0
];
v_
[
1
]
-=
v
.
v_
[
1
];
v_
[
2
]
-=
v
.
v_
[
2
];
return
*
this
;
}
{
v_
[
0
]
-=
v
.
v_
[
0
];
v_
[
1
]
-=
v
.
v_
[
1
];
v_
[
2
]
-=
v
.
v_
[
2
];
return
*
this
;
}
//! Multiplies this with a scalar, and returns result.
//! Multiplies this with a scalar, and returns result.
inline
BasicVector3D
<
T
>&
operator
*=
(
double
a
)
template
<
class
U
>
inline
auto
operator
*=
(
U
a
)
->
BasicVector3D
<
decltype
(
this
->
x
()
*
a
)
>&
{
v_
[
0
]
*=
a
;
v_
[
1
]
*=
a
;
v_
[
2
]
*=
a
;
return
*
this
;
}
{
v_
[
0
]
*=
a
;
v_
[
1
]
*=
a
;
v_
[
2
]
*=
a
;
return
*
this
;
}
//! Divides this by a scalar, and returns result.
//! Divides this by a scalar, and returns result.
inline
BasicVector3D
<
T
>&
operator
/=
(
double
a
)
template
<
class
U
>
inline
auto
operator
/=
(
U
a
)
->
BasicVector3D
<
decltype
(
this
->
x
()
*
a
)
>&
{
v_
[
0
]
/=
a
;
v_
[
1
]
/=
a
;
v_
[
2
]
/=
a
;
return
*
this
;
}
{
v_
[
0
]
/=
a
;
v_
[
1
]
/=
a
;
v_
[
2
]
/=
a
;
return
*
this
;
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
...
@@ -144,10 +146,12 @@ public:
...
@@ -144,10 +146,12 @@ public:
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
//! Returns dot product of vectors (antilinear in the first [=self] argument).
//! Returns dot product of vectors (antilinear in the first [=self] argument).
T
dot
(
const
BasicVector3D
<
T
>&
v
)
const
;
template
<
class
U
>
auto
dot
(
const
BasicVector3D
<
U
>&
v
)
const
->
decltype
(
this
->
x
()
*
v
.
x
());
//! Returns cross product of vectors.
//! Returns cross product of vectors.
BasicVector3D
<
T
>
cross
(
const
BasicVector3D
<
T
>&
v
)
const
;
template
<
class
U
>
auto
cross
(
const
BasicVector3D
<
U
>&
v
)
const
->
BasicVector3D
<
decltype
(
this
->
x
()
*
v
.
x
())
>
;
//! Returns angle with respect to another vector.
//! Returns angle with respect to another vector.
double
angle
(
const
BasicVector3D
<
T
>&
v
)
const
;
double
angle
(
const
BasicVector3D
<
T
>&
v
)
const
;
...
@@ -217,14 +221,14 @@ inline BasicVector3D<T> operator-(const BasicVector3D<T>& a, const BasicVector3D
...
@@ -217,14 +221,14 @@ inline BasicVector3D<T> operator-(const BasicVector3D<T>& a, const BasicVector3D
//! Multiplication vector by scalar.
//! Multiplication vector by scalar.
//! @relates BasicVector3D
//! @relates BasicVector3D
template
<
class
T
,
class
U
>
template
<
class
T
,
class
U
>
inline
BasicVector3D
<
T
>
operator
*
(
const
BasicVector3D
<
T
>&
v
,
U
a
)
inline
auto
operator
*
(
const
BasicVector3D
<
T
>&
v
,
const
U
a
)
->
BasicVector3D
<
decltype
(
v
.
x
()
*
a
)
>
{
return
BasicVector3D
<
T
>
(
v
.
x
()
*
a
,
v
.
y
()
*
a
,
v
.
z
()
*
a
);
}
{
return
BasicVector3D
<
decltype
(
v
.
x
()
*
a
)
>
(
v
.
x
()
*
a
,
v
.
y
()
*
a
,
v
.
z
()
*
a
);
}
//! Multiplication scalar by vector.
//! Multiplication scalar by vector.
//! @relates BasicVector3D
//! @relates BasicVector3D
template
<
class
T
,
class
U
>
template
<
class
T
,
class
U
>
inline
BasicVector3D
<
T
>
operator
*
(
U
a
,
const
BasicVector3D
<
T
>&
v
)
inline
auto
operator
*
(
const
U
a
,
const
BasicVector3D
<
T
>&
v
)
->
BasicVector3D
<
decltype
(
a
*
v
.
x
())
>
{
return
BasicVector3D
<
T
>
(
a
*
v
.
x
(),
a
*
v
.
y
(),
a
*
v
.
z
());
}
{
return
BasicVector3D
<
decltype
(
a
*
v
.
x
())
>
(
a
*
v
.
x
(),
a
*
v
.
y
(),
a
*
v
.
z
());
}
// vector*vector not supported
// vector*vector not supported
// (We do not provide the operator form a*b of the dot product:
// (We do not provide the operator form a*b of the dot product:
...
@@ -262,13 +266,13 @@ BA_CORE_API_ BasicVector3D<double> vecOfLambdaAlphaPhi(const double _lambda, con
...
@@ -262,13 +266,13 @@ BA_CORE_API_ BasicVector3D<double> vecOfLambdaAlphaPhi(const double _lambda, con
// ?? for API generation ??
// ?? for API generation ??
// =============================================================================
// =============================================================================
template
<
>
BA_CORE_API_
std
::
complex
<
double
>
BasicVector3D
<
std
::
complex
<
double
>
>::
dot
(
template
<
>
template
<
>
BA_CORE_API_
std
::
complex
<
double
>
BasicVector3D
<
std
::
complex
<
double
>
>::
dot
(
const
BasicVector3D
<
std
::
complex
<
double
>
>&
v
)
const
;
const
BasicVector3D
<
std
::
complex
<
double
>
>&
v
)
const
;
template
<
>
BA_CORE_API_
double
BasicVector3D
<
double
>::
dot
(
template
<
>
template
<
>
BA_CORE_API_
double
BasicVector3D
<
double
>::
dot
(
const
BasicVector3D
<
double
>&
v
)
const
;
const
BasicVector3D
<
double
>&
v
)
const
;
template
<
>
BA_CORE_API_
BasicVector3D
<
double
>
BasicVector3D
<
double
>::
cross
(
template
<
>
template
<
>
BA_CORE_API_
BasicVector3D
<
double
>
BasicVector3D
<
double
>::
cross
(
const
BasicVector3D
<
double
>&
v
)
const
;
const
BasicVector3D
<
double
>&
v
)
const
;
template
<
>
BA_CORE_API_
double
BasicVector3D
<
double
>::
phi
()
const
;
template
<
>
BA_CORE_API_
double
BasicVector3D
<
double
>::
phi
()
const
;
...
...
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