Search
Code Directory
 ASP
 ASP.NET
 C/C++
 CFML
 CGI/PERL
 Delphi
 Development
 Flash
 HTML
 Java
 JavaScript
 Pascal
 PHP
 Python
 SQL
 Tools
 Visual Basic & VB.NET
 XML
New Code
The C# Excel Library 2020.5
dbForge Studio for MySQL 9.0
LinkedIn Clone 2.2
Uber clone Apps 4.0
Cab Booking Script 1.3.2
Airbnb Clone HomestayDNN 3.0
Magento Language switcher 1.2.1
The .Net PDF Library 2020.3.2
IP2Location Geolocation Database 2020.5
ODBC Driver for MailChimp 2.0
ODBC Driver for NetSuite 2.0
ODBC Driver for SQL Azure 3.1
dbForge Schema Compare for Oracle 4.1
dbForge Data Compare for Oracle 5.1
dbForge Studio for Oracle 4.1
Top Code
dbForge Studio for MySQL 8.1
dbForge Studio for Oracle 3.10
dbForge Schema Compare for Oracle 2.7
dbForge Data Compare for Oracle 3.7
IP2Location Geolocation Database 2020.5
azar's knights tour 1.0
PDF Chart Creator DLL
PDF Chart Creator Dynamic Link Library 1.0
Form creator 1.0
FormMail Lite 1.0
SocketTimesheet
BS/1 Professional - Time Billing and Accounting
Online Video Rental Software System Alpha
Bullschmidt ASP Web Database Sample 2.0
Easy PCB Design Software in Java 1.0
Top Rated
phpEnter 5.1.
Single Leg MLM 1.2.1
Azizi search engine script PHP 4.1.10
Paste phpSoftPro 1.4.1
Extreme Injector 3.7
Deals and Discounts Website Script 1.0.2
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Aglowsoft SQL Query Tools 8.2
Invoice Manager by PHPJabbers 3.0
ICPennyBid Penny Auction Script 4.0
PHP Review Script 1.0
ATN Resume Finder 2.0
ATN Site Builder 3.0
Availability Booking Calendar PHP 1.0
Robust Sparse data types 1.0
File ID: 85264






Robust Sparse data types 1.0
Download Robust Sparse data types 1.0http://www.mathworks.comReport Error Link
License: Shareware
File Size: 30.7 KB
Downloads: 1
Submit Rating:
Robust Sparse data types 1.0 Description
Description: The main file in this package, rsparse.m, creates a sparse array object that is a subclass of MATLAB's native sparse data type, but which is robust against certain bugs and errors (present as of R2009b).

S=rsparse(varargin)

The I/O syntax and options for rsparse() are identical to that of sparse().

Where sparse() would return a double sparse matrix, rsparse() will return a matrix of class RobustSparseDouble, a class defined in this package. Similarly, wherever sparse() would return a logical sparse matrix, rsparse() will return a matrix of user-defined class RobustSparseLogical.

%%%%%%%%%
EXAMPLE 1: Indexing robustness - this utilizes the sparse-sub-access package by Bruno Luong.


>> A=sparse(100000,100000,1), %native MATLAB sparse matrix


A =

(100000,100000) 1


>> B=rsparse(A), %convert to robust type

B=

(100000,100000) 1



>> whos A B

Name Size Bytes Class Attributes

A 100000x100000 400016 double sparse
B 100000x100000 400072 RobustSparseDouble



>> A(logical(A))=2, %Wrong result due to indexing bug

A =

(65408,14101) 2
(100000,100000) 1



>> B(logical(B))=2, %RIGHT!!!

B=

(100000,100000) 2



%%%%%%%%%
EXAMPLE 2: Robustness to mixed data type operations.

For some reason, MATLAB decides to issue an error when a mathematical operation involving sparse and non-double numeric data is attempted:

A=speye(3);
x=single([1;2;3]);

>> y=A*x, %ANNOYING....

??? Error using ==> mtimes
Sparse single arrays are not supported.


The RobustSparse types, however, will silently pre-convert the foreign data to doubles:

B=rsparse(A);

>>y=B*x, %BETTER!!!

y =

1
2
3

%%%%%%%%%%%%%%%%%%%%%%

I'm hoping that TMW will fix these problems soon, rendering this package obsolete. Once they do, simply replace the code in rsparse.m with the following, and rsparse() will become equivalent to sparse()

function S=rsparse(varargin)

S=sparse(varargin{:});

end


The package also includes "robustified" versions of other common sparfun toolbox routines: rspeye, rsprand, rsprandn, rprandsym,... They too will revert to their native MATLAB versions when the above replacement is made.
%%%%%%%%


CAUTIONARY NOTES:

(1) Because this package uses various M-coded wrappers for built-in sparse routines, there is obviously some compromise in speed.

(2) I've overloaded all math operators (+ , - , .* , >=, <=, etc...) and some common functions like sum(), inv(), spfun(), etc... to return RobustSparse data types, where they would otherwise return ordinary sparse types.

For obvious reasons, however, I cannot do this for all functions out there capable of returning a sparse matrix (e.g., triu, tril, sin, cos, etc ... ), nor can I keep up with TMW's releases of new functions.

Therefore, you should bear in mind that B=triu(rsparse(A)) and similar will return an ordinary native sparse data type, B, with all of its vulnerabilities. You should take care to post convert such results to robust type, via B=rsparse(B). Or, you can add overloaded methods as you see fit, mimicking the others in RobustSparseDouble.m and RobustSparseLogical.m

License: Shareware

Related: Foreign, doubles, gtgty dbx, preconvert, silently, types, hoping, Simply

O/S:BSD, Linux, Solaris, Mac OS X

File Size: 30.7 KB

Downloads: 1



More Similar Code

VIDEO TUTORIAL: DATA TYPES IN MATLAB. (Narration in Spanish)



C++ Tutorial - Data types is an article using which you would be able to refresh your knowledge on the basic data type strings of C++ language. In this article the author has given descriptions on basic data types along with the appropriate syntax...



New JScript.NET Data Types is a tutorial which gives you a brief summary about the various data types of JScript.NET. The author lists the data types such as boolean, byte, string, char, decimal, float, int etc of the JScript.NET with its cts type...



If you have a C function with arguments that are float or pointer to float (rather than double or pointer to double) you can call the function from MATLAB and pass arguments to the function as single data types. For example, in this case we have a...



"Extended Data Types for PHP" is a collection of PHP5 classes, which provide easily usable common data types like Lists, Trees or Graphs. Installation will be possible via an PEAR Channel or as local library in a website's code base.



GeoRuby provides geometric data types from the OGC "Simple Features" specification. A plugin for Rails which manages PostGIS and MySQL geometric columns in a transparent way is also provided. Other stuff: some support for GeoRSS, KML, SHP.



An XML API for Ruby written in C, using only Ruby native data types internally. Parses/generates XML, automatically pretty printing and en-/de- coding characters. Transmutates XML attributes to/from objects. Find node paths via strings or regex...



A relation database management front end to provide advanced data types (drop downs,checkbokes, tallys,...) and customizable reports much like a traditional spreadsheet with more functionality. With a Ajax front end and portable php back end.



Portable Source Code (C/C++ programming language) that provides multi-platform portability for data types (numeric, conditional, etc.). Types like 'unsigned 32 bits int', 'boolean expression', etc. all are part of this package.No...



Ask the DotNetJunkies: Working with Properties and Data Types is a tutorial in which the discusses about the properties and datatypes of the ASP.NET. In this tutorial the author shows how to set the forecolor property of the ASP.NET label control...

User Review for Robust Sparse data types
- required fields
     

Please enter text on the image