octave-bug-tracker
[Top][All Lists]

## [Octave-bug-tracker] [bug #41839] sprand/sprandn functions with 4rth par

 From: Eduardo Ramos Fernández Subject: [Octave-bug-tracker] [bug #41839] sprand/sprandn functions with 4rth parameter missing in Octave Date: Tue, 11 Mar 2014 21:19:10 +0000 User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0

```URL:
<http://savannah.gnu.org/bugs/?41839>

Summary:  sprand/sprandn functions with 4rth parameter
missing in Octave
Project: GNU Octave
Submitted by: edu159
Submitted on: mar 11 mar 2014 21:19:09 GMT
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name: Eduardo Ramos (edu159)
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: GNU/Linux

_______________________________________________________

Details:

I have modified sprand/sprandn functions to include a fourth parameter (rc,
reciprocal condition number) compliant with Matlab. The approach I followed
was:

>From the singular value descomposition A =U*S*V'.

1) If rc is a scalar then it would be the reciprocal condition number and I
will set the minimum singular value and maximun singular value to fit to it.
Then random values between vmin and vmax will be generated and sorted. With
that S is build.

2)If rc is a vector, the values inside are the first singular values of the
matrix. The rest will be 0. S is build from them as diagonal elements.

3)Once we have S we can see U and V as rotation matrices(they are ortogonal
and , so they will be Jacobi rotation matrices formed by n rotations U =
U1*U2*...Un , V=V1*V2...*Vn
In each iteration the matrix will be populated until density required is
achieved (from testing with a 0.01% of error).

Feedback would be welcome.

_______________________________________________________

File Attachments:

-------------------------------------------------------
Date: mar 11 mar 2014 21:19:09 GMT  Name: sprand_4rth_parameter.diff  Size:
10kB   By: edu159

_______________________________________________________

<http://savannah.gnu.org/bugs/?41839>

_______________________________________________