Commit 4cfdcf3a by Ruslan Yanbarisov

Properly handle sparse data in autodifferentiation

parent 46440d0c
Pipeline #164 failed with stages
in 9 minutes 58 seconds
......@@ -500,7 +500,7 @@ namespace INMOST
INMOST_DATA_ENUM_TYPE ret = 0;
int stat = status_tag[e];
for(unsigned k = 0; k < unknown_tags.size(); ++k)
if( status_tbl[stat][k] ) ret++;
if( e.HaveData(unknown_tags[k]) && status_tbl[stat][k] ) ret++;
return ret;
}
......
......@@ -147,7 +147,13 @@ namespace INMOST
/// Number of tags in block.
INMOST_DATA_ENUM_TYPE Size() const {return (INMOST_DATA_ENUM_TYPE)unknown_tags.size();}
/// Number of entries for each tag in the block.
INMOST_DATA_ENUM_TYPE Size(const Storage & e) const {(void)e; return (INMOST_DATA_ENUM_TYPE)unknown_tags.size();}
INMOST_DATA_ENUM_TYPE Size(const Storage & e) const
{
INMOST_DATA_ENUM_TYPE ret = 0;
for(unsigned k = 0; k < unknown_tags.size(); ++k)
if( e.HaveData(unknown_tags[k]) ) ret++;
return ret;
}
/// Retrive component of the tag related to unknown.
INMOST_DATA_ENUM_TYPE GetValueComp(INMOST_DATA_ENUM_TYPE unk) const {return unknown_comp[unk];}
/// Retrive tag related to unknown value.
......@@ -190,7 +196,7 @@ namespace INMOST
/// Number of tags in block.
INMOST_DATA_ENUM_TYPE Size() const {return 1;}
/// Number of entries for each tag in the block.
INMOST_DATA_ENUM_TYPE Size(const Storage & e) const {(void)e; return 1;}
INMOST_DATA_ENUM_TYPE Size(const Storage & e) const {(void)e; return e.HaveData(unknown_tag) ? 1 : 0;}
/// Retrive component of the tag related to unknown.
INMOST_DATA_ENUM_TYPE GetValueComp(INMOST_DATA_ENUM_TYPE unk) const {(void)unk; assert(unk == 0); return unknown_comp;}
/// Retrive tag related to unknown value.
......@@ -232,7 +238,7 @@ namespace INMOST
/// Number of tags in block.
INMOST_DATA_ENUM_TYPE Size() const {return 1;}
/// Number of entries for each tag in the block.
INMOST_DATA_ENUM_TYPE Size(const Storage & e) const {return (INMOST_DATA_ENUM_TYPE)unknown_tag[e].size();}
INMOST_DATA_ENUM_TYPE Size(const Storage & e) const {return e.HaveData(unknown_tag) ? (INMOST_DATA_ENUM_TYPE)unknown_tag[e].size() : 0;}
/// Retrive component of the tag related to unknown.
INMOST_DATA_ENUM_TYPE GetValueComp(INMOST_DATA_ENUM_TYPE unk) const {(void)unk; assert(unk==0); return ENUMUNDEF;}
/// Retrive tag related to unknown value.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment