{"action":"created","issue":{"url":"https://api.github.com/repos/SystemAnalysisDpt-CMC-MSU/ellipsoids/issues/40","repository_url":"https://api.github.com/repos/SystemAnalysisDpt-CMC-MSU/ellipsoids","labels_url":"https://api.github.com/repos/SystemAnalysisDpt-CMC-MSU/ellipsoids/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/SystemAnalysisDpt-CMC-MSU/ellipsoids/issues/40/comments","events_url":"https://api.github.com/repos/SystemAnalysisDpt-CMC-MSU/ellipsoids/issues/40/events","html_url":"https://github.com/SystemAnalysisDpt-CMC-MSU/ellipsoids/issues/40","id":116414762,"number":40,"title":"Make matrix function classes derived from gras.mat.AMatrixFunctionComparable comparable","user":{"login":"pgagarinov","id":4868370,"avatar_url":"https://avatars.githubusercontent.com/u/4868370?v=3","gravatar_id":"","url":"https://api.github.com/users/pgagarinov","html_url":"https://github.com/pgagarinov","followers_url":"https://api.github.com/users/pgagarinov/followers","following_url":"https://api.github.com/users/pgagarinov/following{/other_user}","gists_url":"https://api.github.com/users/pgagarinov/gists{/gist_id}","starred_url":"https://api.github.com/users/pgagarinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgagarinov/subscriptions","organizations_url":"https://api.github.com/users/pgagarinov/orgs","repos_url":"https://api.github.com/users/pgagarinov/repos","events_url":"https://api.github.com/users/pgagarinov/events{/privacy}","received_events_url":"https://api.github.com/users/pgagarinov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SystemAnalysisDpt-CMC-MSU/ellipsoids/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"akskir","id":15004295,"avatar_url":"https://avatars.githubusercontent.com/u/15004295?v=3","gravatar_id":"","url":"https://api.github.com/users/akskir","html_url":"https://github.com/akskir","followers_url":"https://api.github.com/users/akskir/followers","following_url":"https://api.github.com/users/akskir/following{/other_user}","gists_url":"https://api.github.com/users/akskir/gists{/gist_id}","starred_url":"https://api.github.com/users/akskir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akskir/subscriptions","organizations_url":"https://api.github.com/users/akskir/orgs","repos_url":"https://api.github.com/users/akskir/repos","events_url":"https://api.github.com/users/akskir/events{/privacy}","received_events_url":"https://api.github.com/users/akskir/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/SystemAnalysisDpt-CMC-MSU/ellipsoids/milestones/2","html_url":"https://github.com/SystemAnalysisDpt-CMC-MSU/ellipsoids/milestones/Autumn-Winter%202015","labels_url":"https://api.github.com/repos/SystemAnalysisDpt-CMC-MSU/ellipsoids/milestones/2/labels","id":1357610,"number":2,"title":"Autumn-Winter 2015","description":"","creator":{"login":"pgagarinov","id":4868370,"avatar_url":"https://avatars.githubusercontent.com/u/4868370?v=3","gravatar_id":"","url":"https://api.github.com/users/pgagarinov","html_url":"https://github.com/pgagarinov","followers_url":"https://api.github.com/users/pgagarinov/followers","following_url":"https://api.github.com/users/pgagarinov/following{/other_user}","gists_url":"https://api.github.com/users/pgagarinov/gists{/gist_id}","starred_url":"https://api.github.com/users/pgagarinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgagarinov/subscriptions","organizations_url":"https://api.github.com/users/pgagarinov/orgs","repos_url":"https://api.github.com/users/pgagarinov/repos","events_url":"https://api.github.com/users/pgagarinov/events{/privacy}","received_events_url":"https://api.github.com/users/pgagarinov/received_events","type":"User","site_admin":false},"open_issues":18,"closed_issues":13,"state":"open","created_at":"2015-10-15T16:08:29Z","updated_at":"2016-02-16T16:32:58Z","due_on":"2017-12-20T21:00:00Z","closed_at":null},"comments":4,"created_at":"2015-11-11T20:27:36Z","updated_at":"2016-02-18T15:58:24Z","closed_at":null,"body":"Deadline: end of the semester\r\n---------------------------------------------------------------------------------\r\nThe goal of this task is to make all subclasses of gras.mat.AMatrixFunctionComparable class comparable. This is needed for issue #39\r\nso that ellipsoidal tubes with built-in Dormand-Prince interpolation can be compared with any given precision.\r\n\r\n1) Please read a description for issue #39 and make sure you fully understand it.\r\n2) Investigate gras.mat.AMatrixFunctionComparable class. Current implementation of this class needs to be slightly changed by\r\n  a) inheriting it from modgen.common.obj.HandleObjectCloner (which automatically adds isEqual and re-defines isequal,isequaln, eq,ge,le etc).\r\n  b) Re-defining isEqualScalarInternal method of HandleObjectCloner using the current code from AMatrixFunctionComparable.isEqual method \r\n  (with a few simplifications - after all isEqualScalarInternal is only for comparing scalar objects). This way any vectorial object (isEqual inherited from\r\n   HandleObjectCloner as well as other comparison methods inherited from this class can handle vectorial objects by comparing them element-wise and using isEqualScalarInternal\r\n   method that can be re-defined in derived classes) inherited \r\n   AMatrixFunctionComparable can be comparable as long as it implements an abstract AMatrixFunctionComparable.toStructInternal.\r\n\r\n3) Study all functions from gras.mat and gras.mat.fcnlib packages. Then implement toStructInternal for each of them in a way that makes possible an\r\nadequate comparison. By adequate comparison I mean that comparing structures should be equivalent to comparing functions themselves. \r\nFor instace comparing objects of ConstMatrixFunction class is easy - you just compare constant matrices because the function is not time-dependent.\r\nHowever for the most functions (except for a few functions that are very simple or/and similar to ConstMatrixFunction) it is not that easy because all you have is \"evaluate\" method and no analytical formula. Given a comparison precision absTol and two matrix functions M_1(t) and M_2(t)\r\n the problem you need to solve then is finding t^{*} such that ||M_1(t) - M_2(t)||>absTol. If no such t^{*} if found M_1 and M_2 are considered equal and \r\nnot equal otherwise. Of course this is not that simple for a least two reasons:\r\n   a) in addition to absTol and also have relTol - relative precision and comparison should be performed using both precision levels. \r\n   The rough idea behind comparing a and b with both relative and absolute precision is as follows:\r\n   if ||a-b|| <absTol - cosider a and b as equal, otherwise check if 2*||a-b||/(||a||+||b||)< relTol. If positive - a and b are still equal and not equal otherwise.\r\n   But in reality this is a bit more complex than this - see modgen.common.absrelcompare for an exact algorithm. \r\n   b) in practice it is often impossible to find an exact value of t^{*} or prove that it doesn't exist because neither M_1 nor M_2 is not specified in an analytical form.\r\n\r\nAssuming you investigated AMatrixFunctionComparable.isEqual method it should be clear that this method uses modgen.struct.structcomparevec to compare structures. structcomparevec in its turn uses absrelcompare function. For simple functions like ConstMatrixFunction for instance\r\nAMatrixFunctionComparable.toStructInternal should generate a single structure with something that is equivalent to comparing the function itself. For ConstMatrixFunction representing a function M=M(t) it would be a structure like struct ('ConstantMatrix',M). However for \"complex| functions this approach might not \r\nwork well. Why might? Because I suggest we try it as the first step and generate a vector of M(t) values for a certain time grid and put this vector into the resulting\r\nstructure generated by toStructInternal method. This way we will at least have something to compare with later in term of both performance and precision. Thus the next step\r\n4) Implement toStructInternal for simple functions based on their internal structure and for \"complex\" functions - by putting 3d-array of M(t) values into the structure with a single field and then letting isEqualScalarInternal compare these structures with single-field 3d arrays via structcompare. Time grids for which M(t) \r\nis calculated should be specified in isEqual as an additional property \"timeGridVec\". For this purpose you need to override isEqual in AMatrixFunctionApxComparable class using the same approach as the one used in \\products\\+gras\\+ellapx\\+smartdb\\+rels\\ATypifiedAdjustedRel.isEqual method. AMatrixFunctionApxComparable should be inherited from AMatrixFunctionComparable and should be used as base class for comparing all \"complex\" functions. \"timeGridVec\" property should be obligatory for now.\r\n \"Simple\" functions should be inherited from \r\nAMatrixFunctionComparable directly. Also please make sure that your implementation of isEqualScalarInternal just calls \"isEqualScalarAsBlobInternal\" when both absTol=0 and relTol=0 (when we need to do comparison with absolute precision we can just compare a BLOB representation of an object)\r\n5) Write tests that show that\r\n a) \"simple\" functions are compared correctly and that both absTol and relTol precisions are treated adequatly.\r\n b) \"complex\" functions can be compared correctly for sufficiently dense time grids (specified as additional properties to isEqual).\r\n\r\nAll tests should be written in a \"parameterized way\"  - a few test case that are parameterized with a factory generating instances of different matrix funciton classes. See how this is done in elltool.reach.test.run_cont_tests.\r\n\r\nNote: you should work in a branch derived from \"issue_10\" and merge back to issue_10 as it were master. This is because you will work in parallel with Nikitua Zuyanov who also uses issue_10 as \"master\" branch. Once you both finish your work \"issue_10\" will be merged to master."},"comment":{"url":"https://api.github.com/repos/SystemAnalysisDpt-CMC-MSU/ellipsoids/issues/comments/185789825","html_url":"https://github.com/SystemAnalysisDpt-CMC-MSU/ellipsoids/issues/40#issuecomment-185789825","issue_url":"https://api.github.com/repos/SystemAnalysisDpt-CMC-MSU/ellipsoids/issues/40","id":185789825,"user":{"login":"pgagarinov","id":4868370,"avatar_url":"https://avatars.githubusercontent.com/u/4868370?v=3","gravatar_id":"","url":"https://api.github.com/users/pgagarinov","html_url":"https://github.com/pgagarinov","followers_url":"https://api.github.com/users/pgagarinov/followers","following_url":"https://api.github.com/users/pgagarinov/following{/other_user}","gists_url":"https://api.github.com/users/pgagarinov/gists{/gist_id}","starred_url":"https://api.github.com/users/pgagarinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgagarinov/subscriptions","organizations_url":"https://api.github.com/users/pgagarinov/orgs","repos_url":"https://api.github.com/users/pgagarinov/repos","events_url":"https://api.github.com/users/pgagarinov/events{/privacy}","received_events_url":"https://api.github.com/users/pgagarinov/received_events","type":"User","site_admin":false},"created_at":"2016-02-18T15:58:24Z","updated_at":"2016-02-18T15:58:24Z","body":"It is `toStructInternal`, not `toScalarInternal` but the rest is correct. "}}