matrix of all 1s

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
gerstein
Posts: 2
Joined: Mon Apr 25, 2016 10:19 pm

matrix of all 1s

Post by gerstein » Mon Apr 25, 2016 10:24 pm

How do I create an nxn matrix whose entries are all 1's ?

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: matrix of all 1s

Post by mgates3 » Wed Apr 27, 2016 4:14 pm

On the CPU, LAPACK's [sdcz]laset function. MAGMA declares these in a separate LAPACK header. For a double precision, M x N matrix A, embedded in an lda x N array:

Code: Select all

#include "magma_lapack.h"

void function(...) {
    ...
    double c_one = 1.0;
    lapackf77_dlaset( "Full", &M, &N, &c_one, &c_one, A, &lda );
}
On the GPU, MAGMA has a similar function, magmablas_[sdcz]laset.
http://icl.cs.utk.edu/projectsfiles/mag ... 663900ae83

-mark

gerstein
Posts: 2
Joined: Mon Apr 25, 2016 10:19 pm

Re: matrix of all 1s

Post by gerstein » Wed Apr 27, 2016 4:19 pm

I am new to Magma (and to any computer algebra system), and I can't understand this at all. I'm guessing that there is a simple command available to produce an nxn matrix of ones, but I am unable to extract this from the response to my question of how to do it.

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: matrix of all 1s

Post by mgates3 » Wed Apr 27, 2016 4:24 pm

Are you using MAGMA, the computer algebra system:
http://magma.maths.usyd.edu.au/magma/

Or MAGMA, the linear algebra C/C++ library?
http://icl.cs.utk.edu/magma/

This forum is for the later, the linear algebra C/C++ library.

-mark

Post Reply