This project has moved. For the latest updates, please go here.

Creating an empty vector not allowed via constructor

Jul 15, 2011 at 9:55 AM

I tried creating an empty vector using the constructor:

 

var vector = new MathNet.Numerics.LinearAlgebra.Double.DenseVector(1);

 

which fails with an ArgumentException, but can do this using an explicit cast:

 

var vector = (MathNet.Numerics.LinearAlgebra.Double.DenseVector)new double[0];

I'd like to be able to create an empty vector to concatenate to. Any objections on relaxing the constraint on the constructor to match what is possible using the explicit cast?

 

Coordinator
Jul 19, 2011 at 1:16 PM

Hi, no this is definitely an inconcistency that could be removed. Feel free to relax the constraint and send me a pull request. I will merge this with mainline. Also make sure to add one or more unit tests to check this case in the future ...

Thanks, Jurgen

Jul 20, 2011 at 8:34 AM

I've created a fork and sent a pull request. Just check when merging to remove the operator overloads for scalar addition / subtraction, since I started on this before implementing this. I recon that the addition of the Add and Subtract methods on matrices might be useful.

Coordinator
Aug 4, 2011 at 5:20 PM
Hi,

Sorry for the late reply. Was on holiday. I can't find your pull
request. Did you send it to me or to the mainline math.net repository?

J

On Wed, Jul 20, 2011 at 9:34 AM, [email removed] wrote:
> From: czietsman
>
> I've created a fork and sent a pull request. Just check when merging to
> remove the operator overloads for scalar addition / subtraction, since I
> started on this before implementing this. I recon that the addition of the
> Add and Subtract methods on matrices might be useful.
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe or change your settings on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com
Aug 5, 2011 at 8:11 AM

I think I sent it to the math.net repository. Christoph Rüegg asked me to try and create a git patch. I'll see what I can do. Haven't used Mercurial or Git before, but I'm enjoying it so far.