Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DCT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
graintracking
DCT
Commits
6f520dbd
Commit
6f520dbd
authored
11 years ago
by
Yoann Guilhem
Browse files
Options
Downloads
Patches
Plain Diff
Simplified and optimized gtVectorLab2Cryst and gtVectorCryst2Lab.
Signed-off-by:
Yoann Guilhem
<
yoann.guilhem@esrf.fr
>
parent
8bd32c83
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
zUtil_Cryst/gtVectorCryst2Lab.m
+10
-7
10 additions, 7 deletions
zUtil_Cryst/gtVectorCryst2Lab.m
zUtil_Cryst/gtVectorLab2Cryst.m
+10
-7
10 additions, 7 deletions
zUtil_Cryst/gtVectorLab2Cryst.m
with
20 additions
and
14 deletions
zUtil_Cryst/gtVectorCryst2Lab.m
+
10
−
7
View file @
6f520dbd
...
@@ -88,14 +88,17 @@ if M == 1 && N > 1
...
@@ -88,14 +88,17 @@ if M == 1 && N > 1
Vs
=
squeeze
(
sum
(
Vc
(:,
[
1
1
1
],
ones
(
N
,
1
))
.*
g
,
1
))
.'
;
Vs
=
squeeze
(
sum
(
Vc
(:,
[
1
1
1
],
ones
(
N
,
1
))
.*
g
,
1
))
.'
;
elseif
M
>=
1
&&
N
==
1
elseif
M
>=
1
&&
N
==
1
% Transpose g to get gT, reshape it and expand it along 1st axis
% % Transpose g to get gT, reshape it and expand it along 1st axis
gT
=
reshape
(
g
.'
,
[
1
3
3
]);
% gT = reshape(g.', [1 3 3]);
%
% Reshape Vc
% % Reshape Vc
Vc
=
reshape
(
Vc
,
[
M
1
3
]);
% Vc = reshape(Vc, [M 1 3]);
%
% % Multiply and sum along 3rd axis to reproduce Vs = gT . Vc
% Vs = sum(bsxfun(@times, gT, Vc), 3);
%
Multiply and sum along 3rd axis to reproduce Vs = gT . Vc
%
Can be simply done with this formulae
Vs
=
sum
(
bsxfun
(
@
times
,
gT
,
Vc
),
3
)
;
Vs
=
Vc
*
g
;
elseif
M
==
N
&&
diag
elseif
M
==
N
&&
diag
% Transpose and reshape Vc
% Transpose and reshape Vc
...
...
This diff is collapsed.
Click to expand it.
zUtil_Cryst/gtVectorLab2Cryst.m
+
10
−
7
View file @
6f520dbd
...
@@ -88,14 +88,17 @@ if M == 1 && N > 1
...
@@ -88,14 +88,17 @@ if M == 1 && N > 1
Vc
=
squeeze
(
sum
(
Vs
([
1
1
1
],
:,
ones
(
N
,
1
))
.*
g
,
2
))
.'
;
Vc
=
squeeze
(
sum
(
Vs
([
1
1
1
],
:,
ones
(
N
,
1
))
.*
g
,
2
))
.'
;
elseif
M
>=
1
&&
N
==
1
elseif
M
>=
1
&&
N
==
1
% Transpose g to get gT, reshape it and expand it along 1st axis
% % Transpose g to get gT, reshape it and expand it along 1st axis
g
=
reshape
(
g
,
[
1
3
3
]);
% g = reshape(g, [1 3 3]);
%
% Reshape Vs
% % Reshape Vs
Vs
=
reshape
(
Vs
,
[
M
1
3
]);
% Vs = reshape(Vs, [M 1 3]);
%
% % Multiply and sum along 3rd axis to reproduce Vc = g . Vs
% Vc = sum(bsxfun(@times, g, Vs), 3);
%
Multiply and sum along 3rd axis to reproduce Vc = g . Vs
%
Can be simply done with this formulae
Vc
=
sum
(
bsxfun
(
@
times
,
g
,
Vs
),
3
)
;
Vc
=
(
g
*
Vs
.
').'
;
elseif
M
==
N
&&
diag
elseif
M
==
N
&&
diag
% Transpose and reshape Vc
% Transpose and reshape Vc
...
...
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