Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 956 Categories, Downloaded 50.473.607 Times

Direct Indexing of Function Calls (OOP Exercise) 1.0

  Date Added: April 09, 2013  |  Visits: 329

Direct Indexing of Function Calls (OOP Exercise)

Report Broken Link
Printer Friendly Version


Product Homepage
Download (40 downloads)



IndexableFunction is a class of function-handle-like objects that allow a function to be called and post-indexed in a single expression. Often, in the MATLAB Central NG, I've seen people ask whether it is possible to call functions with a syntax like y=func(arg)(i) as an alternative to doing, z=func(arg); y=z(i); Essentially, the answer is no. Standard MATLAB syntax does not allow this. However, the IndexableFunction class enables functions to be called with the very similar syntax y=func{arg}(i). If you have to call and post-index a function multiple times, this might save you some keystrokes. However, the main benefit of this submission is probably as an illustration/exercise in MATLAB OOP. Also, it will give me a link to refer to whenever the discussion point pops up again in the NG (as it persistently does). In general, there is no computational superiority that this syntax does or ever could bestow. Internally, the complete vector-valued output of the function is generated and then post-indexed, which is the only generic way of enabling this syntax for an arbitrary set of functions. This is because many MATLAB functions use algorithms that inherently must return a complete vector-valued output (e.g. fft(x)). USAGE: f=IndexableFunction(h) in: h: a function handle out: f: an IndexableFunction object EXAMPLE: >>hsin=@sin; %Handle to sine function >>fsin=IndexableFunction(@sin); %Create object >>hsin((0:.25:1)*pi) %An ordinary kind of function call ans = 0 0.7071 1.0000 0.7071 0.0000 >>fsin{(0:.25:1)*pi} %Equivalent function call using the object (note the braces) ans = 0 0.7071 1.0000 0.7071 0.0000 >>fsin{(0:.25:1)*pi}(3:4) %The same function call, but returning the 3rd and 4th component only. ans = 1.0000 0.7071The submission also contains some additional tools meant to allow a library of IndexableFunctions to be made globally available to all MATLAB workspaces.There tool initlib.m creates a library data file LibraryStruct.mat. The file contains a structure S whose fields are IndexableFunction handles to all the methods of class double. You can also add/remove your own functions to/from the library using add2lib.m and rmlib.m (see the help doc for these functions). There is also an additional class 'flib'. MATLAB automatically loads S from LibraryStruct.mat into a globally available Constant property of flib when the class is first accessed. This allows you to do things like the following 1-line operations in any MATLAB workspace, >>x=rand(1,4)-.5 x = -0.3424 0.4706 0.4572 -0.0146 >>flib.S.abs{x}(1) ans = 0.3424 >>flib.S.sort{x}(2) ans = -0.0146In cases where it is worthwhile, you can of course unpack IndexableFunctions that you are going to use repeatedly, e.g. >>sort=flib.S.sort; >>sort{x}(2) ans = -0.0146

Requirements: No special requirements
Platforms: Matlab
Keyword: Creates Globally Handles Indexablefunctions Initlibm Library Meant Workspaces
Users rating: 0/10

License: Shareware Size: 10 KB
USER REVIEWS
More Reviews or Write Review


