Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kirill Terekhov
INMOST
Commits
217fbf88
Commit
217fbf88
authored
Feb 08, 2016
by
Kirill Terekhov
Browse files
Synchronize
Renamed GetDerivative to GetJacobian
parent
a2d5243c
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Source/Autodiff/autodiff.cpp
View file @
217fbf88
...
...
@@ -22,7 +22,7 @@ namespace INMOST
void
FromBasicExpression
(
Sparse
::
Row
&
entries
,
const
basic_expression
&
expr
)
{
Sparse
::
RowMerger
&
merger
=
Automatizator
::
GetCurrent
()
->
GetMerger
();
expr
.
Get
Derivative
(
1.0
,
merger
);
expr
.
Get
Jacobian
(
1.0
,
merger
);
merger
.
RetriveRow
(
entries
);
merger
.
Clear
();
}
...
...
@@ -31,15 +31,15 @@ namespace INMOST
{
Sparse
::
RowMerger
&
merger
=
Automatizator
::
GetCurrent
()
->
GetMerger
();
merger
.
PushRow
(
multme
,
entries
);
expr
.
Get
Derivative
(
multit
,
merger
);
expr
.
Get
Jacobian
(
multit
,
merger
);
merger
.
RetriveRow
(
entries
);
merger
.
Clear
();
}
void
FromGet
Derivative
(
const
basic_expression
&
expr
,
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
void
FromGet
Jacobian
(
const
basic_expression
&
expr
,
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
{
Sparse
::
RowMerger
&
merger
=
Automatizator
::
GetCurrent
()
->
GetMerger
();
expr
.
Get
Derivative
(
mult
,
merger
);
expr
.
Get
Jacobian
(
mult
,
merger
);
merger
.
AddRow
(
1.0
,
r
);
merger
.
RetriveRow
(
r
);
merger
.
Clear
();
...
...
Source/Headers/inmost_expression.h
View file @
217fbf88
This diff is collapsed.
Click to expand it.
Source/Headers/inmost_variable.h
View file @
217fbf88
...
...
@@ -105,8 +105,8 @@ namespace INMOST
unary_pool_expression
(
const
unary_pool_expression
&
other
)
:
pool
(
other
.
pool
)
{}
unary_pool_expression
&
operator
=
(
unary_pool_expression
const
&
other
)
{
pool
=
other
.
pool
;
return
*
this
;}
__INLINE
INMOST_DATA_REAL_TYPE
GetValue
()
const
{
return
pool
.
get_op
().
GetValue
();
}
__INLINE
void
Get
Derivative
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
RowMerger
&
r
)
const
{
pool
.
get_op
().
Get
Derivative
(
mult
,
r
);}
__INLINE
void
Get
Derivative
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
const
{
pool
.
get_op
().
Get
Derivative
(
mult
,
r
);}
__INLINE
void
Get
Jacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
RowMerger
&
r
)
const
{
pool
.
get_op
().
Get
Jacobian
(
mult
,
r
);}
__INLINE
void
Get
Jacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
const
{
pool
.
get_op
().
Get
Jacobian
(
mult
,
r
);}
};
template
<
class
A
,
class
ArgA
>
...
...
@@ -118,8 +118,8 @@ namespace INMOST
unary_const_pool_expression
(
const
unary_const_pool_expression
&
other
)
:
pool
(
other
.
pool
)
{}
unary_const_pool_expression
&
operator
=
(
unary_const_pool_expression
const
&
other
)
{
pool
=
other
.
pool
;
return
*
this
;}
__INLINE
INMOST_DATA_REAL_TYPE
GetValue
()
const
{
return
pool
.
get_op
().
GetValue
();
}
__INLINE
void
Get
Derivative
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
RowMerger
&
r
)
const
{
pool
.
get_op
().
Get
Derivative
(
mult
,
r
);}
__INLINE
void
Get
Derivative
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
const
{
pool
.
get_op
().
Get
Derivative
(
mult
,
r
);}
__INLINE
void
Get
Jacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
RowMerger
&
r
)
const
{
pool
.
get_op
().
Get
Jacobian
(
mult
,
r
);}
__INLINE
void
Get
Jacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
const
{
pool
.
get_op
().
Get
Jacobian
(
mult
,
r
);}
};
template
<
class
A
,
class
ArgA
,
class
ArgB
>
...
...
@@ -131,8 +131,8 @@ namespace INMOST
binary_pool_expression
(
const
binary_pool_expression
&
other
)
:
pool
(
other
.
pool
)
{}
binary_pool_expression
&
operator
=
(
binary_pool_expression
const
&
other
)
{
pool
=
other
.
pool
;
return
*
this
;}
__INLINE
INMOST_DATA_REAL_TYPE
GetValue
()
const
{
return
pool
.
get_op
().
GetValue
();
}
__INLINE
void
Get
Derivative
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
RowMerger
&
r
)
const
{
pool
.
get_op
().
Get
Derivative
(
mult
,
r
);}
__INLINE
void
Get
Derivative
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
const
{
pool
.
get_op
().
Get
Derivative
(
mult
,
r
);}
__INLINE
void
Get
Jacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
RowMerger
&
r
)
const
{
pool
.
get_op
().
Get
Jacobian
(
mult
,
r
);}
__INLINE
void
Get
Jacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
const
{
pool
.
get_op
().
Get
Jacobian
(
mult
,
r
);}
};
template
<
class
A
,
class
ArgA
,
class
ArgB
,
class
ArgC
>
...
...
@@ -144,8 +144,8 @@ namespace INMOST
ternary_pool_expression
(
const
ternary_pool_expression
&
other
)
:
pool
(
other
.
pool
)
{}
ternary_pool_expression
&
operator
=
(
ternary_pool_expression
const
&
other
)
{
pool
=
other
.
pool
;
return
*
this
;}
__INLINE
INMOST_DATA_REAL_TYPE
GetValue
()
const
{
return
pool
.
get_op
().
GetValue
();
}
__INLINE
void
Get
Derivative
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
RowMerger
&
r
)
const
{
pool
.
get_op
().
Get
Derivative
(
mult
,
r
);}
__INLINE
void
Get
Derivative
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
const
{
pool
.
get_op
().
Get
Derivative
(
mult
,
r
);}
__INLINE
void
Get
Jacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
RowMerger
&
r
)
const
{
pool
.
get_op
().
Get
Jacobian
(
mult
,
r
);}
__INLINE
void
Get
Jacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
const
{
pool
.
get_op
().
Get
Jacobian
(
mult
,
r
);}
};
class
abstract_dynamic_variable
...
...
@@ -277,8 +277,8 @@ namespace INMOST
var_expression
operator
[](
const
Storage
&
e
)
const
{
return
var_expression
(
e
->
Real
(
value_tag
),(
!
mask
||
e
->
GetMarker
(
mask
))
?
e
->
Integer
(
index_tag
)
:
ENUMUNDEF
);}
Tag
IndexTag
()
{
return
index_tag
;}
Tag
ValueTag
()
{
return
value_tag
;}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
bool
isUnknown
(
const
Storage
&
e
)
const
{
return
(
!
mask
||
e
->
GetMarker
(
mask
))
?
true
:
false
;}
abstract_dynamic_variable
*
Copy
()
const
{
return
static_cast
<
abstract_dynamic_variable
*>
(
new
dynamic_variable
(
*
this
));}
};
...
...
@@ -305,8 +305,8 @@ namespace INMOST
}
const_expression
operator
[](
const
Storage
&
e
)
const
{
return
const_expression
(
e
->
RealArray
(
value_tag
)[
comp
]);}
Tag
ValueTag
()
{
return
value_tag
;}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
bool
isUnknown
(
const
Storage
&
e
)
const
{
return
false
;}
abstract_dynamic_variable
*
Copy
()
const
{
return
static_cast
<
abstract_dynamic_variable
*>
(
new
static_variable
(
*
this
));}
};
...
...
@@ -332,8 +332,8 @@ namespace INMOST
}
multivar_expression
operator
[](
const
Storage
&
e
)
const
{
return
e
->
VariableArray
(
variable_tag
)[
comp
];}
Tag
VariableTag
()
{
return
variable_tag
;}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
bool
isUnknown
(
const
Storage
&
e
)
const
{
return
false
;}
abstract_dynamic_variable
*
Copy
()
const
{
return
static_cast
<
abstract_dynamic_variable
*>
(
new
stored_variable
(
*
this
));}
};
...
...
@@ -366,8 +366,8 @@ namespace INMOST
tmp
[
k
]
=
std
::
make_pair
(
stncl
[
k
].
first
,
Arg
[
stncl
[
k
].
second
]);
return
stencil_expression
<
typename
A
::
Var
>
(
tmp
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
abstract_dynamic_variable
*
Copy
()
const
{
return
static_cast
<
abstract_dynamic_variable
*>
(
new
stencil_variable
(
*
this
));}
};
...
...
@@ -394,8 +394,8 @@ namespace INMOST
pool
.
get_op
().
SetFunctionDerivative
(
both
.
second
);
return
unary_pool_expression
<
function_expression
<
typename
A
::
Var
>
,
typename
A
::
Var
>
(
pool
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
abstract_dynamic_variable
*
Copy
()
const
{
return
static_cast
<
abstract_dynamic_variable
*>
(
new
table_variable
(
*
this
));}
};
...
...
@@ -419,8 +419,8 @@ namespace INMOST
unary_pool
<
Expr
,
typename
A
::
Var
>
pool
(
Arg
[
e
]);
return
unary_pool_expression
<
Expr
,
typename
A
::
Var
>
(
pool
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
abstract_dynamic_variable
*
Copy
()
const
{
return
static_cast
<
abstract_dynamic_variable
*>
(
new
unary_custom_variable
(
*
this
));}
};
...
...
@@ -447,8 +447,8 @@ namespace INMOST
binary_pool
<
Expr
,
typename
A
::
Var
,
typename
B
::
Var
>
pool
(
Left
[
e
],
Right
[
e
]);
return
binary_pool_expression
<
Expr
,
typename
A
::
Var
,
typename
B
::
Var
>
(
pool
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
abstract_dynamic_variable
*
Copy
()
const
{
return
static_cast
<
abstract_dynamic_variable
*>
(
new
binary_custom_variable
(
*
this
));}
};
...
...
@@ -474,8 +474,8 @@ namespace INMOST
unary_const_pool
<
Expr
,
typename
A
::
Var
>
pool
(
Left
[
e
],
Right
);
return
unary_const_pool_expression
<
Expr
,
typename
A
::
Var
>
(
pool
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
abstract_dynamic_variable
*
Copy
()
const
{
return
static_cast
<
abstract_dynamic_variable
*>
(
new
unary_const_custom_variable
(
*
this
));}
};
...
...
@@ -502,8 +502,8 @@ namespace INMOST
ternary_pool
<
Expr
,
typename
A
::
Var
,
typename
B
::
Var
,
typename
C
::
Var
>
pool
(
Cond
[
e
],
Left
[
e
],
Right
[
e
]);
return
ternary_pool_expression
<
Expr
,
typename
A
::
Var
,
typename
B
::
Var
,
typename
C
::
Var
>
(
pool
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Derivative
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
Get
Jacobian
(
1.0
,
r
);
}
abstract_dynamic_variable
*
Copy
()
const
{
return
static_cast
<
abstract_dynamic_variable
*>
(
new
ternary_custom_variable
(
*
this
));}
};
typedef
abstract_dynamic_variable
abstract_variable
;
...
...
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