# Composite eigenvectors with SLEPc

**URL:** <https://community.freefem.org/t/composite-eigenvectors-with-slepc/231>\
**Category:** General Discussion\
**Created:** [January 31, 2020, 9:28pm UTC](https://community.freefem.org/t/composite-eigenvectors-with-slepc/231 "2020-01-31T21:28:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [January 31, 2020, 9:28pm UTC](https://community.freefem.org/t/composite-eigenvectors-with-slepc/231/1 "2020-01-31T21:28:43Z")

</div>

Hi FF developers,

I am solving an eigenvalue problem for a composite system using SLEPc where the problem is defined on several different FE spaces. The matrices can be built straightforwardly using blocks. However, because the eigenvectors are defined on multiple FE spaces, I can’t build an array of FE functions with the correct dimension to pass to EPSsolve for the eigenvectors. How should I initialize the array for the eigenvectors in such a problem?

```
load "PETSc-complex"
load "SLEPc-complex" 
fespace Vh1(Th, P1), Vh2(Th, P1);
complex[int] val(0);
Vh1<complex>[int] def(vec1)(1); 
Vh2<complex>[int] def(vec2)(1);
complex[int][int] vec; // How do I initialize this properly?
// Obviously, "vec = [vec1, vec2];" does not work.
Mat<complex> A(Vh1.ndof + Vh2.ndof);
Mat<complex> B(Vh1.ndof + Vh2.ndof);
int k = EPSSolve(A, B, vectors = vec, values = val, sparams = sparams);

```

Thanks!

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [January 31, 2020, 9:35pm UTC](https://community.freefem.org/t/composite-eigenvectors-with-slepc/231/2 "2020-01-31T21:35:45Z")

</div>

Hi Chris 🙂  
The `vectors` parameter is for eigenvectors defined on a `fespace`. You are thus right it cannot be used in this case. You have to switch to the named parameter `array`, which, instead of a `Vh<complex>[int]`, will use as input a `complex[int, int]`, of dimension `(Vh1.ndof + Vh2.ndof, nev)`.

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [January 31, 2020, 9:48pm UTC](https://community.freefem.org/t/composite-eigenvectors-with-slepc/231/3 "2020-01-31T21:48:11Z")

</div>

Helpful as always! Thank you, @prj!
