Example #1
0
 public static extern nvgraphStatus nvgraphSrSpmv(nvgraphContext handle,
                                                  nvgraphGraphDescr descrG,
                                                  SizeT weight_index,
                                                  IntPtr alpha,
                                                  SizeT x_index,
                                                  IntPtr beta,
                                                  SizeT y_index,
                                                  nvgraphSemiring SR);
 public static extern nvgraphStatus nvgraphSrSpmv(nvgraphContext handle,
                          nvgraphGraphDescr descrG,
                          SizeT weight_index,
                          IntPtr alpha,
                          SizeT x_index,
                          IntPtr beta,
                          SizeT y_index,
                          nvgraphSemiring SR);
Example #3
0
        public void SrSpmv(SizeT weight_index, Array alpha, SizeT x_index, Array beta, SizeT y_index, nvgraphSemiring SR)
        {
            GCHandle alphaHandle = GCHandle.Alloc(alpha, GCHandleType.Pinned);
            GCHandle betaHandle  = GCHandle.Alloc(beta, GCHandleType.Pinned);

            try
            {
                res = NVGraphNativeMathods.nvgraphSrSpmv(_context, _descr, weight_index, alphaHandle.AddrOfPinnedObject(), x_index, betaHandle.AddrOfPinnedObject(), y_index, SR);
                Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "nvgraphSrSpmv", res));
                if (res != nvgraphStatus.Success)
                {
                    throw new NVGraphException(res);
                }
            }
            finally
            {
                alphaHandle.Free();
                betaHandle.Free();
            }
        }