Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch Current File",
"script": "${file}",
"args": [],
"cwd": "${file}"
},
{
"name": "NumSharp Example - Water equation",
"type": "coreclr",
Expand Down
10 changes: 10 additions & 0 deletions ExecuteBuild.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Write-Output "--------------------"
Write-Output "Start with building"
Write-Output "--------------------"

$projectFolders = @{};

$projectFolders['projectRoot'] = $PSScriptRoot;
$projectFolders['Projects.Core'] = Join-Path $projectFolders['projectRoot'] src/NumSharp.Core/NumSharp.Core.csproj

dotnet build $projectFolders['Projects.Core']
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System;
using System.Runtime.InteropServices;

namespace NumSharp.Core
namespace NumSharp.Core.LAPACKProvider
{
public static partial class LAPACK
public static partial class NetLib
{
[DllImport("lapack")]
public static extern void dgesv_(ref int n, ref int nrhs, double[] a, ref int lda, int[] ipiv, double[] b, ref int ldb, ref int info );
Expand Down
66 changes: 66 additions & 0 deletions src/NumSharp.Core/LinearAlgebra/LAPACK.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using System;
using System.Runtime.InteropServices;
using NumSharp.Core.LAPACKProvider;
using NumSharp.Core;

namespace NumSharp.Core
{
public static partial class LAPACK
{
public static void dgesv_(ref int n, ref int nrhs, double[] a, ref int lda, int[] ipiv, double[] b, ref int ldb, ref int info )
{
switch (np.LAPACKProvider)
{
case LAPACKProvider.LAPACKProvider.NetLib :
{
LAPACKProvider.NetLib.dgesv_(ref n, ref nrhs, a, ref lda, ipiv, b, ref ldb, ref info);
break;
}
}
}
public static void dgeqrf_(ref int m, ref int n, double[] a, ref int lda, double[] tau, double[] work, ref int lwork, ref int info)
{
switch (np.LAPACKProvider)
{
case LAPACKProvider.LAPACKProvider.NetLib :
{
LAPACKProvider.NetLib.dgeqrf_(ref m, ref n, a, ref lda, tau, work, ref lwork, ref info);
break;
}
}
}
public static void dorgqr_(ref int m,ref int n, ref int k, double[] a, ref int lda, double[] tau, double[]work, ref int lwork,ref int info)
{
switch (np.LAPACKProvider)
{
case LAPACKProvider.LAPACKProvider.NetLib :
{
LAPACKProvider.NetLib.dorgqr_(ref m, ref n,ref k, a, ref lda, tau, work, ref lwork, ref info);
break;
}
}
}
public static void dgelss_( ref int m, ref int n, ref int nrhs, double[] a,ref int lda, double[] b, ref int ldb, double[] s,ref double rcond, ref int rank, double[] work,ref int lwork, ref int info )
{
switch (np.LAPACKProvider)
{
case LAPACKProvider.LAPACKProvider.NetLib :
{
LAPACKProvider.NetLib.dgelss_(ref m, ref n, ref nrhs, a, ref lda, b, ref ldb, s, ref rcond, ref rank, work, ref lwork, ref info);
break;
}
}
}
public static void dgesvd_(char[] JOBU,char[] JOBVT, ref int M, ref int N, double[] A, ref int LDA, double[] S, double[] U, ref int LDU, double[] VT, ref int LDVT, double[] WORK, ref int LWORK, ref int INFO )
{
switch (np.LAPACKProvider)
{
case LAPACKProvider.LAPACKProvider.NetLib :
{
LAPACKProvider.NetLib.dgesvd_(JOBU, JOBVT, ref M, ref N, A, ref LDA, S, U, ref LDU, VT, ref LDVT, WORK, ref LWORK, ref INFO);
break;
}
}
}
}
}
18 changes: 18 additions & 0 deletions src/NumSharp.Core/LinearAlgebra/np.LAPACK.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace NumSharp.Core.LAPACKProvider
{
public enum LAPACKProvider
{
NetLib
}
}
namespace NumSharp.Core
{
public static partial class np
{
public static NumSharp.Core.LAPACKProvider.LAPACKProvider LAPACKProvider = NumSharp.Core.LAPACKProvider.LAPACKProvider.NetLib;
}
}
4 changes: 4 additions & 0 deletions src/NumSharp.Core/NDStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,10 @@ public void ChangeDataType(Type dtype)
_values = this._ChangeTypeOfArray(_values,dtype);
_DType = dtype;
}
public void SetNewShape(params int[] dimensions)
{
_Shape = new Shape(dimensions);
}
public void Reshape(params int[] dimensions)
{
if (_TensorLayout == 2)
Expand Down