# [R] SVD with positivity constraints

Molins, Jordi Jordi.Molins at drkw.com
Tue Jul 27 11:22:31 CEST 2004

```Thank you to Prof Brian Ripley and to Ken Knoblauch for your replies.

I should explain a little bit more about the problem at hand: in principle,
the matrix can have more rows than columns or the other way around. However,
I always could include in an artificial way more equations, such that there
are more equations than unknowns. So, in practical terms, the first question
from Prof Brian Ripley is: more equations than unkowns.

I have
Additionally, I have seen in several places that is suggested to use La.svd

-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
Sent: 27 July 2004 10:13
To: Molins, Jordi
Cc: 'r-help at stat.math.ethz.ch'
Subject: Re: [R] SVD with positivity constraints

If A is not square, which dimension is larger?  There will most likely be
either no solution or an infinity of solutions.  If the latter, I think
you are using the Moore-Penrose inverse (depends exactly how you use the
SVD), that is the shortest solution, but the SVD will give you the whole
space of solutions and you could compute if that intersects the positive
orthant.

On Tue, 27 Jul 2004, Molins, Jordi wrote:

> I have a matrix equation, Ax=b, that I need to solve for x. x should be a
> vector of positive numbers (between 0 and 1). A is not a square matrix in
> general. This lead me to using the SVD. However, using the SVD gives me
> positive and negative numbers, as well. I have some constraints included
in
> the A matrix itself (i.e., that the sum of some xi should be equal to 1)
but
> I do not know how to include the constraint that each xi should be
> non-negative.
>
> Is there in R (or somewhere else) an SVD that includes this kind of
> constraint? or some other optimizer that can cope with solving non-square
> matrix equations, including the positivity constraint?

optim(method="L-BFGS-B") can cope with [0, 1] constraints.

--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

--------------------------------------------------------------------------------
The information contained herein is confidential and is inte...{{dropped}}

```