DIRECT INDEXING OF FUNCTION CALLS (OOP EXERCISE) RELATED
Libraries  -  ff javascript library 1.11
ff javascript library is a minimal library meant to develop real-life Javascript-enabled Web sites. ff javascript library offers a cross-brower API for all common browsers. That is, all w3 standards compatible browsers (Mozilla/Firefox, Opera,...
17.41 KB  
Programming  -  OpenFeint-iOS-Framework 1.0
OpenFeint SDK built as a static framework This is a simple XCode project which will build OpenFeint as a Static Framework. Once built it behaves and handles just like any framework but in reality it is a static library - which means it...
1.95 MB  
Desktop Toys  -  GObject Introspection 1.31.10
GObject Introspection's goal is to describe the APIs and collect them in a uniform, machine readable format. GIR XML format There's an XML format called GIR used by GObjectIntrospection. The purpose of it is to provide a...
1.06 MB  
Utilities  -  FontExplorer X Pro for Mac OS 2.5.1
Optimized for professional use, the FontExplorer X Pro solution gives you the power you need to manage all your fonts. Now you can more easily manage, activate and organize your existing font collection as well as find and experiment with new...
38 MB  
Multimedia & Graphics  -  Antetype 1.0
Antetype UI Designer is a brand new, ground-breaking design application that supports user interface designers at every step of their work. Design beautiful interfaces, invent new widgets, style them and put it all together in an interactive...
15.5 MB  
Discussion Boards  -  Funkboard PHP 0.5.1
Funkboard is a PHP-based message board. It uses PHP, and works with any PHP version. It needs a MySQL database for storing information. It creates pages with from a library-type thingy, which makes changing the style pretty simple. Features:-...
 
Programming  -  Tungsten Toolbox 1.0
This is a collection of tools to work with database replication. It includes Tungsten Sandbox (a tool to install several Tungsten-Replicator instances in one host) ldg (Large Data Generator) a tool that creates and...
3.07 KB  
Development Editors  -  Meliae 0.3.0
This project is similar to heapy (in the 'guppy' project), in its attempt to understand how memory has been allocated. Currently, its main difference is that it splits the task of computing summary statistics, etc of memory consumption...
61.44 KB  
Development Tools  -  mklib: a pedestrian function library loader generator 1.0
MKLIB takes one or more list(s) of valid M-files and automatically creates a library loader function (M-file), which returns a structure of function handles to all the subfunctions found in those M-filesthe structure's field names are set to the...
10 KB  
Libraries  -  Audio Input-Output Library 0.2.0
Audio Input-Output Library (libaio) is meant to solve the problem of differing digital audio platforms once and for all. JACK is unnecessarily complex for most applications, and while libaos support for file output is cool, it limits what the...
153.6 KB  
NEW DOWNLOADS IN SCRIPTS, DEVELOPMENT TOOLS
Scripts  -  Freelancer Script 5.05
Main Features: 100% Secured. Email Support (3 Years). FREE Updates (3 Years). Post projects. Featured projects. Private projects. Sealed projects. Edit/delete projects. Select freelancers....
5.49 MB  
Scripts  -  B2B Script 4.20
Main Features: 100% Secured. Email Support (3 Years). FREE Updates (3 Years). Sign-up Account (Registration of account). Lead generation tools (for the sellers). Email verification to...
5.49 MB  
Scripts  -  B2C Script 5.06
Main Features: 100% Secured. Email Support (3 Years). FREE Updates (3 Years). The script comes with totally editable site colors, icons and graphics Multilevel categories allows extensive browsing Admin can change Category ordering or...
5.49 MB  
Scripts  -  Social Networking Script 2.86
Main Features: 100% Secured. Email Support (3 Years). FREE Updates (3 Years). Registration with name, email, password, date of birth etc. User can add multiple school, college, university with start...
5.49 MB  
Scripts  -  Business Networking Script 8.04
Main Features: 100% Secured. Email Support (3 Years). FREE Updates (3 Years). Ajax based interface. Profile creation. Different types of profile. Profile for jobseekers, employers and employed...
5.49 MB  
Development Tools  -  Aml2CHM 3.50
Those who use the popular Aml Pages text editor might be looking out for a way of generating help files from their text and notes. Aml2CHM is a plug-in that was developed to offer people a quick and efficient way of converting Aml Pages documents...
549.99 KB  
Development Tools  -  VMP Viewer 1.0
This is a very rudimentary tool to visualize the VMP files generated by BrainVoyager. Useful to share files with people who do not have BV.
10 KB  
Development Tools  -  Sending reports and timestamped file by emailing 1.0
main executing reference usage:[1] usage_send_mail.mIllustrates email sending with multiple separate files or single timestamped tar file. Attachment failure is properly handled, with continuation of report emailing without the attachment.[2]...
768 KB  
Development Tools  -  IrisMVC 2.0 rc1
IrisMVC is an OOP PHP framework that developers can use as a strong and secure foundation to build on various web applications following the Model-View-Controller (MVC) pattern. It provides the basic functionality developers need, without...
51.2 KB  
Development Tools  -  7-Zip for Script 4.42
7-Zip is a file archiver with a high compression ratio.Features:- High compression ratio in new 7z format with LZMA compression- Supported formats:- Packing / unpacking: 7z, ZIP, GZIP, BZIP2 and TAR- Unpacking only: RAR, CAB, ISO, ARJ, LZH, CHM,...
624.64 KB