{"action":"created","issue":{"url":"https://api.github.com/repos/chebfun/chebfun/issues/1768","repository_url":"https://api.github.com/repos/chebfun/chebfun","labels_url":"https://api.github.com/repos/chebfun/chebfun/issues/1768/labels{/name}","comments_url":"https://api.github.com/repos/chebfun/chebfun/issues/1768/comments","events_url":"https://api.github.com/repos/chebfun/chebfun/issues/1768/events","html_url":"https://github.com/chebfun/chebfun/pull/1768","id":134441965,"number":1768,"title":"Fix chebfun2/sample","user":{"login":"ajt60gaibb","id":1814063,"avatar_url":"https://avatars.githubusercontent.com/u/1814063?v=3","gravatar_id":"","url":"https://api.github.com/users/ajt60gaibb","html_url":"https://github.com/ajt60gaibb","followers_url":"https://api.github.com/users/ajt60gaibb/followers","following_url":"https://api.github.com/users/ajt60gaibb/following{/other_user}","gists_url":"https://api.github.com/users/ajt60gaibb/gists{/gist_id}","starred_url":"https://api.github.com/users/ajt60gaibb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajt60gaibb/subscriptions","organizations_url":"https://api.github.com/users/ajt60gaibb/orgs","repos_url":"https://api.github.com/users/ajt60gaibb/repos","events_url":"https://api.github.com/users/ajt60gaibb/events{/privacy}","received_events_url":"https://api.github.com/users/ajt60gaibb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"aaustin141","id":3380006,"avatar_url":"https://avatars.githubusercontent.com/u/3380006?v=3","gravatar_id":"","url":"https://api.github.com/users/aaustin141","html_url":"https://github.com/aaustin141","followers_url":"https://api.github.com/users/aaustin141/followers","following_url":"https://api.github.com/users/aaustin141/following{/other_user}","gists_url":"https://api.github.com/users/aaustin141/gists{/gist_id}","starred_url":"https://api.github.com/users/aaustin141/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaustin141/subscriptions","organizations_url":"https://api.github.com/users/aaustin141/orgs","repos_url":"https://api.github.com/users/aaustin141/repos","events_url":"https://api.github.com/users/aaustin141/events{/privacy}","received_events_url":"https://api.github.com/users/aaustin141/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2016-02-18T00:19:38Z","updated_at":"2016-02-23T19:53:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/chebfun/chebfun/pulls/1768","html_url":"https://github.com/chebfun/chebfun/pull/1768","diff_url":"https://github.com/chebfun/chebfun/pull/1768.diff","patch_url":"https://github.com/chebfun/chebfun/pull/1768.patch"},"body":"`chebfun2/sample` was assuming that the underlying techs were chebtechs.  Closes #1766. "},"comment":{"url":"https://api.github.com/repos/chebfun/chebfun/issues/comments/187875174","html_url":"https://github.com/chebfun/chebfun/pull/1768#issuecomment-187875174","issue_url":"https://api.github.com/repos/chebfun/chebfun/issues/1768","id":187875174,"user":{"login":"gradywright","id":6304453,"avatar_url":"https://avatars.githubusercontent.com/u/6304453?v=3","gravatar_id":"","url":"https://api.github.com/users/gradywright","html_url":"https://github.com/gradywright","followers_url":"https://api.github.com/users/gradywright/followers","following_url":"https://api.github.com/users/gradywright/following{/other_user}","gists_url":"https://api.github.com/users/gradywright/gists{/gist_id}","starred_url":"https://api.github.com/users/gradywright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gradywright/subscriptions","organizations_url":"https://api.github.com/users/gradywright/orgs","repos_url":"https://api.github.com/users/gradywright/repos","events_url":"https://api.github.com/users/gradywright/events{/privacy}","received_events_url":"https://api.github.com/users/gradywright/received_events","type":"User","site_admin":false},"created_at":"2016-02-23T19:53:23Z","updated_at":"2016-02-23T19:53:23Z","body":"I think there is another reason that @aaustin141's solution is better than drilling down to the values.  The issue with doing\r\n```\r\n[C,D,R] = cdr(f);\r\nCvals = chebfun(C, m).values; \r\nRvals = chebfun(R, n).values; \r\n```\r\nIs that it doesn't exploit any fast sampling at the `tech` level.  If `C` or `R` are `trigfuns` then calling the above calling sequence above will just evaluate them at Chebyshev points and no fast transform is used.  \r\n\r\nBy having a `sample` function at the `tech` level, the `techs` can exploit any fast evaluation methods.  For example evaluating at equally spaced points for `trigtechs`, or 2nd kind Chebyshev points for `chebtech2`.\r\n\r\nUnfortunately, the implementations by @aaustin141 in [71f6e9e](https://github.com/chebfun/chebfun/commit/71f6e9e789fd09545a7f6823b63fbe869d742602) do not exploit any fast algorithms at the `tech` level.  For example, `chebtech2/sample` has the implementation\r\n```\r\npoints = chebtech2.chebpts(n);\r\nvalues = feval(f, points);\r\n```\r\nIt would be more efficient to use `alias` and `coeffs2vals`. \r\n\r\n\r\n"}}