Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
INMOST
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Terekhov
INMOST
Commits
423cb723
Commit
423cb723
authored
Feb 15, 2018
by
Kirill Terekhov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some fixes for autodiff with delayed evaluation for the case when vector of variations is NULL
parent
929113d8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
12 deletions
+45
-12
Source/Headers/inmost_expression.h
Source/Headers/inmost_expression.h
+20
-11
Source/Headers/inmost_variable.h
Source/Headers/inmost_variable.h
+24
-0
Source/Solver/solver_inner/solver_bcgsl.hpp
Source/Solver/solver_inner/solver_bcgsl.hpp
+1
-1
No files found.
Source/Headers/inmost_expression.h
View file @
423cb723
...
...
@@ -602,26 +602,35 @@ namespace INMOST
/// Retrive derivatives with multiplier into Sparse::RowMerger structure.
__INLINE
void
GetJacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
RowMerger
&
r
)
const
{
for
(
Sparse
::
Row
::
iterator
it
=
entries
->
Begin
();
it
!=
entries
->
End
();
++
it
)
r
[
it
->
first
]
+=
it
->
second
*
mult
;
if
(
entries
)
{
for
(
Sparse
::
Row
::
iterator
it
=
entries
->
Begin
();
it
!=
entries
->
End
();
++
it
)
r
[
it
->
first
]
+=
it
->
second
*
mult
;
}
}
/// Retrive derivatives with multiplier into Sparse::Row structure.
__INLINE
void
GetJacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
const
{
if
(
CheckCurrentAutomatizator
()
)
FromGetJacobian
(
*
this
,
mult
,
r
);
else
if
(
entries
)
{
for
(
Sparse
::
Row
::
iterator
it
=
entries
->
Begin
();
it
!=
entries
->
End
();
++
it
)
r
[
it
->
first
]
+=
it
->
second
*
mult
;
if
(
CheckCurrentAutomatizator
()
)
FromGetJacobian
(
*
this
,
mult
,
r
);
else
{
for
(
Sparse
::
Row
::
iterator
it
=
entries
->
Begin
();
it
!=
entries
->
End
();
++
it
)
r
[
it
->
first
]
+=
it
->
second
*
mult
;
}
}
}
__INLINE
void
GetHessian
(
INMOST_DATA_REAL_TYPE
multJ
,
Sparse
::
Row
&
J
,
INMOST_DATA_REAL_TYPE
multH
,
Sparse
::
HessianRow
&
H
)
const
{
J
=
*
entries
;
if
(
!
J
.
isSorted
()
)
std
::
sort
(
J
.
Begin
(),
J
.
End
());
for
(
Sparse
::
Row
::
iterator
it
=
J
.
Begin
();
it
!=
J
.
End
();
++
it
)
it
->
second
*=
multJ
;
H
.
Clear
();
if
(
entries
)
{
J
=
*
entries
;
if
(
!
J
.
isSorted
()
)
std
::
sort
(
J
.
Begin
(),
J
.
End
());
for
(
Sparse
::
Row
::
iterator
it
=
J
.
Begin
();
it
!=
J
.
End
();
++
it
)
it
->
second
*=
multJ
;
H
.
Clear
();
}
}
__INLINE
multivar_expression_reference
&
operator
=
(
INMOST_DATA_REAL_TYPE
pvalue
)
{
...
...
Source/Headers/inmost_variable.h
View file @
423cb723
...
...
@@ -284,6 +284,29 @@ namespace INMOST
abstract_dynamic_variable
*
Copy
()
const
{
return
static_cast
<
abstract_dynamic_variable
*>
(
new
const_variable
(
*
this
));}
};
class
const_link_variable
:
public
shell_dynamic_variable
<
const_expression
,
const_link_variable
>
{
private:
const
INMOST_DATA_REAL_TYPE
*
value
;
public:
const_link_variable
(
const
INMOST_DATA_REAL_TYPE
*
_value
)
:
value
(
_value
)
{}
const_link_variable
(
const
const_link_variable
&
other
)
:
value
(
other
.
value
)
{}
const_link_variable
&
operator
=
(
const
const_link_variable
&
other
)
{
value
=
other
.
value
;
return
*
this
;
}
INMOST_DATA_REAL_TYPE
Value
(
const
Storage
&
e
)
const
{
return
*
value
;}
multivar_expression
Variable
(
const
Storage
&
e
)
const
{
return
multivar_expression
(
*
value
);
}
const_expression
operator
[](
const
Storage
&
e
)
const
{
return
const_expression
(
*
value
);}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
GetJacobian
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
GetJacobian
(
1.0
,
r
);
}
abstract_dynamic_variable
*
Copy
()
const
{
return
static_cast
<
abstract_dynamic_variable
*>
(
new
const_link_variable
(
*
this
));}
};
class
static_variable
:
public
shell_dynamic_variable
<
const_expression
,
static_variable
>
{
private:
...
...
@@ -706,6 +729,7 @@ template<class A> __INLINE
}
template
<
class
A
,
class
B
>
__INLINE
INMOST
::
etype_branch_variable
<
A
,
B
>
etype_branch
(
INMOST
::
ElementType
true_type
,
INMOST
::
shell_dynamic_variable
<
typename
A
::
Var
,
A
>
const
&
iftrue
,
INMOST
::
shell_dynamic_variable
<
typename
B
::
Var
,
B
>
const
&
iffalse
)
{
return
INMOST
::
etype_branch_variable
<
A
,
B
>
(
true_type
,
iftrue
,
iffalse
);}
template
<
class
A
,
class
B
>
__INLINE
INMOST
::
marker_branch_variable
<
A
,
B
>
marker_branch
(
INMOST
::
MarkerType
marker
,
INMOST
::
shell_dynamic_variable
<
typename
A
::
Var
,
A
>
const
&
iftrue
,
INMOST
::
shell_dynamic_variable
<
typename
B
::
Var
,
B
>
const
&
iffalse
)
{
return
INMOST
::
marker_branch_variable
<
A
,
B
>
(
marker
,
iftrue
,
iffalse
);}
__INLINE
INMOST
::
const_link_variable
extval
(
const
INMOST_DATA_REAL_TYPE
&
pvar
)
{
return
INMOST
::
const_link_variable
(
&
pvar
);}
#endif //defined(USE_AUTODIFF) && defined(USE_MESH)
...
...
Source/Solver/solver_inner/solver_bcgsl.hpp
View file @
423cb723
...
...
@@ -15,7 +15,7 @@
//#define USE_LAPACK_SVD // use lapack's dgesvd routine instead of built-in svdnxn
//#if !defined(NDEBUG)
#define REPORT_RESIDUAL
//
#define REPORT_RESIDUAL
//#endif
//#define USE_OMP
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment