Re: [ojAlgo-user] how to manipulate complex matrix
Mathematics, linear algebra and optimisation
Brought to you by:
apete
From: Anders P. <an...@op...> - 2015-11-06 11:29:22
|
Welcome to ojAlgo, I can’t think of a direct way to do that. You need to write a little utility like this: public static PrimitiveDenseStore getComplexModulus(final Access2D<ComplexNumber> arg) { final long tmpRows = arg.countRows(); final long tmpColumns = arg.countColumns(); final long tmpCount = tmpRows * tmpColumns; final PrimitiveDenseStore retVal = PrimitiveDenseStore.FACTORY.makeZero(tmpRows, tmpColumns); for (long i = 0; i < tmpCount; i++) { retVal.set(i, arg.get(i).getModulus()); } return retVal; } I’m thinking I should add methods like these to MatrixUtils. /Anders > On 6 nov. 2015, at 10:56, applyhhj <app...@16...> wrote: > > Hello, ojalgo community! > > I am new to ojalgo. Could any one tell me how to do the following operation? > > 1. How to get the modulus of a complex matrix? I mean calculate modulus of each element in a complex matrix and store it in a matrix of double type, not complex type. > > 2. Similarly how to get the angle of a matrix? > > Thank you very much! > > Regards! > hjh > > > 2015-11-06 > applyhhj > ------------------------------------------------------------------------------ > _______________________________________________ > ojAlgo-user mailing list > ojA...@li... > https://lists.sourceforge.net/lists/listinfo/ojalgo-user |