Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MRIBuilder.jl
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
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
Michiel Cottaar
MRIBuilder.jl
Commits
8439bc5e
Verified
Commit
8439bc5e
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Fix computation of bval and bmat_gradient
parent
19ad13da
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/all_building_blocks/base_building_blocks.jl
+9
-9
9 additions, 9 deletions
src/all_building_blocks/base_building_blocks.jl
with
9 additions
and
9 deletions
src/all_building_blocks/base_building_blocks.jl
+
9
−
9
View file @
8439bc5e
...
@@ -109,14 +109,14 @@ Similarly, setting `last` to nothing indicates to continue till the end of the `
...
@@ -109,14 +109,14 @@ Similarly, setting `last` to nothing indicates to continue till the end of the `
"""
"""
function
waveform_sequence
(
bb
::
BaseBuildingBlock
,
first
,
last
)
function
waveform_sequence
(
bb
::
BaseBuildingBlock
,
first
,
last
)
started
=
isnothing
(
first
)
started
=
isnothing
(
first
)
current_grad
=
current_start
=
nothing
current_grad
_key
=
current_start
=
nothing
parts
=
GradientWaveform
[]
parts
=
Tuple
{
Any
,
GradientWaveform
}
[]
for
key
in
bb
for
key
in
keys
(
bb
)
if
bb
[
key
]
isa
GradientWaveform
if
bb
[
key
]
isa
GradientWaveform
if
started
if
started
push!
(
parts
,
isnothing
(
current_start
)
?
current_grad
:
split_gradient
(
current_grad
,
current_start
)[
2
])
push!
(
parts
,
(
current_grad_key
,
isnothing
(
current_start
)
?
bb
[
current_grad
_key
]
:
split_gradient
(
bb
[
current_grad
_key
]
,
current_start
)[
2
])
)
end
end
current_grad
=
bb
[
key
]
current_grad
_key
=
key
current_start
=
nothing
current_start
=
nothing
end
end
if
key
==
first
if
key
==
first
...
@@ -127,9 +127,9 @@ function waveform_sequence(bb::BaseBuildingBlock, first, last)
...
@@ -127,9 +127,9 @@ function waveform_sequence(bb::BaseBuildingBlock, first, last)
if
key
==
last
if
key
==
last
@assert
started
@assert
started
if
isnothing
(
current_started
)
if
isnothing
(
current_started
)
push!
(
parts
,
split_gradient
(
current_grad
,
effective_time
(
bb
[
key
]))[
1
])
push!
(
parts
,
(
current_grad_key
,
split_gradient
(
bb
[
current_grad
_key
]
,
effective_time
(
bb
[
key
]))[
1
])
)
else
else
push!
(
parts
,
split_gradient
(
current_grad
,
current_started
,
effective_time
(
bb
[
key
]))[
2
])
push!
(
parts
,
(
current_grad_key
,
split_gradient
(
bb
[
current_grad
_key
]
,
current_started
,
effective_time
(
bb
[
key
]))[
2
])
)
end
end
end
end
end
end
...
@@ -149,7 +149,7 @@ function qval(bb::BaseBuildingBlock, index1, index2)
...
@@ -149,7 +149,7 @@ function qval(bb::BaseBuildingBlock, index1, index2)
if
(
!
isnothing
(
index1
))
&&
(
index1
==
index2
)
if
(
!
isnothing
(
index1
))
&&
(
index1
==
index2
)
return
zeros
(
3
)
return
zeros
(
3
)
end
end
sum
(
qval
.
(
waveform_sequence
(
bb
,
index1
,
index2
)
)
;
init
=
0.
)
sum
(
(
i
,
wv
)
->
qval
(
wv
),
waveform_sequence
(
bb
,
index1
,
index2
);
init
=
0.
)
end
end
qval
(
bb
::
BaseBuildingBlock
)
=
qval
(
bb
,
nothing
,
nothing
)
qval
(
bb
::
BaseBuildingBlock
)
=
qval
(
bb
,
nothing
,
nothing
)
...
@@ -160,7 +160,7 @@ function bmat_gradient(bb::BaseBuildingBlock, qstart, index1, index2)
...
@@ -160,7 +160,7 @@ function bmat_gradient(bb::BaseBuildingBlock, qstart, index1, index2)
result
=
Matrix
{
VariableType
}(
zeros
(
3
,
3
))
result
=
Matrix
{
VariableType
}(
zeros
(
3
,
3
))
qcurrent
=
Vector
{
VariableType
}(
qstart
)
qcurrent
=
Vector
{
VariableType
}(
qstart
)
for
part
in
waveform_sequence
(
bb
,
index1
,
index2
)
for
(
_
,
part
)
in
waveform_sequence
(
bb
,
index1
,
index2
)
result
=
result
.+
bmat_gradient
(
part
,
qcurrent
)
result
=
result
.+
bmat_gradient
(
part
,
qcurrent
)
qcurrent
=
qcurrent
.+
qvec
(
part
,
qcurrent
)
qcurrent
=
qcurrent
.+
qvec
(
part
,
qcurrent
)
end
end
...
...
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