Page 1 of 1

matrix of all 1s

Posted: Mon Apr 25, 2016 10:24 pm
by gerstein
How do I create an nxn matrix whose entries are all 1's ?

Re: matrix of all 1s

Posted: Wed Apr 27, 2016 4:14 pm
by mgates3
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

Re: matrix of all 1s

Posted: Wed Apr 27, 2016 4:19 pm
by gerstein
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.

Re: matrix of all 1s

Posted: Wed Apr 27, 2016 4:24 pm
by mgates3
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