{"action":"closed","issue":{"url":"https://api.github.com/repos/chebfun/chebfun/issues/1081","repository_url":"https://api.github.com/repos/chebfun/chebfun","labels_url":"https://api.github.com/repos/chebfun/chebfun/issues/1081/labels{/name}","comments_url":"https://api.github.com/repos/chebfun/chebfun/issues/1081/comments","events_url":"https://api.github.com/repos/chebfun/chebfun/issues/1081/events","html_url":"https://github.com/chebfun/chebfun/issues/1081","id":38586549,"number":1081,"title":"Issue with use of chebpolval2 and 'periodic' chebfun2","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},"labels":[{"url":"https://api.github.com/repos/chebfun/chebfun/labels/chebfun2/chebop2","name":"chebfun2/chebop2","color":"009800"},{"url":"https://api.github.com/repos/chebfun/chebfun/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/chebfun/chebfun/labels/periodic","name":"periodic","color":"fad8c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-07-24T00:16:48Z","updated_at":"2016-05-04T13:54:26Z","closed_at":"2016-05-04T13:54:26Z","body":"The `@chebpolyval2` method is used in the `max`, `median`, `sampleTest`, and `vscale` methods for evaluating a `chebfun2` at a tensor product Chebyshev grid.   If one constructs the `chebfun2` with the 'periodic' option, then a conversion is required from Fourier to Chebyshev every time any of these methods is called, which can significantly slow down any operation (such as a simple call to `display`).  There is no reason that a tensor product 'Fourier' grid (i.e. equally spaced) could not be used in the 'periodic' case.\r\n\r\nI propose we deprecate `chebpolyval2` and create the new methods `@chebfun2/sample`, `@chebfun/sample`, `@bndfun/sample`,  `@chebtech1/sample`,  `@chebtech2/sample`, and `@fourtech/sample`.  Then instead of calling `chebpolyval2` to get the values on a tensor product grid, one calls `@chebfun2\\sample`, this method then calls the `@chebfun/sample` method on the rows and columns, which propagates the calling sequence down to the appropriate tech level.  The sample function at the tech level takes as input the number of points `m` to evaluate the tech at on its 'natural' grid.  Piecewise chebfuns are evaluated on a `m`-point natural grid corresponding to each piece.  \r\n\r\nThe purpose of the `sample` methods are to allow the underlying function to be evaluated much more efficiently than by calling `feval`."}}