Exemplo n.º 1
0
        internal ConjugatedVectorDescriptor(VectorDescriptor descriptor)
        {
            Debug.Assert(descriptor != null);

            Size   = descriptor.Size;
            Stride = descriptor.Stride;
        }
Exemplo n.º 2
0
 private static void swap(
     VectorDescriptor xDescriptor, double *x,
     VectorDescriptor yDescriptor, double *y)
 {
     NativeMethods.cblas_dswap(
         xDescriptor.Size,
         x, xDescriptor.Stride,
         y, yDescriptor.Stride);
 }
Exemplo n.º 3
0
 private static void copy(
     VectorDescriptor xDescriptor, float *x,
     VectorDescriptor yDescriptor, float *y)
 {
     NativeMethods.cblas_scopy(
         xDescriptor.Size,
         x, xDescriptor.Stride,
         y, yDescriptor.Stride);
 }
Exemplo n.º 4
0
 private static void swap(
     VectorDescriptor xDescriptor, complexf *x,
     VectorDescriptor yDescriptor, complexf *y)
 {
     NativeMethods.cblas_cswap(
         xDescriptor.Size,
         x, xDescriptor.Stride,
         y, yDescriptor.Stride);
 }
Exemplo n.º 5
0
 private static void copy(
     VectorDescriptor xDescriptor, complex *x,
     VectorDescriptor yDescriptor, complex *y)
 {
     NativeMethods.cblas_zcopy(
         xDescriptor.Size,
         x, xDescriptor.Stride,
         y, yDescriptor.Stride);
 }
Exemplo n.º 6
0
 private static float dot(
     VectorDescriptor xDescriptor, float *x,
     VectorDescriptor yDescriptor, float *y)
 {
     return(NativeMethods.cblas_sdot(
                xDescriptor.Size,
                x, xDescriptor.Stride,
                y, yDescriptor.Stride));
 }
Exemplo n.º 7
0
 private static double dot(
     VectorDescriptor xDescriptor, double *x,
     VectorDescriptor yDescriptor, double *y)
 {
     return(NativeMethods.cblas_ddot(
                xDescriptor.Size,
                x, xDescriptor.Stride,
                y, yDescriptor.Stride));
 }
Exemplo n.º 8
0
 private static void axpy(
     double a,
     VectorDescriptor xDescriptor, double *x,
     VectorDescriptor yDescriptor, double *y)
 {
     NativeMethods.cblas_daxpy(
         xDescriptor.Size,
         a,
         x, xDescriptor.Stride,
         y, yDescriptor.Stride);
 }
Exemplo n.º 9
0
 private static void rot(
     VectorDescriptor xDescriptor, float *x,
     VectorDescriptor yDescriptor, float *y,
     float c, float s)
 {
     NativeMethods.cblas_srot(
         xDescriptor.Size,
         x, xDescriptor.Stride,
         y, yDescriptor.Stride,
         c, s);
 }
Exemplo n.º 10
0
 private static void axpy(
     complex a,
     VectorDescriptor xDescriptor, complex *x,
     VectorDescriptor yDescriptor, complex *y)
 {
     NativeMethods.cblas_zaxpy(
         xDescriptor.Size,
         &a,
         x, xDescriptor.Stride,
         y, yDescriptor.Stride);
 }
Exemplo n.º 11
0
 private static void rot(
     VectorDescriptor xDescriptor, complex *x,
     VectorDescriptor yDescriptor, complex *y,
     double c, double s)
 {
     NativeMethods.cblas_zdrot(
         xDescriptor.Size,
         x, xDescriptor.Stride,
         y, yDescriptor.Stride,
         c, s);
 }
Exemplo n.º 12
0
        private static complex dotc(
            ConjugatedVectorDescriptor xDescriptor, complex *x,
            VectorDescriptor yDescriptor, complex *y)
        {
            complex result;

            NativeMethods.cblas_zdotc_sub(
                xDescriptor.Size,
                x, xDescriptor.Stride,
                y, yDescriptor.Stride,
                &result);
            return(result);
        }
