Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-06-25 Thread Matthew Knepley
On Thu, Jun 25, 2020 at 11:10 AM Eda Oktay wrote: > Dear Richard, > > From now on, I am actually trying to write a parallel k-means > algorithm by using petsc routines (I don't have to use petsc but I > believe it will be easier) and I used the algorithm you mentioned > before about finding

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-06-25 Thread Eda Oktay
Dear Richard, >From now on, I am actually trying to write a parallel k-means algorithm by using petsc routines (I don't have to use petsc but I believe it will be easier) and I used the algorithm you mentioned before about finding cluster centroids. However, something is bothering me: You said

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-05-26 Thread Eda Oktay
Dear Richard, I believe I don't need centroids. I just need cluster indices which corresponds to idx. What I am trying to do is this: Step 6: Cluster the points (y_i) i=1,...,n in R^k with the k-means algorithm into clusters C_1,...,C_k. Output: Clusters A_1,,A_k with A_i = {j | y_j in C_i}

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-05-22 Thread Mills, Richard Tran via petsc-users
Hi Eda, If you are using the MATLAB k-means function, calling it like idx = kmeans(X,k) will give you the index set, but if you do [idx,C] = kmeans(X,k) then you will also get a matrix C which contains the cluster centroids. Is this not what you need? --Richard On 5/22/20 10:38 AM, Eda

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-05-22 Thread Eda Oktay
I am sorry, I used VecDuplictaeVecs not MatDuplicateVecs Eda Oktay , 22 May 2020 Cum, 20:31 tarihinde şunu yazdı: > Dear Richard, > > Thank you for your email. From MATLAB's kmeans() function I believe I got > the final clustering index set, not centroids. What I am trying to do is to > cluster

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-05-22 Thread Eda Oktay
Dear Richard, Thank you for your email. From MATLAB's kmeans() function I believe I got the final clustering index set, not centroids. What I am trying to do is to cluster vectors created by MatDuplicateVecs() according to the index set (whose type is not IS since I took it from MATLAB) that I

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-04-29 Thread Mills, Richard Tran via petsc-users
Hi Eda, Thanks for your reply. I'm still trying to understand why you say you need to duplicate the row vectors across all processes. When I have implemented parallel k-means, I don't duplicate the row vectors. (This would be very unscalable and largely defeat the point of doing this with MPI

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-04-29 Thread Junchao Zhang
Eda, You are trying to duplicate a group of MPI vectors to every process. Am I correct? --Junchao Zhang On Wed, Apr 29, 2020 at 5:48 AM Eda Oktay wrote: > Dear Richard, > > I am trying to use spectral clustering algorithm by using k-means > clustering algorithm at some point. I am doing this

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-04-29 Thread Eda Oktay
Dear Richard, I am trying to use spectral clustering algorithm by using k-means clustering algorithm at some point. I am doing this by producing a matrix consisting of eigenvectors (of the adjacency matrix of the graph that I want to partition), then forming row vectors of this matrix. This is

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-04-06 Thread Mills, Richard Tran via petsc-users
Hi Eda, I think that you probably want to use VecScatter routines, as Junchao has suggested, instead of the lower level star forest for this. I believe that VecScatterCreateToZero() is what you want for the broadcast problem you describe, in the second part of your question. I'm not sure what

Re: [petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-04-04 Thread Junchao Zhang
Check https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecScatterCreateToAll.html to see if it meets your needs. --Junchao Zhang On Sat, Apr 4, 2020 at 3:39 AM Eda Oktay wrote: > Hi all, > > I created a parallel vector UV, by using VecDuplicateVecs since I need row > vectors of

[petsc-users] Gather and Broadcast Parallel Vectors in k-means algorithm

2020-04-04 Thread Eda Oktay
Hi all, I created a parallel vector UV, by using VecDuplicateVecs since I need row vectors of a matrix. However, I need the whole vector be in all processors, which means I need to gather all and broadcast them to all processors. To gather, I tried to use VecStrideGatherAll: Vec UVG;