Skip to content

Commit

Permalink
Merge pull request #1 from njpipeorgan/paclet
Browse files Browse the repository at this point in the history
move to paclet
  • Loading branch information
njpipeorgan committed Jan 2, 2020
2 parents 4a389a2 + f3f7351 commit 38f6687
Show file tree
Hide file tree
Showing 29 changed files with 99 additions and 3 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
85 changes: 85 additions & 0 deletions IncludeFiles/math_base.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Compiler from Wolfram Language to C++
//
// Copyright 2019 Tianhuan Lu
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#pragma once

#include <immintrin.h>

#include "macros.h"
#include "traits.h"
#include "types.h"

namespace wl
{

template<size_t Bytes, typename T>
union _vec;

template<typename T>
union _vec<16u, T>
{
static_assert(is_arithmetic_v<T>, WL_ERROR_INTERNAL);
using base_type = value_type_t<T>;
using storage_type =
std::conditional_t<std::is_same_v<base_type, double>, __m128d,
std::conditional_t<std::is_same_v<base_type, float>, __m128, __m128i>>;
storage_type data;
T values[16u / sizeof(T)];
};

template<size_t Bytes, typename T>
union _vec
{
static_assert(is_arithmetic_v<T>, WL_ERROR_INTERNAL);
using base_type = value_type_t<T>;
using storage_type =
std::conditional_t<std::is_same_v<base_type, double>, __m256d,
std::conditional_t<std::is_same_v<base_type, float>, __m256, __m256i>>;
storage_type data;
T values[16u / sizeof(T)];
};

template<typename YT, size_t XW, typename XT>
auto _convert()
{
}

//template<typename X, typename Y>
//auto _add(const X& x, const Y& y)
//{
// using XV = value_type_t<XT>;
// using YV = value_type_t<YT>;
// using C = common_type_t<XV, YV>;
// if constexpr (is_complex_v<XT>)
// {
// if constexpr (is_complex_v<YT>)
// return complex<C>(std::real(x) + std::real(y),
// std::imag(x) + std::imag(y));
// else
// return complex<C>(std::real(x) + cast<C>(y), std::imag(x));
// }
// else
// {
// if constexpr (is_complex_v<YT>)
// return complex<C>(cast<C>(x) + std::real(y), std::imag(y));
// else
// return cast<C>(cast<C>(x) + cast<C>(y));
// }
//}

}

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions MathCompile.wl
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ loadfunction[libpath_String,funcid_String,args_]:=
]


$template=Import[$packagepath<>"/src/src_template.cpp","Text"];
$template=Import[$packagepath<>"/SourceFiles/src_template.cpp","Text"];

Options[compilelink]={
"LibraryDirectory"->"TargetDirectory"/.Options[CCompilerDriver`CreateLibrary],
Expand Down Expand Up @@ -952,7 +952,7 @@ compilelink[f_,uncompiled_,OptionsPattern[]]:=
{" ",",\n ",""}],
"funcid"->funcid
|>];
If[FileExistsQ[$packagepath<>"/src/math_compile.h"]=!=True,
If[FileExistsQ[$packagepath<>"/IncludeFiles/math_compile.h"]=!=True,
Message[link::noheader];Return[$Failed]];
mldir=$InstallationDirectory<>
"/SystemFiles/Links/MathLink/DeveloperKit/"<>$SystemID<>"/CompilerAdditions";
Expand All @@ -970,7 +970,7 @@ compilelink[f_,uncompiled_,OptionsPattern[]]:=
OptionValue["CompileOptions"]
},
"CleanIntermediate"->!TrueQ@OptionValue["Debug"],
"IncludeDirectories"->{mldir,$packagepath<>"/src"},
"IncludeDirectories"->{mldir,$packagepath<>"/IncludeFiles"},
"LibraryDirectories"->{mldir};
"Libraries"->{"ML64i4"},
"WorkingDirectory"->workdir,
Expand Down
11 changes: 11 additions & 0 deletions PacletInfo.wl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(* ::Package:: *)

Paclet[
Name -> "MathCompile",
Version -> "0.1.1",
WolframVersion -> "11.3+",
Updating -> Automatic,
Extensions -> {
{"Kernel", Root -> ".", Context -> {"MathCompile`"}}
}
]
File renamed without changes.

0 comments on commit 38f6687

Please sign in to comment.