/// <summary> /// convert sequential index into subscript indices /// </summary> /// <param name="A">input array</param> /// <param name="seqindex">sequential index</param> /// <returns>subscript indices</returns> /// <remarks><para>the length of the value returned will be the number of dimensions of A</para> /// <para>if A is null or empty array, the return value will be of length 0</para> /// </remarks> /// <exception cref="System.IndexOutOfRangeException">if seqindex is < 0 or > numel(A)</exception> public static int[] ind2sub(ILArray<complex> A, int seqindex) { if (object.Equals(A,null) || A.IsEmpty) return new int[0]; int [] ret = new int[A.Dimensions.NumberOfDimensions]; A.GetValueSeq(seqindex,ref ret); return ret; }
/// <summary> /// convert sequential index into subscript indices /// </summary> /// <param name="A">input array</param> /// <param name="seqindex">sequential index</param> /// <returns>subscript indices</returns> /// <remarks><para>the length of the value returned will be the number of dimensions of A</para> /// <para>if A is null or empty array, the return value will be of length 0</para> /// </remarks> /// <exception cref="System.IndexOutOfRangeException">if seqindex is < 0 or > numel(A)</exception> public static int[] ind2sub(ILArray <complex> A, int seqindex) { if (object.Equals(A, null) || A.IsEmpty) { return(new int[0]); } int [] ret = new int[A.Dimensions.NumberOfDimensions]; A.GetValueSeq(seqindex, ref ret); return(ret); }