Browse Source

LinearAlgebra: Complex primitives DataContract to support ephemeral serialization

pull/362/head
Christoph Ruegg 11 years ago
parent
commit
3b3346e130
  1. 15
      src/Numerics/Complex32.cs
  2. 16
      src/Numerics/Complex64.cs

15
src/Numerics/Complex32.cs

@ -28,17 +28,17 @@
// OTHER DEALINGS IN THE SOFTWARE.
// </copyright>
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace MathNet.Numerics
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
#if !PORTABLE
using System.Runtime;
#endif
#if !NOSYSNUMERICS
using Complex = System.Numerics.Complex;
using BigInteger = System.Numerics.BigInteger;
@ -72,16 +72,19 @@ namespace MathNet.Numerics
/// </remarks>
[Serializable]
[StructLayout(LayoutKind.Sequential)]
[DataContract(Namespace = "urn:MathNet/Numerics")]
public struct Complex32 : IFormattable, IEquatable<Complex32>
{
/// <summary>
/// The real component of the complex number.
/// </summary>
[DataMember(Order = 1)]
private readonly float _real;
/// <summary>
/// The imaginary component of the complex number.
/// </summary>
[DataMember(Order = 2)]
private readonly float _imag;
/// <summary>

16
src/Numerics/Complex64.cs

@ -29,14 +29,15 @@
// </copyright>
#if NOSYSNUMERICS
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Text;
namespace MathNet.Numerics
{
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using Properties;
/// <summary>
/// 64-bit double precision complex numbers class.
/// </summary>
@ -64,17 +65,20 @@ namespace MathNet.Numerics
/// </para>
/// </remarks>
[Serializable]
[DataContract(Namespace = "urn:MathNet/Numerics")]
[StructLayout(LayoutKind.Sequential)]
public struct Complex : IFormattable, IEquatable<Complex>, IPrecisionSupport<Complex>
{
/// <summary>
/// The real component of the complex number.
/// </summary>
[DataMember(Order = 1)]
private readonly double _real;
/// <summary>
/// The imaginary component of the complex number.
/// </summary>
[DataMember(Order = 2)]
private readonly double _imag;
/// <summary>

Loading…
Cancel
Save