FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
NumSharp/GenerateCode.ps1 at master · weikety/NumSharp · GitHub
weikety
/
NumSharp
Public
forked from
SciSharp/NumSharp
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
NumSharp
/
GenerateCode.ps1
Copy path
More file actions
More file actions
Latest commit
History
History
History
84 lines (64 loc) · 3.4 KB
Breadcrumbs
NumSharp
/
GenerateCode.ps1
Copy path
File metadata and controls
84 lines (64 loc) · 3.4 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#
first check if T4 engine is installed
if
(
-not
(
Get-Command
t4
-
errorAction SilentlyContinue))
{
Write-Host
"
T4 tool was not found - will be installed.
"
dotnet tool install
-
g dotnet
-
t4
Write-Host
"
T4 has been installed.
"
}
else
{
Write-Host
"
T4 tool is already installed.
"
}
Write-Host
(
"
location of T4 tool is :
"
+
(
Get-Command
t4).Path);
Write-Host
"
----------------------------------------------------
"
Write-Host
"
----------------------------------------------------
"
Write-Host
(
"
Test T4 before using it.
"
);
#
set variables
$projectFolders
=
@
{};
$projectFolders
[
'
projectRoot
'
]
=
$PSScriptRoot
;
$projectFolders
[
'
tmp
'
]
=
$projectFolders
[
'
projectRoot
'
]
+
'
/tmp_
'
+
[
System.Guid
]::NewGuid();
$projectFolders
[
'
tt.elementwise
'
]
=
$projectFolders
[
'
projectRoot
'
]
+
"
/src/NumSharp.Core/Operations/NdArray.ElementsWise.tt
"
;
Write-Host
(
"
new tmp folder at
"
+
$projectFolders
[
"
tmp
"
])
$projectFolders
[
'
tmp.tt
'
]
=
$projectFolders
[
'
tmp
'
]
+
'
/test.tt
'
;
$projectFolders
[
'
tmp.html
'
]
=
$projectFolders
[
'
tmp
'
]
+
'
/date.html
'
;
New-Item
-
ItemType Directory
-
Path
$projectFolders
[
'
tmp
'
];
'
<html><body>
'
>
$projectFolders
[
'
tmp.tt
'
];
'
The date and time now is: <#= DateTime.Now #>
'
>>
$projectFolders
[
'
tmp.tt
'
];
'
</body></html>
'
>>
$projectFolders
[
'
tmp.tt
'
];
Write-Host
"
"
;
Write-Host
(
"
folder
"
+
$projectFolders
[
"
tmp
"
]
+
"
was created.
"
);
Write-Host
"
"
;
t4
-
o
$projectFolders
[
'
tmp.html
'
]
$projectFolders
[
'
tmp.tt
'
]
if
(
Test-Path
-
Path (
$projectFolders
[
'
tmp.html
'
]))
{
Write-Host
"
html doc exist - was generated from tt.
"
Write-Host
"
Everything should be fine...
"
}
Write-Host
"
"
Write-Host
"
Tidy up now.
"
Write-Host
"
"
Remove-Item
-
Recurse
-
Path
$projectFolders
[
"
tmp
"
]
Write-Host
"
Start true Code-Generation.
"
;
Write-Host
"
"
;
Write-Host
"
Generate element wise operations + , - , * , /
"
;
Write-Host
"
"
;
$supportDataType
=
New-Object
'
System.Collections.Generic.List[System.String]
'
;
$supportDataType
.Add
(
'
System.Int32
'
);
$supportDataType
.Add
(
'
System.Int64
'
);
$supportDataType
.Add
(
'
System.Single
'
);
$supportDataType
.Add
(
'
System.Double
'
);
$supportDataType
.Add
(
'
System.Numerics.Complex
'
);
$supportDataType
.Add
(
'
System.Numerics.Quaternion
'
);
$operationTypeString
=
[
System.String
]::Join(
'
;
'
,
$supportDataType
);
$command
=
"
t4 -o - -p:operationName='+' -p:operationTypesString='
"
+
$operationTypeString
+
"
'
"
+
$projectFolders
[
'
tt.elementwise
'
]
+
"
>
"
+
$projectFolders
[
'
projectRoot
'
]
+
"
\src\NumSharp.Core\Operations\Elementwise\NdArray.Addition.cs
"
;
Write-Host
(
"
execute -
"
+
$command
);
Invoke-Expression
$command
;
$command
=
"
t4 -o - -p:operationName='*' -p:operationTypesString='
"
+
$operationTypeString
+
"
'
"
+
$projectFolders
[
'
tt.elementwise
'
]
+
"
>
"
+
$projectFolders
[
'
projectRoot
'
]
+
"
\src\NumSharp.Core\Operations\Elementwise\NdArray.Multiplication.cs
"
;
Write-Host
(
"
execute -
"
+
$command
);
Invoke-Expression
$command
;
$command
=
"
t4 -o - -p:operationName='/' -p:operationTypesString='
"
+
$operationTypeString
+
"
'
"
+
$projectFolders
[
'
tt.elementwise
'
]
+
"
>
"
+
$projectFolders
[
'
projectRoot
'
]
+
"
\src\NumSharp.Core\Operations\Elementwise\NdArray.Division.cs
"
;
Write-Host
(
"
execute -
"
+
$command
);
Invoke-Expression
$command
;
$command
=
"
t4 -o - -p:operationName='-' -p:operationTypesString='
"
+
$operationTypeString
+
"
'
"
+
$projectFolders
[
'
tt.elementwise
'
]
+
"
>
"
+
$projectFolders
[
'
projectRoot
'
]
+
"
\src\NumSharp.Core\Operations\Elementwise\NdArray.Substraction.cs
"
;
Write-Host
(
"
execute -
"
+
$command
);
Invoke-Expression
$command
;
Back
|
FazBrowse Home
|
New Git URL