Skip to content
This repository has been archived by the owner on Dec 10, 2018. It is now read-only.

matrix: Interop between mat64 and cmat128 #308

Closed
btracey opened this issue Jan 22, 2016 · 8 comments
Closed

matrix: Interop between mat64 and cmat128 #308

btracey opened this issue Jan 22, 2016 · 8 comments
Milestone

Comments

@btracey
Copy link
Member

btracey commented Jan 22, 2016

Not sure what the right place for this is, so here we are.

I'm looking in to the redesign of Eigen. I don't understand how the API surface is supposed to look so that they can interoperate.

The other factorization methods have methods on the extraction type to get the bounds. LFromLU, for example, is a method on *Dense. For Eigen, we want something like

func (c *cmat128.Dense) Eigenvalues(mat64.Eigen){...}

However, we can't add methods to cmat128.Dense in mat64, and I think the plan was to not have cmat128 import mat64. We have the conv routines, but I don't see how they solve this problem.

@kortschak
Copy link
Member

For the Eigen values, it seems to me that the best way is to just use a []complex128. The Eigen vectors are the tricky bit.

@btracey
Copy link
Member Author

btracey commented Jan 22, 2016

Yes. Sorry, I meant Eigenvectors

@btracey
Copy link
Member Author

btracey commented Jan 22, 2016

This sort of interop should be determined though before stability. B = A^H * A is a mat64.SymDense; we'll want to pass matrices in both directions.

@kortschak
Copy link
Member

This sort of interop should be determined though before stability.

Absolutely. That's why #134 and #283 are in API stability.

@kortschak kortschak added this to the API stability milestone Jan 22, 2016
@btracey
Copy link
Member Author

btracey commented Jan 22, 2016

Understood.

@kortschak
Copy link
Member

B = A^H * A is a mat64.SymDense

I don't think that we can do this nor that we should. If we start with A being complex then the result of that operation is complex, though with the imaginary component being zero. It should be up to the user to either know this or test for it and be able to take the cmat128.Matrix result and extract the real part - this is what conv does.

type symShim struct {
    Matrix
}

func (s simShim) Symmetric() int {
    r, c := s.Dims()
    if r != c {
        panic(mat64.ErrShape)
    }
    return r
}

and then

var tmp cmat128.Dense
tmp.Mul(a.H(), a)
n, _ := tmp.Dims()
b := mat64.NewSymDense(n, nil)
b.CopySym(symShim{conv.NewReal(&tmp)})

@btracey btracey changed the title Interop between mat64 and cmat128 matrix: Interop between mat64 and cmat128 Mar 16, 2017
@btracey
Copy link
Member Author

btracey commented Mar 16, 2017

The plan is to merge cmat128 and mat64

@btracey
Copy link
Member Author

btracey commented Aug 4, 2017

This has been done.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants