Skip to content

Commit 3bced30

Browse files
release300.2.3
1 parent a204d5a commit 3bced30

26 files changed

+53220
-628
lines changed

src/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
3333
//通过使用 "*",如下所示:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("3.00.2.2")]
36-
[assembly: AssemblyFileVersion("3.00.2.2")]
35+
[assembly: AssemblyVersion("3.00.2.3")]
36+
[assembly: AssemblyFileVersion("3.00.2.3")]

src/data/AbstractVector.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ public static void checkCompressedMethod(DATA_TYPE type, int method){
191191

192192
case DATA_TYPE.DT_INT128:
193193
case DATA_TYPE.DT_COMPLEX:
194+
case DATA_TYPE.DT_POINT:
194195
case DATA_TYPE.DT_UUID:
195196
case DATA_TYPE.DT_IPADDR:
196197
case DATA_TYPE.DT_FLOAT:
@@ -262,6 +263,7 @@ public static int getUnitLength(DATA_TYPE type)
262263
break;
263264
case DATA_TYPE.DT_INT128:
264265
case DATA_TYPE.DT_COMPLEX:
266+
case DATA_TYPE.DT_POINT:
265267
case DATA_TYPE.DT_UUID:
266268
case DATA_TYPE.DT_IPADDR:
267269
case DATA_TYPE.DT_DECIMAL128:

src/data/BasicComplexVector.cs

Lines changed: 6 additions & 231 deletions
Original file line numberDiff line numberDiff line change
@@ -4,81 +4,15 @@
44
using System.Collections.Generic;
55
using System;
66

7-
public class BasicComplexVector : AbstractVector
7+
public class BasicComplexVector : BasicDouble2Vector
88
{
9+
public BasicComplexVector(int size) : this(DATA_FORM.DF_VECTOR, size) { }
10+
public BasicComplexVector(List<Double2> list) : base(list) { }
911

10-
protected List<Double2> values;
12+
public BasicComplexVector(Double2[] array) : base(array) { }
13+
internal BasicComplexVector(DATA_FORM df, int size) : base(df, size) { }
1114

12-
public BasicComplexVector(int size) : this(DATA_FORM.DF_VECTOR, size)
13-
{
14-
}
15-
16-
public BasicComplexVector(List<Double2> list) : base(DATA_FORM.DF_VECTOR)
17-
{
18-
if (list != null)
19-
{
20-
values = new List<Double2>();
21-
values.AddRange(new Double2[list.Count]);
22-
for (int i = 0; i < list.Count; ++i)
23-
values[i] = list[i];
24-
}
25-
}
26-
27-
public BasicComplexVector(Double2[] array) : base(DATA_FORM.DF_VECTOR)
28-
{
29-
values = new List<Double2>();
30-
values.AddRange(array);
31-
}
32-
33-
internal BasicComplexVector(DATA_FORM df, int size) : base(df)
34-
{
35-
36-
values = new List<Double2>();
37-
values.AddRange(new Double2[size]);
38-
for (int i = 0; i < size; ++i)
39-
values[i] = new Double2(-double.MaxValue, -double.MaxValue);
40-
}
41-
42-
internal BasicComplexVector(DATA_FORM df, ExtendedDataInput @in) : base(df)
43-
{
44-
int rows = @in.readInt();
45-
int cols = @in.readInt();
46-
int size = rows * cols;
47-
values = new List<Double2>();
48-
values.AddRange(new Double2[size]);
49-
int totalBytes = size * 16, off = 0;
50-
bool littleEndian = @in.isLittleEndian();
51-
byte[] buffer = buf.Value;
52-
while (off < totalBytes)
53-
{
54-
int len = System.Math.Min(BUF_SIZE, totalBytes - off);
55-
@in.readFully(buffer, 0, len);
56-
int start = off / 16, end = len / 16;
57-
Byte[] dst = new Byte[len];
58-
Buffer.BlockCopy(buffer, 0, dst, 0, len);
59-
if (!littleEndian)
60-
Array.Reverse(dst);
61-
if (littleEndian)
62-
{
63-
for (int i = 0; i < end; i++)
64-
{
65-
double real = BitConverter.ToDouble(dst, i * 16);
66-
double image = BitConverter.ToDouble(dst, i * 16 + 8);
67-
values[i + start] = new Double2(real, image);
68-
}
69-
}
70-
else
71-
{
72-
for (int i = 0; i < end; i++)
73-
{
74-
double image = BitConverter.ToDouble(dst, i * 16);
75-
double real = BitConverter.ToDouble(dst, i * 16 + 8);
76-
values[i + start] = new Double2(real, image);
77-
}
78-
}
79-
off += len;
80-
}
81-
}
15+
internal BasicComplexVector(DATA_FORM df, ExtendedDataInput @in) : base(df, @in) { }
8216

8317
public override IScalar get(int index)
8418
{
@@ -100,29 +34,6 @@ public void setComplex(int index, double real, double image)
10034
values[index] = new Double2(real, image);
10135
}
10236

103-
public Double2 getDouble2(int index)
104-
{
105-
return values[index];
106-
}
107-
108-
public override bool isNull(int index)
109-
{
110-
return values[index].isNull();
111-
}
112-
113-
114-
public override void setNull(int index)
115-
{
116-
values[index] = new Double2(-double.MaxValue, -double.MaxValue);
117-
}
118-
119-
120-
public override DATA_CATEGORY getDataCategory()
121-
{
122-
return DATA_CATEGORY.BINARY;
123-
}
124-
125-
12637
public override DATA_TYPE getDataType()
12738
{
12839
return DATA_TYPE.DT_COMPLEX;
@@ -134,38 +45,6 @@ public override Type getElementClass()
13445
return typeof(BasicComplex);
13546
}
13647

137-
138-
public override int rows()
139-
{
140-
return values.Count;
141-
}
142-
143-
protected internal override void writeVectorToOutputStream(ExtendedDataOutput @out)
144-
{
145-
@out.writeDouble2Array(values.ToArray());
146-
}
147-
148-
public override void set(int index, string value)
149-
{
150-
throw new NotImplementedException();
151-
}
152-
153-
public override void add(object value)
154-
{
155-
throw new NotImplementedException();
156-
}
157-
158-
public override void addRange(object list)
159-
{
160-
throw new NotImplementedException();
161-
}
162-
163-
public override int hashBucket(int index, int buckets)
164-
{
165-
return values[index].hashBucket(buckets);
166-
}
167-
168-
16948
public override IVector getSubVector(int[] indices)
17049
{
17150
int length = indices.Length;
@@ -175,100 +54,6 @@ public override IVector getSubVector(int[] indices)
17554
return new BasicComplexVector(sub);
17655
}
17756

178-
protected Double2[] getSubArray(int[] indices)
179-
{
180-
int length = indices.Length;
181-
Double2[] sub = new Double2[length];
182-
for (int i = 0; i < length; ++i)
183-
sub[i] = values[indices[i]];
184-
return sub;
185-
}
186-
187-
public override int asof(IScalar value)
188-
{
189-
throw new Exception("BasicComplexVector.asof not supported.");
190-
}
191-
192-
public override void deserialize(int start, int count, ExtendedDataInput @in)
193-
{
194-
if (start + count > values.Count)
195-
{
196-
values.AddRange(new Double2[start + count - values.Count]);
197-
}
198-
int totalBytes = count * 16, off = 0;
199-
bool littleEndian = @in.isLittleEndian();
200-
byte[] buffer = buf.Value;
201-
while (off < totalBytes)
202-
{
203-
int len = System.Math.Min(BUF_SIZE, totalBytes - off);
204-
@in.readFully(buffer, 0, len);
205-
int subStart = off / 16, end = len / 16;
206-
Byte[] dst = new Byte[len];
207-
Buffer.BlockCopy(buffer, 0, dst, 0, len);
208-
if (!littleEndian)
209-
Array.Reverse(dst);
210-
if (littleEndian)
211-
{
212-
for (int i = 0; i < end; i++)
213-
{
214-
double real = BitConverter.ToDouble(dst, i * 16);
215-
double image = BitConverter.ToDouble(dst, i * 16 + 8);
216-
values[i + subStart + start] = new Double2(real, image);
217-
}
218-
}
219-
else
220-
{
221-
for (int i = 0; i < end; i++)
222-
{
223-
double image = BitConverter.ToDouble(dst, i * 16);
224-
double real = BitConverter.ToDouble(dst, i * 16 + 8);
225-
values[i + subStart + start] = new Double2(real, image);
226-
}
227-
}
228-
off += len;
229-
}
230-
}
231-
232-
public override void serialize(int start, int count, ExtendedDataOutput @out)
233-
{
234-
Double2[] buffer = new Double2[count];
235-
for (int i = 0; i < count; ++i)
236-
{
237-
buffer[i] = values[i + start];
238-
}
239-
@out.writeDouble2Array(buffer);
240-
}
241-
242-
243-
public override int getUnitLength()
244-
{
245-
return 16;
246-
}
247-
248-
public override int serialize(int indexStart, int offect, int targetNumElement, out int numElement, out int partial, ByteBuffer @out)
249-
{
250-
targetNumElement = Math.Min((@out.remain() / getUnitLength()), targetNumElement);
251-
if (@out.isLittleEndian)
252-
{
253-
for (int i = 0; i < targetNumElement; ++i)
254-
{
255-
@out.WriteDouble(values[indexStart + i].x);
256-
@out.WriteDouble(values[indexStart + i].y);
257-
}
258-
}
259-
else
260-
{
261-
for (int i = 0; i < targetNumElement; ++i)
262-
{
263-
@out.WriteDouble(values[indexStart + i].y);
264-
@out.WriteDouble(values[indexStart + i].x);
265-
}
266-
}
267-
numElement = targetNumElement;
268-
partial = 0;
269-
return targetNumElement * 16;
270-
}
271-
27257
public override void append(IScalar value)
27358
{
27459
values.Add(((BasicComplex)value).getValue());
@@ -278,14 +63,4 @@ public override void append(IVector value)
27863
{
27964
values.AddRange(((BasicComplexVector)value).getDataArray());
28065
}
281-
282-
public List<Double2> getDataArray()
283-
{
284-
return values;
285-
}
286-
287-
public override IEntity getEntity(int index)
288-
{
289-
return get(index);
290-
}
29166
}

0 commit comments

Comments
 (0)