Comments (3)
This should be already possible if you compile with -DFASTOR_ZERO_INITIALISE
flag.
from fastor.
I tried to add the flag -DFASTOR_ZERO_INITIALISE
using the cmake command target_link_options(Fastor INTERFACE -DFASTOR_ZERO_INITIALISE)
but i still can't initialize a constexpr Tensor<>
.
My CMake file is:
cmake_minimum_required(VERSION 3.22)
project(RungeKutta)
set(CMAKE_CXX_STANDARD 14)
add_subdirectory(Fastor)
target_link_options(Fastor INTERFACE -DFASTOR_ZERO_INITIALISE)
add_executable(RungeKutta main.cpp Methods/LobattoIIIC.cpp)
target_link_libraries(RungeKutta Fastor)
and my main.cpp is:
#include <iostream>
#include "Fastor/Fastor/Fastor.h"
using namespace Fastor;
constexpr Tensor<double, 3, 3> A = {
{1/6, -1/3, 1/6},
{1/6, 5/12, -1/12},
{1/6, 2/3, 1/6}
};
int main() {
Tensor<double,2,2> A, B;
A.iota();
B.iota();
Tensor<double,2,2> C = A%B;
print("C", C);
std::cout << "Hello, World!" << std::endl;
std::cout << 1/6 << std::endl;
return 0;
}
When i compile using CMake i get this error:
error: call to non-‘constexpr’ function ‘Fastor::Tensor<T, Rest>::Tensor(const std::initializer_list<std::initializer_list<U> >&) [with U = int; typename std::enable_if<is_primitive_v_<U>, bool>::type <anonymous> = false; T = double; long unsigned int ...Rest = {3, 3}]’
from fastor.
Just fixed in 6d7216f. Please download the latest copy of Fastor.
Note that, this is a road less tested (certain expressions cannot really be assigned using constexpr
) so if you experience further problems open a new issue. I am closing this one.
from fastor.
Related Issues (20)
- Multiplying a complex tensor with a complex number gives zero HOT 1
- ARM Support? HOT 1
- einsum can't handle big tensor and get stack overflow HOT 1
- [feature] Support for tensor fields. HOT 1
- Tensor network contraction fails
- Another Operation on Tensor View Bug HOT 2
- Seg Fault when attempting broadcast. HOT 1
- Inner product between 2 matrices HOT 1
- Support for apple's M1
- Python interfacer
- New minor release HOT 1
- How should I understood "Compile time operation minimisation such as graph optimisation, greedy matrix-chain products and nearly symbolic manipulations to reduce the complexity of evaluation of BLAS or non-BLAS type expressions by orders of magnitude" HOT 1
- Alternative einsum syntax using UDLs and tag dispatch HOT 2
- Build fails on PPC: simd_vector_scalar.h: error: assignment of read-only location '* data' HOT 2
- Variables in constructor do not compile HOT 2
- Is it possible to access a particular row or column of matrix and perform operation on it only HOT 1
- Pivoting speed HOT 1
- Heap allocation in debug builds due to FASTOR_EXIT_ASSERT macro HOT 1
- Row and column extractions on 2D tensors should use fixed views HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastor.