小编dug*_*ggi的帖子

Purescript:为什么 genericEncodeJSON 不能对容器内的类型进行编码?

我不明白为什么下面的程序无法编译。

module Main where

import Prelude
import Effect (Effect)
import Effect.Console (log)
import Data.Generic.Rep (class Generic)
import Foreign.Generic (defaultOptions, genericEncodeJSON)

main :: Effect Unit
main = do
  log "Hello sailor!"

newtype Foo = Foo {
    x :: Int
  , y :: Int
  , z :: Array Bar
}

type Bar = {
    a :: String
  , b :: String
}

derive instance repGenericFoo:: Generic Foo _

fooToJSON :: Foo -> String
fooToJSON = genericEncodeJSON $ defaultOptions { unwrapSingleConstructors = true …
Run Code Online (Sandbox Code Playgroud)

purescript

5
推荐指数
0
解决办法
207
查看次数

在EIGEN中,c ++不能通过它的转置来乘以向量

执行以下代码时,我收到此错误:"INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS"

#include <iostream>
#include <Eigen/Dense> 
using namespace Eigen;
int main()
{
    Vector3d v(1, 2, 3);
    Vector3d vT = v.transpose();
    Matrix3d ans = v*vT;
    std::cout << ans << std::endl;
}
Run Code Online (Sandbox Code Playgroud)

没有编译器抱怨,有没有其他方法可以做到这一点?

c++ transpose eigen

1
推荐指数
1
解决办法
1425
查看次数

标签 统计

c++ ×1

eigen ×1

purescript ×1

transpose ×1