Skip to content

Commit 6b0fb46

Browse files
committed
Remove methods marked as obsolete from Converter class.
1 parent e2570fb commit 6b0fb46

File tree

2 files changed

+16
-90
lines changed

2 files changed

+16
-90
lines changed

CSparse/Converter.cs

Lines changed: 3 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,16 @@ namespace CSparse
77
/// <summary>
88
/// Converter for different types of storages.
99
/// </summary>
10-
public static class Converter
10+
internal static class Converter
1111
{
12-
/// <summary>
13-
/// Convert a coordinate storage to compressed sparse column (CSC) format.
14-
/// </summary>
15-
/// <param name="storage">Coordinate storage.</param>
16-
/// <param name="cleanup">Remove and sum duplicate entries.</param>
17-
/// <returns>Compressed sparse column storage.</returns>
18-
[Obsolete("Will be removed in future versions. Use SparseMatrix.OfIndexed(...) instead.")]
19-
public static CompressedColumnStorage<T> ToCompressedColumnStorage<T>(CoordinateStorage<T> storage,
20-
bool cleanup = true) where T : struct, IEquatable<T>, IFormattable
21-
{
22-
return ToCompressedColumnStorage_(storage, cleanup);
23-
}
24-
2512
/// <summary>
2613
/// Convert a coordinate storage to compressed sparse column (CSC) format.
2714
/// </summary>
2815
/// <param name="storage">Coordinate storage.</param>
2916
/// <param name="cleanup">Remove and sum duplicate entries.</param>
3017
/// <param name="inplace">Do the conversion in place (re-using the coordinate storage arrays).</param>
3118
/// <returns>Compressed sparse column storage.</returns>
32-
internal static CompressedColumnStorage<T> ToCompressedColumnStorage_<T>(CoordinateStorage<T> storage,
19+
public static CompressedColumnStorage<T> ToCompressedColumnStorage<T>(CoordinateStorage<T> storage,
3320
bool cleanup = true, bool inplace = false) where T : struct, IEquatable<T>, IFormattable
3421
{
3522
int nrows = storage.RowCount;
@@ -110,7 +97,7 @@ internal static CompressedColumnStorage<T> ToCompressedColumnStorage_<T>(Coordin
11097
/// <remarks>
11198
/// On return, the coordinate storage input arrays contain the compressed sparse
11299
/// column data structure for the resulting matrix. The <paramref name="work"/>
113-
/// array contains a copy of the column pointer.
100+
/// array contains a copy of the column pointers.
114101
///
115102
/// The entries of the output matrix are not sorted (the row indices in each
116103
/// column are not in increasing order).
@@ -193,15 +180,8 @@ private static void ConvertInPlace<T>(int columns, int nz, T[] values, int[] row
193180
/// </summary>
194181
/// <param name="array">2D array storage.</param>
195182
/// <returns>Coordinate storage.</returns>
196-
[Obsolete("Will be removed in future versions. Use SparseMatrix.OfArray(...) instead.")]
197183
public static CoordinateStorage<T> FromDenseArray<T>(T[,] array)
198184
where T : struct, IEquatable<T>, IFormattable
199-
{
200-
return FromDenseArray_(array);
201-
}
202-
203-
internal static CoordinateStorage<T> FromDenseArray_<T>(T[,] array)
204-
where T : struct, IEquatable<T>, IFormattable
205185
{
206186
int rowCount = array.GetLength(0);
207187
int columnCount = array.GetLength(1);
@@ -219,48 +199,15 @@ internal static CoordinateStorage<T> FromDenseArray_<T>(T[,] array)
219199
return storage;
220200
}
221201

222-
/// <summary>
223-
/// Convert a jagged array to compressed sparse column (CSC) format.
224-
/// </summary>
225-
/// <param name="array">Jagged array storage.</param>
226-
/// <returns>Compressed sparse column storage.</returns>
227-
[Obsolete("Will be removed in future versions. Use SparseMatrix.OfJaggedArray(...) instead.")]
228-
public static CompressedColumnStorage<T> ToCompressedColumnStorage<T>(T[][] array)
229-
where T : struct, IEquatable<T>, IFormattable
230-
{
231-
int nrows = array.Length;
232-
int ncols = array[0].Length;
233-
234-
var storage = new CoordinateStorage<T>(nrows, ncols, nrows);
235-
236-
for (int i = 0; i < nrows; i++)
237-
{
238-
for (int j = 0; j < ncols; j++)
239-
{
240-
storage.At(i, j, array[i][j]);
241-
}
242-
}
243-
244-
return ToCompressedColumnStorage_<T>(storage, false);
245-
}
246-
247-
248202
/// <summary>
249203
/// Convert a column major array to coordinate storage.
250204
/// </summary>
251205
/// <param name="array">Column major array storage.</param>
252206
/// <param name="rowCount">Number of rows.</param>
253207
/// <param name="columnCount">Number of columns.</param>
254208
/// <returns>Coordinate storage.</returns>
255-
[Obsolete("Will be removed in future versions. Use SparseMatrix.OfColumnMajor(...) instead.")]
256209
public static CoordinateStorage<T> FromColumnMajorArray<T>(T[] array, int rowCount, int columnCount)
257210
where T : struct, IEquatable<T>, IFormattable
258-
{
259-
return FromColumnMajorArray_(array, rowCount, columnCount);
260-
}
261-
262-
internal static CoordinateStorage<T> FromColumnMajorArray_<T>(T[] array, int rowCount, int columnCount)
263-
where T : struct, IEquatable<T>, IFormattable
264211
{
265212
var storage = new CoordinateStorage<T>(rowCount, columnCount, Math.Max(rowCount, columnCount));
266213

@@ -281,15 +228,8 @@ internal static CoordinateStorage<T> FromColumnMajorArray_<T>(T[] array, int row
281228
/// <param name="array">jagged array storage.</param>
282229
/// <returns>Coordinate storage.</returns>
283230
/// <remarks>All rows of the array are assumed to be equal in length</remarks>
284-
[Obsolete("Will be removed in future versions. Use SparseMatrix.OfColumnMajor(...) instead.")]
285231
public static CoordinateStorage<T> FromJaggedArray<T>(T[][] array)
286232
where T : struct, IEquatable<T>, IFormattable
287-
{
288-
return FromJaggedArray_(array);
289-
}
290-
291-
internal static CoordinateStorage<T> FromJaggedArray_<T>(T[][] array)
292-
where T : struct, IEquatable<T>, IFormattable
293233
{
294234
int rowCount = array.Length;
295235
int columnCount = array[0].Length;
@@ -314,15 +254,8 @@ internal static CoordinateStorage<T> FromJaggedArray_<T>(T[][] array)
314254
/// <param name="rowCount">Number of rows.</param>
315255
/// <param name="columnCount">Number of columns.</param>
316256
/// <returns>Coordinate storage.</returns>
317-
[Obsolete("Will be removed in future versions. Use SparseMatrix.OfRowMajor(...) instead.")]
318257
public static CoordinateStorage<T> FromRowMajorArray<T>(T[] array, int rowCount, int columnCount)
319258
where T : struct, IEquatable<T>, IFormattable
320-
{
321-
return FromRowMajorArray_(array, rowCount, columnCount);
322-
}
323-
324-
internal static CoordinateStorage<T> FromRowMajorArray_<T>(T[] array, int rowCount, int columnCount)
325-
where T : struct, IEquatable<T>, IFormattable
326259
{
327260
var storage = new CoordinateStorage<T>(rowCount, columnCount, Math.Max(rowCount, columnCount));
328261

@@ -344,15 +277,8 @@ internal static CoordinateStorage<T> FromRowMajorArray_<T>(T[] array, int rowCou
344277
/// <param name="rowCount">Number of rows.</param>
345278
/// <param name="columnCount">Number of columns.</param>
346279
/// <returns>Coordinate storage.</returns>
347-
[Obsolete("Will be removed in future versions. Use SparseMatrix.OfIndexed(...) instead.")]
348280
public static CoordinateStorage<T> FromEnumerable<T>(IEnumerable<Tuple<int, int, T>> enumerable, int rowCount, int columnCount)
349281
where T : struct, IEquatable<T>, IFormattable
350-
{
351-
return FromEnumerable_(enumerable, rowCount, columnCount);
352-
}
353-
354-
internal static CoordinateStorage<T> FromEnumerable_<T>(IEnumerable<Tuple<int, int, T>> enumerable, int rowCount, int columnCount)
355-
where T : struct, IEquatable<T>, IFormattable
356282
{
357283
var storage = new CoordinateStorage<T>(rowCount, columnCount, Math.Max(rowCount, columnCount));
358284

CSparse/Storage/CompressedColumnStorage.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,67 +110,67 @@ public CompressedColumnStorage(int rowCount, int columnCount, T[] values, int[]
110110
/// </summary>
111111
public static CompressedColumnStorage<T> OfMatrix(Matrix<T> matrix)
112112
{
113-
var c = Converter.FromEnumerable_<T>(matrix.EnumerateIndexed(), matrix.RowCount, matrix.ColumnCount);
113+
var c = Converter.FromEnumerable<T>(matrix.EnumerateIndexed(), matrix.RowCount, matrix.ColumnCount);
114114

115-
return Converter.ToCompressedColumnStorage_(c);
115+
return Converter.ToCompressedColumnStorage(c);
116116
}
117117

118118
/// <summary>
119119
/// Create a new sparse matrix as a copy of the given two-dimensional array.
120120
/// </summary>
121121
public static CompressedColumnStorage<T> OfArray(T[,] array)
122122
{
123-
var c = Converter.FromDenseArray_(array);
123+
var c = Converter.FromDenseArray(array);
124124

125-
return Converter.ToCompressedColumnStorage_(c);
125+
return Converter.ToCompressedColumnStorage(c);
126126
}
127127

128128
/// <summary>
129129
/// Create a new sparse matrix as a copy of the given two-dimensional array.
130130
/// </summary>
131131
public static CompressedColumnStorage<T> OfJaggedArray(T[][] array)
132132
{
133-
var c = Converter.FromJaggedArray_(array);
133+
var c = Converter.FromJaggedArray(array);
134134

135-
return Converter.ToCompressedColumnStorage_(c);
135+
return Converter.ToCompressedColumnStorage(c);
136136
}
137137

138138
/// <summary>
139139
/// Create a new sparse matrix as a copy of the given coordinate storage.
140140
/// </summary>
141141
public static CompressedColumnStorage<T> OfIndexed(CoordinateStorage<T> coordinateStorage, bool inplace = false)
142142
{
143-
return Converter.ToCompressedColumnStorage_(coordinateStorage, true, inplace);
143+
return Converter.ToCompressedColumnStorage(coordinateStorage, true, inplace);
144144
}
145145

146146
/// <summary>
147147
/// Create a new sparse matrix as a copy of the given indexed enumerable.
148148
/// </summary>
149149
public static CompressedColumnStorage<T> OfIndexed(int rows, int columns, IEnumerable<Tuple<int, int, T>> enumerable)
150150
{
151-
var c = Converter.FromEnumerable_<T>(enumerable, rows, columns);
151+
var c = Converter.FromEnumerable<T>(enumerable, rows, columns);
152152

153-
return Converter.ToCompressedColumnStorage_(c);
153+
return Converter.ToCompressedColumnStorage(c);
154154
}
155155

156156
/// <summary>
157157
/// Create a new sparse matrix as a copy of the given array (row-major).
158158
/// </summary>
159159
public static CompressedColumnStorage<T> OfRowMajor(int rows, int columns, T[] rowMajor)
160160
{
161-
var c = Converter.FromRowMajorArray_<T>(rowMajor, rows, columns);
161+
var c = Converter.FromRowMajorArray<T>(rowMajor, rows, columns);
162162

163-
return Converter.ToCompressedColumnStorage_(c);
163+
return Converter.ToCompressedColumnStorage(c);
164164
}
165165

166166
/// <summary>
167167
/// Create a new sparse matrix as a copy of the given array (column-major).
168168
/// </summary>
169169
public static CompressedColumnStorage<T> OfColumnMajor(int rows, int columns, T[] columnMajor)
170170
{
171-
var c = Converter.FromColumnMajorArray_<T>(columnMajor, rows, columns);
171+
var c = Converter.FromColumnMajorArray<T>(columnMajor, rows, columns);
172172

173-
return Converter.ToCompressedColumnStorage_(c);
173+
return Converter.ToCompressedColumnStorage(c);
174174
}
175175

176176
/// <summary>

0 commit comments

Comments
 (0)