Last active
August 29, 2015 14:01
-
-
Save sushant-hiray/b7cc24e7874154560aaa to your computer and use it in GitHub Desktop.
Revisions
-
sushant-hiray revised this gist
May 14, 2014 . 1 changed file with 11 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,11 +61,19 @@ RCP<const Basic> sin(const RCP<const Basic> &arg) if (conjugate) { // cos has to be returned if (sign == 1) return rcp(new Cos(ret_arg)); else return mul(minus_one, rcp(new Cos(ret_arg))); } else { if (eq(ret_arg, zero)) { return sign*sin_table[index]; } else { if (sign == 1) return rcp(new Sin(ret_arg)); else return mul(minus_one, rcp(new Sin(ret_arg))); } } } -
sushant-hiray revised this gist
May 14, 2014 . 1 changed file with 49 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,16 @@ const RCP<const Basic> handle_minus(const RCP<const Basic> &arg, bool odd) { if(could_extract_minus(r)) { if(odd) return mul(minus_one, r); else return r; } } // \return true of conjugate has to be returned finally else false bool eval(const RCP<const Basic> &arg, int period, bool odd, //input const Ptr<RCP<const Basic>> arg&,int& index, int& sign) //output { if (eq(arg, zero)) return zero; bool check; @@ -10,28 +20,52 @@ bool eval(const RCP<const Basic> &arg, int period, bool odd, //input if (check) { int m = n->as_int(); m = m % (12*period); sign = 1; if (eq(r, zero)) { index = m; *arg = zero; return false; } else if ((m % (12*period)) == 0) { index = 0; *arg = handle_minus(r, odd); if (!odd) sign = -1; return false; } else if ((m % 6) == 0)) { if (m == 6) sign = 1; else sign = -1; *arg = r; return true; } } else { *arg = r; index = -1; return false; } } RCP<const Basic> sin(const RCP<const Basic> &arg) { RCP<const Basic>>& ret_arg; int index; int sign; bool conjugate = eval(arg, 2, 1, //input outArg(ret_arg), index, sign); //output if (conjugate) { // cos has to be returned if (sign == 1) return cos(ret_arg); else return mul(minus_one, cos(ret_arg)); } else { } } -
sushant-hiray revised this gist
May 14, 2014 . 1 changed file with 26 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,36 @@ // \return true of conjugate has to be returned finally else false bool eval(const RCP<const Basic> &arg, int period, bool odd, //input const Ptr<RCP<const Basic>> arg&,int index) //output { if (eq(arg, zero)) return zero; bool check; RCP<const Integer> n; RCP<const Basic> r; check = get_pi_shift(arg, outArg(n), outArg(r)); if (check) { int m = n->as_int(); m = m % (12*period); if (eq(r, zero)) { index = m; *arg = zero; return false; } else if((m % (12*period)) == 0) { index = 0; if(could_extract_minus(r)) { if(odd) *arg = mul(minus_one, r); else *arg = r; } else *arg = r; return false; } else if((m % 6) == 0)) { } } else return rcp(new Sin(arg)); -
sushant-hiray renamed this gist
May 14, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
sushant-hiray created this gist
May 14, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ RCP<const Basic> eval(const RCP<const Basic> &arg) { if (eq(arg, zero)) return zero; bool check; RCP<const Integer> n; RCP<const Basic> r; check = get_pi_shift(arg, outArg(n), outArg(r)); if (check) { int index; index = n->as_int(); return sin_table[index % 24]; } else return rcp(new Sin(arg)); }