Exemplo n.º 13
0
        private static complexf dotu(
            VectorDescriptor xDescriptor, complexf *x,
            VectorDescriptor yDescriptor, complexf *y)
        {
            complexf result;

            NativeMethods.cblas_cdotu_sub(
                xDescriptor.Size,
                x, xDescriptor.Stride,
                y, yDescriptor.Stride,
                &result);
            return(result);
        }
Exemplo n.º 14
0
        internal Vector(VectorDescriptor descriptor, T[] storage, int offset)
        {
            Requires.NotNull(descriptor, nameof(descriptor));
            Requires.NotNull(storage, nameof(storage));
            Requires.NonNegative(offset, nameof(offset));
            if (storage.Length <= offset + (descriptor.Size - 1) * descriptor.Stride)
            {
                throw new ArgumentException(Strings.InsufficientStorageLength);
            }

            Descriptor = descriptor;
            Storage    = storage;
            Offset     = offset;
        }
Exemplo n.º 15
0
        public static double SDot(
            VectorDescriptor xDescriptor, float *x,
            VectorDescriptor yDescriptor, float *y)
        {
            Requires.NotNull(xDescriptor, nameof(xDescriptor));
            Requires.NotNullPtr(x, nameof(x));
            Requires.NotNull(yDescriptor, nameof(yDescriptor));
            Requires.NotNullPtr(y, nameof(y));
            if (xDescriptor.Size != yDescriptor.Size)
            {
                throw new ArgumentException(Strings.VectorSizesAreNotEqual);
            }

            return(sdot(xDescriptor, x, yDescriptor, y));
        }
Exemplo n.º 16
0
        private static void rotm(
            VectorDescriptor xDescriptor, float *x,
            VectorDescriptor yDescriptor, float *y,
            float h11, float h12, float h21, float h22)
        {
            var h = stackalloc float[5];

            h[1] = h11;
            h[2] = h21;
            h[3] = h12;
            h[4] = h22;
            if (h11 == 1 && h22 == 1)
            {
                if (h12 == 0 && h21 == 0)
                {
                    h[0] = -2;
                }
                else
                {
                    h[0] = 0;
                }
            }
            else if (h12 == 1 && h21 == -1)
            {
                h[0] = 1;
            }
            else
            {
                h[0] = -1;
            }

            NativeMethods.cblas_srotm(
                xDescriptor.Size,
                x, xDescriptor.Stride,
                y, yDescriptor.Stride,
                h);
        }
Exemplo n.º 17
0
 private static void scal(complexf a, VectorDescriptor descriptor, complexf *x)
 {
     NativeMethods.cblas_cscal(descriptor.Size, &a, x, descriptor.Stride);
 }
Exemplo n.º 18
0
 private static float nrm2(VectorDescriptor descriptor, float *x)
 {
     return(NativeMethods.cblas_snrm2(descriptor.Size, x, descriptor.Stride));
 }
Exemplo n.º 19
0
 private static double nrm2(VectorDescriptor descriptor, complex *x)
 {
     return(NativeMethods.cblas_dznrm2(descriptor.Size, x, descriptor.Stride));
 }
Exemplo n.º 20
0
 private static int iamin(VectorDescriptor descriptor, float *x)
 {
     return((int)NativeMethods.cblas_isamin(descriptor.Size, x, descriptor.Stride));
 }
Exemplo n.º 21
0
 private static double asum(VectorDescriptor descriptor, double *x)
 {
     return(NativeMethods.cblas_dasum(descriptor.Size, x, descriptor.Stride));
 }
Exemplo n.º 22
0
 private static float asum(VectorDescriptor descriptor, complexf *x)
 {
     return(NativeMethods.cblas_scasum(descriptor.Size, x, descriptor.Stride));
 }
Exemplo n.º 23
0
 private static int iamax(VectorDescriptor descriptor, complex *x)
 {
     return((int)NativeMethods.cblas_izamax(descriptor.Size, x, descriptor.Stride));
 }
Exemplo n.º 24
0
 private static void scal(double a, VectorDescriptor descriptor, complex *x)
 {
     NativeMethods.cblas_zdscal(descriptor.Size, a, x, descriptor.Stride);
 }
Exemplo n.º 25
0
 private static void scal(float a, VectorDescriptor descriptor, float *x)
 {
     NativeMethods.cblas_sscal(descriptor.Size, a, x, descriptor.Stride);
 }